Skip to content

Conversation

@kjarosh
Copy link
Member

@kjarosh kjarosh commented Dec 4, 2024

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 because Font::evaluate skipped them.

@kjarosh kjarosh added text Issues relating to text rendering/input A-avm2 Area: AVM2 (ActionScript 3) T-fix Type: Bug fix (in something that's supposed to work already) labels Dec 4, 2024
@kjarosh kjarosh marked this pull request as draft December 4, 2024 21:35
@kjarosh kjarosh added the waiting-on-review Waiting on review from a Ruffle team member label Dec 5, 2024
core/src/font.rs Outdated
x += twips_advance;
} else {
// No glyph, zero advance
glyph_func(pos, &transform, &Glyph::empty(), Twips::ZERO, x);
Copy link
Collaborator

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?

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kjarosh kjarosh force-pushed the evaluate-missing-glyphs branch 2 times, most recently from ff00d12 to d8404e7 Compare December 19, 2024 20:07
@kjarosh kjarosh force-pushed the evaluate-missing-glyphs branch from d8404e7 to 89c2faa Compare December 19, 2024 21:53
@kjarosh kjarosh requested a review from adrian17 December 19, 2024 21:58
@kjarosh kjarosh marked this pull request as ready for review December 19, 2024 21:58
@kjarosh kjarosh force-pushed the evaluate-missing-glyphs branch from 89c2faa to 8e6d363 Compare December 25, 2024 08:29
@kjarosh kjarosh removed the waiting-on-review Waiting on review from a Ruffle team member label Jan 5, 2025
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.
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.
@kjarosh kjarosh force-pushed the evaluate-missing-glyphs branch from 8e6d363 to f579bc8 Compare January 5, 2025 08:19
@kjarosh kjarosh enabled auto-merge (rebase) January 5, 2025 08:19
@kjarosh kjarosh merged commit 056766b into ruffle-rs:master Jan 5, 2025
22 checks passed
@kjarosh kjarosh deleted the evaluate-missing-glyphs branch January 5, 2025 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) T-fix Type: Bug fix (in something that's supposed to work already) text Issues relating to text rendering/input

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants