Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

letter spacing not working? #2015

Open
Meister-anon opened this issue Jul 14, 2024 · 1 comment
Open

letter spacing not working? #2015

Meister-anon opened this issue Jul 14, 2024 · 1 comment

Comments

@Meister-anon
Copy link

Meister-anon commented Jul 14, 2024

not 100% on this but when I attempted to use AddTextPrinterParameterized4
to shift letter spacing I found it didn't work it seemed the field was never used?

printer.letterSpacing = letterSpacing;

it gets passed to that field and then goes to AddTextPrinter function

within the function letter spacing isn't used instead minLetterSpacing is used
sTempTextPrinter.minLetterSpacing = 0;

which gets defaulted to zero.

No matter what value I set letterspacing to in AddTextPrinterParameterized4
it had no effect but changing minLetterSpacing did.

So my fix was assigning letter spacing to the field

sTempTextPrinter.minLetterSpacing = sTempTextPrinter.printerTemplate.letterSpacing;

I was working in fire red when I found this, but then saw it was the same in both emerald
and emerald expansion.

idk if this is the best fix or not, but its what worked for me and it seem right
as the RenderText function has a condition based on the value of minLetterSpacing
but by default the field is always 0.

if (textPrinter->minLetterSpacing)
        {
            textPrinter->printerTemplate.currentX += gGlyphInfo.width;
            width = textPrinter->minLetterSpacing - gGlyphInfo.width;
            if (width > 0)
            {
                ClearTextSpanDebug(textPrinter, width);
                textPrinter->printerTemplate.currentX += width;
            }
        }
@Meister-anon
Copy link
Author

Meister-anon commented Jul 14, 2024

made extra change,
in the RenderText function replaced the lines in the last codeblock


//width = textPrinter->minLetterSpacing - gGlyphInfo.width;
                width = textPrinter->minLetterSpacing;

with how it worked the spacing given by letterspacing would be determined by its diff to the glyph width for the specific character making the letterspacing field confusing to use.

With this change setting letter spacing to 2 would actually be an increase of 2.
without needing to do extra math for specific width of the character.
mGBA_CZvl2w2Ez4

It seems to be working, before this change had to use values at or above 8 to make a difference.

now the same changes are just from using values of 1, 3, and 0.

ps.
If you attempt same fix I did you'd need to go through and make all instances of letterspacing in
addtextprintparameterized etc. 0.

same thing for the letterspacing values in window templates as seen in dex listmenu etc.
and functions that pass letterspacing equivalents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant