Text colour incorrect at start of a line
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
-
-
- Posts: 373
- Joined: Mon Jun 27, 2016 7:26 pm
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Contact:
Text colour incorrect at start of a line
Here's an example. The opening parenthesis before the URL should be gray, but it is orange. Only the URL should be orange.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: Text colour incorrect at start of a line
I can confirm this has been happening for a long time, seemingly arbitrarily, every time line breaking is involved. I just never figured a way to reproduce it consistently, though, so it's nice to see a proper report.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49053
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Text colour incorrect at start of a line
If this is about line breaking screwing up text colors, yes, this is ancient. However, due to the inevitable fact that some mods depend on it it could not be fixed.
For multiline text, each line needs to start with a color control code then.
For multiline text, each line needs to start with a color control code then.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: Text colour incorrect at start of a line
Mods depend on broken color when breaking lines?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49053
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Text colour incorrect at start of a line
Don't ask me, this was more than 10 years ago. Randi declined to fix it back then.
-
-
- Posts: 373
- Joined: Mon Jun 27, 2016 7:26 pm
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: Text colour incorrect at start of a line
It's not exactly multi-line... It's one line of text, but it gets wrapped to 4 lines because of the SetHudSize call.Graf Zahl wrote:For multiline text, each line needs to start with a color control code then.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: Text colour incorrect at start of a line
Looking at V_BreakLines it does seem that it TRIES to preserve color escapes when splitting a line in half, but it doesn't always work, even though one quick look through the code tells me everything is fine, but maybe it goes deeper.
Re: Text colour incorrect at start of a line
I think we have narrowed down the cause of this bug...
V_BreakLines does not account for colors that are defined after the space that ends up being use to split the string into lines once the max width is hit...
So something nonsensical like this:
SetHudSize(640, 400, 1);
SetHUDWrapWidth(150);
HudMessage(s:"\cCThis is a test string\cR!!!!!!!!"; 0, 1, CR_UNTRANSLATED, 100.0, 100.0, 0, 1.0);
...would end up split between 'test' and 'string', but because the "\cR" would have already been parsed before the max width was hit (but after the last whitespace was set), the next line would start out colored dark red (R), despite still being supposed to be gray (C).
Simple map with this script included is attached.
V_BreakLines does not account for colors that are defined after the space that ends up being use to split the string into lines once the max width is hit...
So something nonsensical like this:
SetHudSize(640, 400, 1);
SetHUDWrapWidth(150);
HudMessage(s:"\cCThis is a test string\cR!!!!!!!!"; 0, 1, CR_UNTRANSLATED, 100.0, 100.0, 0, 1.0);
...would end up split between 'test' and 'string', but because the "\cR" would have already been parsed before the max width was hit (but after the last whitespace was set), the next line would start out colored dark red (R), despite still being supposed to be gray (C).
Simple map with this script included is attached.
- Attachments
-
- MAP01.wad
- (1.91 KiB) Downloaded 48 times
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49053
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Text colour incorrect at start of a line
Yeah, this was rather dumb. Fixed