Possible bug with draw event?

C

CedSharp

Guest
I'll keep it simple.
If I draw a black rectangle and try to draw some text on it,
if the font isn't the default font, then it draws with a weird blending problem.

Here is an example:


Clearly, The text drawn is the same color ( the color isn't changed )
Yet, the one in the textbox isn't white, it's either grey, or white with opacity lower than 1.
( I tried setting alpha to 1, doesn't change anything )

I also tried reseting everyting just before drawing the text:
Code:
draw_set_font( font0 );
draw_set_color( $FFFFFF );
draw_set_alpha( 1 );
I've also tried removing anti-aliasing and high quality from the font.
Other than making the font pixelated, didn't change anything.

I have to draw the text 3 times to get white.
If anyone had this issue, please I'd like to know how to fix it.


-- EDIT --

I'm on GameMaker Studio 1.4, not GMS 2.0.
I tried it on GameMaker Studio 2.0 and the issue doesn't occure.
So this seems like a bug with the rendering of GM:S 1.4...

-- EDIT 2 --

When drawing above a black sprite, everything is fine, it draws white.
Even when I draw part of the text outside the dialog box, the text is white
outside, but the bug occurse on the part that is above the dialog

 
Last edited:

Tsa05

Member
Anti-Aliasing on your font? Try turning it off, and see if that fixes it.


With anti-aliasing OFF

With anti-aliasing ON
 
C

CedSharp

Guest
Anti-Aliasing on your font? Try turning it off, and see if that fixes it.


With anti-aliasing OFF

With anti-aliasing ON
1. I forgot to mention, I'm on GameMaker Studio 1.4, not GameMaker 2.0. The issue doesn't happen on GMS 2.0.

2. If you read my post above, I already said I tried it and it didn't fix my problem.
 

Tthecreator

Your Creator!
It's a very weird issue indeed. My first guess would still be some weird alpha blending issue...
Maybe you can test a shader or blendmode that ignores alpha?

Besides that,I'm pretty much clueless and don't have much more to say.

I did try to recreate to problem myself but I got this:
upload_2017-1-12_19-24-14.png
Using:
Code:
draw_set_color(c_white)
draw_text(0,20,"Hello World")
draw_rectangle_color(
0,50,room_width,room_height,
$404040,$404040,$181818,$181818,false
);
draw_set_font(uiz_fnt_default)
draw_text_ext(0,55,"Hello World",-1,90)
In a room of 300x100
 
C

CedSharp

Guest
It's a very weird issue indeed. My first guess would still be some weird alpha blending issue...
Maybe you can test a shader or blendmode that ignores alpha?

Besides that,I'm pretty much clueless and don't have much more to say.

I did try to recreate to problem myself but I got this:
View attachment 6027
Using:
Code:
draw_set_color(c_white)
draw_text(0,20,"Hello World")
draw_rectangle_color(
0,50,room_width,room_height,
$404040,$404040,$181818,$181818,false
);
draw_set_font(uiz_fnt_default)
draw_text_ext(0,55,"Hello World",-1,90)
In a room of 300x100
I often used white on black in the past.
It seems to do so only with some specific fonts.
Maybe it has to do with TTF and OTF and WOFF font files...
I don't know, I have so many fonts installed.
 
P

ph101

Guest
I've noticed problems with GM:S 1.4 fonts and made a thread on it (possibly old forum) to no avail. When using font files ie TTF and not defining them from sprite files - what I found was that the characters do not actually line up in a line - it seems maybe you have this also as the charcter 'i' in your pic appears to be slightly lower than the 'H'. Changing any of the settings eg high quality, AA had no effect. Now that I think about it, I also had the wierd grey text issue too. It happened with any font defined through the GM font tool that was a font I had manually installed on the system.

I haven't looked that closely at it yet but my only work around at the time was to define the font directly from a sprite using "font_add_sprite_ext" - however this is likely going to create spacing problems. Would like to know the cause and if you have noticed and spacing/ledding issues too. I'm not sure but wonder if most users define fonts via sprites and so do not encounter this.
 
C

CedSharp

Guest
I've noticed problems with GM:S 1.4 fonts and made a thread on it (possibly old forum) to no avail. When using font files ie TTF and not defining them from sprite files - what I found was that the characters do not actually line up in a line - it seems maybe you have this also as the charcter 'i' in your pic appears to be slightly lower than the 'H'. Changing any of the settings eg high quality, AA had no effect. Now that I think about it, I also had the wierd grey text issue too. It happened with any font defined through the GM font tool that was a font I had manually installed on the system.

I haven't looked that closely at it yet but my only work around at the time was to define the font directly from a sprite using "font_add_sprite_ext" - however this is likely going to create spacing problems. Would like to know the cause and if you have noticed and spacing/ledding issues too. I'm not sure but wonder if most users define fonts via sprites and so do not encounter this.
My fix currently is to draw the text 3 times to get white.
Creating a sprite from it might not be a bad idea.
( I did it often for bmp fonts )

It just feels weird that GameMaker 1.4, as matured as it is, has problems with such basic thing as font handling.
( I say basic, but of course font isn't a simple matter. But at the scale GM is right now, it shouldn't be a problem. )
 
P

ph101

Guest
Have you also noticed the janky spacing on the y axis? If you look at your pic - the "e" in "white" is noticeably higher than the "t" for example (and then there is also "i" and "H" issues I mentioned on "Hi"). Are you using a non system font using the GM font creation thing? Ie a manually installed TTF? This is where I have the issue (as far as I remember).

Janky placement on the y axis doesn't appear to occur on Tsa05 's image but I hazard that is because he is using a system font (arial). Also seems to resolve the blending issue, but not much help. Like I say, using font_add_sprite is currently my only solution. It could be to do with the font file i'm adding (but happens on multiple different test fonts). I also don't understand how this problem can exist without more people being affected.

Another thought though. I also found that center justifying such a font can cause GM to draw it not on a rounded pixel (I think) and depending your scaling this might make the font blur of appear off colour, so check that and related the thread, as left justifying might help: https://forum.yoyogames.com/index.php?threads/using-a-system-font-in-gm-s-slices-off-edge.8388/
 
C

CedSharp

Guest
I agree, with arial it works fine. Seems like you were right, @ph101, it's all about installed fonts.
The y axis displacement is noticable, but personally I don't care. Even the default font of gamemaker has that problem.

I'm currently working on a dialog engine, and this problem is quite a let down for me. People will say "your engine doesn't use the correct colors for my text"...
I need a fix, and seems I'll have to generate font sprites internally.
 
Top