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

[TextServer] Reset subpixel shift on blank glyphs. #98664

Merged
merged 1 commit into from
Dec 2, 2024

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Oct 30, 2024

Fixes #98659

Regression from #93256, accumulated subpixel shift remainder was unnecessarily preserved over word/line break.

@bruvzg bruvzg added this to the 4.4 milestone Oct 30, 2024
@bruvzg bruvzg requested a review from a team as a code owner October 30, 2024 09:17
@Lielay9

This comment was marked as resolved.

@bruvzg bruvzg force-pushed the ts_reset_subpixel_shift branch from f7c3808 to c3a85ac Compare October 31, 2024 06:41
@Lielay9
Copy link
Contributor

Lielay9 commented Oct 31, 2024

Mandatory linebreaks work, BREAK_ADAPTIVE and BREAK_GRAPHEME_BOUND still cause issues (first line missmatch expected but second and third should be identical),
Screenshot 2024-10-31 212227

@Lielay9
Copy link
Contributor

Lielay9 commented Oct 31, 2024

Additionally, even content on the same line is rather flickery compared to 4.2.

FLICKERING WARNING!

4.4 ,

BADDY_CROPPED.mp4

4.2 ,

GOODY_CROPPED.mp4

@bruvzg
Copy link
Member Author

bruvzg commented Oct 31, 2024

Additionally, even content on the same line is rather flickery compared to 4.2.

That's looks expected, kerning always have subpixel values, and glyphs are aligned to the pixel boundaries. If you do not want it to be aligned, enable subpixel positioning in the font import settings.

Mandatory linebreaks work, BREAK_ADAPTIVE and BREAK_GRAPHEME_BOUND still cause issues (first line missmatch expected but second and third should be identical),

Enabling subpixel positioning should fix it as well. Fixing it for the pixel aligned font require either full resahping of the sub-strings (a big performance impact), or moving rounding step to draw (can't be done since draw calls do not have any global context), or rounding each glyph position individual (like it was in 4.2, which will reintroduce #93199). I guess we can make #93256 and optional import setting as well.

@Lielay9
Copy link
Contributor

Lielay9 commented Nov 1, 2024

That's looks expected, kerning always have subpixel values, and glyphs are aligned to the pixel boundaries. If you do not want it to be aligned, enable subpixel positioning in the font import settings.

Thanks, using more aggressive subpixel setting seems to alleviate most of the remaining issues.

Enabling subpixel positioning should fix it as well. Fixing it for the pixel aligned font require either full resahping of the sub-strings (a big performance impact), or moving rounding step to draw (can't be done since draw calls do not have any global context), or rounding each glyph position individual (like it was in 4.2, which will reintroduce #93199). I guess we can make #93256 and optional import setting as well.

I cannot speak for the technical side so I have no opinion on that front. That said, the issue (#98659) was found in our accessibility tests flagging a multiline text editor as a potential source of epilepsy. Of course, sizable blocks of text are notoriously bad for photosensitive individuals moving or not, but flickering is definitely not helping (read more). It might be a false flag on our part, but I'd rather err on the side of caution in these kind of issues.

Therefore, if I'm to understand that #93256 is necessary for some fonts to function correctly and fixing the remaining issues isn't feasible, I'm in favor of exposing the original behavior. In addition, maybe the AUTO subpixel positioning could be made more aggressive? It seems to only take effect on sizes no game should probably even use.

@bruvzg bruvzg force-pushed the ts_reset_subpixel_shift branch from c3a85ac to e81a2af Compare November 1, 2024 08:19
@bruvzg bruvzg requested review from a team as code owners November 1, 2024 08:19
@akien-mga akien-mga merged commit fa26411 into godotengine:master Dec 2, 2024
20 checks passed
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Multiline text glyph precision issue (TextEdit, TextParagraph etc.)
3 participants