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

text: Always resolve a font, fall back to an empty font #18814

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Nov 30, 2024

This PR ensures that we always resolve some font, which is required for laying out text. When no font could be resolved, an empty font is returned that has no glyphs and has metrics with all values equal to 0.

This patch simplifies code a bit and adds a message in case of panic.
This patch refactors code a bit and provides Font::empty_font
which may be used to instantate a font without glyphs.
@kjarosh kjarosh added text Issues relating to text rendering/input A-core Area: Core player, where no other category fits T-fix Type: Bug fix (in something that's supposed to work already) labels Nov 30, 2024
@kjarosh kjarosh requested a review from evilpie November 30, 2024 22:00
This makes code a lot easier and ensures there's always
a font resolved to produce a proper text layout.
@kjarosh kjarosh force-pushed the resolve-font branch 3 times, most recently from 9559c74 to 353e5e4 Compare November 30, 2024 22:49
This test makes sure Ruffle does not panic when a default font is missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core player, where no other category fits 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.

Error on https://chasovnya.msk.ru/test.php
1 participant