Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
134 stars 2 forks source link

Text renderers ignore advance property when aligning text #2908

Open art0007i opened 1 week ago

art0007i commented 1 week ago

Describe the bug?

characters in a font can define how far away the next character should be. but text alignment ignores this

To Reproduce

spawn this in: resdb:///316e8b6978bafdf633d68e45e0b7f95345a55f6103c96b3111b1a9f951b739d6.brson the top half has an extra letter appended and there the advance is working correctly the bottom half is the same as the top but no extra letter and it ignores the advance completely

Expected behavior

the text renderer takes advance into account when aligning text

Screenshots

No response

Resonite Version Number

Beta 2024.9.6.1189

What Platforms does this occur on?

Windows

What headset if any do you use?

No response

Log Files

n/a

Additional Context

No response

Reporters

No response

shiftyscales commented 1 week ago

characters in a font can define how far away the next character should be. but text alignment ignores this

This sounds like it may be a duplicate of #204 if I'm understanding your issue correctly, @art0007i?

5H4D0W-X commented 1 week ago

characters in a font can define how far away the next character should be. but text alignment ignores this

This sounds like it may be a duplicate of #204 if I'm understanding your issue correctly, @art0007i?

it's similar but not quite the same. #204 is about kerning - which determines the spacing between letters - being wrong, but it seems to be about a specific type of kerning not being processed correctly. This issue is about kerning of any kind being completely ignored in favor of character bounds when aligning text horizontally (and vertically when in Geometric alignment mode, but that's intended)

Frooxius commented 1 week ago

It might help to add some screenshots to this.

5H4D0W-X commented 1 week ago

This is however a duplicate of #770, just that this issue describes the cause and not the symptom (as monospaced fonts just illustrate the issue more clearly and aren't the cause)

5H4D0W-X commented 1 week ago

that issue also has screenshots explaining it, so I'll copy them here: 285118013-805b04ce-962a-4eed-92e7-0a6621887629

285118033-ddc61ae2-10d0-4b12-98a9-4a25f8f4c5f4

art0007i commented 1 week ago

2024-09-09 21 16 05 here's a pic. both sprites have the same advance but the bottom one doesnt care

it's not related to kerning at all

5H4D0W-X commented 1 week ago

As far as I understand it advance width is kerning, just a very primitive type of kerning where characters are put in a row with the distance between them dictated by the prior character's advance width. This is the same issue as in #770 of alignment being done based on bounding box, since advance width does not contribute to the bounding box unless it's affecting another character's position

Frooxius commented 1 week ago

This doesn't look like a kerning issue to me. Advance isn't the same thing as kerning.

Kerning is specifically affecting particular types of characters, adjusting their relative position to each other, rather than using monotone advancement.

E.g. consider letters "VA" vs "VV". The V and A are closer together, because kerning modifies the advancement for that particular pair because of their shapes that fit together.