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

Inline fallback fonts should be sized to main font’s EM height, not line height #739

Open
astiob opened this issue Mar 12, 2024 · 0 comments

Comments

@astiob
Copy link
Member

astiob commented Mar 12, 2024

When a glyph is missing in the middle of a run and a fallback font is selected for it, then instead of scaling usWinAscent + usWinDescent to \fs for the fallback font in the same manner as we do for the main font, we should scale the fallback’s units_per_EM to the same amount of pixels that the main font’s units_per_EM occupy after applying the main font’s scale, i. e.:

fallback_font->scale =
    fs / (main_font->usWinAscent + main_font->usWinDescent)
    * main_font->units_per_EM / fallback_font->units_per_EM;

This seems to be how GDI does it (see test in #706 (comment), although more comprehensive tests are welcome), and this would also help with fallback between Noto Sans and Noto Sans Arabic in mpv-player/mpv#13396.

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

No branches or pull requests

1 participant