JujuAdams / Scribble

Efficient, internationalized, multi-effects text renderer for GameMaker
https://www.jujuadams.com/Scribble/
MIT License
335 stars 46 forks source link

Scribble fails to use the default font when using a specific custom color and trying to render a specific string #531

Closed mabechard closed 4 months ago

mabechard commented 4 months ago

I am having a problem where scribble renders text in a different font when I am using a specific custom color with a specific text value.

From my own debugging, this seems to be related to the name of the color, which I named c_ap and the value which I am trying to render, the string "3".

Changing either the value of the text or the name of the custom color fixes the issue, since the value is important, as a temporary fix I am going to rename the color.

The value of the color itself does not change the outcome of the bug.

This is what happens if I use c_ap: image

This is what should be happening (what happens when I rename it to _c_ap: image

Here is the content of my color config if that helps.

function __scribble_config_colours()
{
    static _colours = {
        //Duplicate GM's native colour constants
        c_aqua:    c_aqua,
        c_black:   c_black,
        c_blue:    c_blue,
        c_dkgray:  c_dkgray,
        c_dkgrey:  c_dkgrey,
        c_fuchsia: c_fuchsia,
        c_gray:    c_gray,
        c_green:   c_green,
        c_gray:    c_gray,
        c_grey:    c_grey,
        c_lime:    c_lime,
        c_ltgray:  c_ltgray,
        c_ltgrey:  c_ltgrey,
        c_maroon:  c_maroon,
        c_navy:    c_navy,
        c_olive:   c_olive,
        c_orange:  c_orange,
        c_purple:  c_purple,
        c_red:     c_red,
        c_silver:  c_silver,
        c_teal:    c_teal,
        c_white:   c_white,
        c_yellow:  c_yellow,

        //Here are some example colours
        c_coquelicot: scribble_rgb_to_bgr(0xff3800),
        c_smaragdine: scribble_rgb_to_bgr(0x50c875),
        c_xanadu:     scribble_rgb_to_bgr(0x738678),
        c_amaranth:   scribble_rgb_to_bgr(0xe52b50),

        _c_ap: make_colour_rgb(3, 190, 252),
        c_ap: make_colour_rgb(3, 190, 252),
        c_str: make_colour_rgb(172, 20, 57),
        c_dex: make_colour_rgb(238, 128, 0),
        c_con: c_red,
        c_heal: make_colour_rgb(82, 235, 52),
        c_mgt: make_colour_rgb(228, 234, 2),
        c_agi: c_green
    };

    return _colours;
}
JujuAdams commented 4 months ago

Likely a GM bug though it's probably possible to write a workaround. I will need to obtain a copy of your project to verify this, however.

mabechard commented 4 months ago

I've been doing more debugging and the problem seems to be happening under many more circumstances.

JujuAdams commented 4 months ago

Still will need to see your project.

mabechard commented 4 months ago

Yeah I get that, but my project is pretty big and I'd rather not share the entire codebase since its intended for commercial use. I eventually found a workaround by explicitly using draw_set_font to reset the font.

If this is not a one-of report and you'd like to do some more digging, we could arrange a live debugging call or I could make a stripped down build of the game and send it over but since this is probably a one-of report, there's a high chance the bug is in my own code so I will close the ticket.

JujuAdams commented 4 months ago

We can always sign an NDA.