-
-
Notifications
You must be signed in to change notification settings - Fork 828
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
text: Fix getCharBoundaries()
for 0-width characters
#18860
base: master
Are you sure you want to change the base?
Conversation
@@ -613,6 +619,9 @@ impl<'gc> Font<'gc> { | |||
// Step horizontally. | |||
transform.matrix.tx += twips_advance; | |||
x += twips_advance; | |||
} else { | |||
// No glyph, zero advance | |||
glyph_func(pos, &transform, &Glyph::empty(), Twips::ZERO, x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between processing a "noop" glyph and skipping it entirely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've described it in my commit message:
This is a natural assumption of Font::evaluate and makes writing code easier.
Code that renders glyphs will work the same way as non-renderable characters
will produce empty glyphs, but code that evaluates the font for measurement
purposes will use this property.
I'll add a short comment about it here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
2a8e0c7
to
ff00d12
Compare
This is a natural assumption of Font::evaluate and makes writing code easier. Code that renders glyphs will work the same way as non-renderable characters will produce empty glyphs, but code that evaluates the font for measurement purposes will use this property.
ff00d12
to
d8404e7
Compare
This test verifies how getCharBoundaries() works when glyphs are missing.
This test verifies how getCharBoundaries() works when glyphs are missing due to embedded font not being present.
d8404e7
to
89c2faa
Compare
Basically,
getCharBoundaries()
returns null for 0-width characters. This PR also fixes a bug where some characters (with missing glyphs) were not taken into account properly becauseFont::evaluate
skipped them.