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

HarfBuzz 4.4.0 breaks character sizing with SDL2_ttf #3746

Closed
a-hurst opened this issue Jul 21, 2022 · 4 comments
Closed

HarfBuzz 4.4.0 breaks character sizing with SDL2_ttf #3746

a-hurst opened this issue Jul 21, 2022 · 4 comments

Comments

@a-hurst
Copy link

a-hurst commented Jul 21, 2022

Hi there,

Just reported this to the SDL2_ttf team and they asked that I report it here. Basically, with HarfBuzz 4.4.1, updating the size of a font after opening it seems to update its internal character widths incorrectly such that increasing font size means characters get larger but not much farther apart. See the images in the SDL issue here for an illustration of what's going on: libsdl-org/SDL_ttf#232

If I manually roll back HarfBuzz to 4.3.0 the problem disappears, so it's something that changed between that version and now that's causing problems.

Internally, SDL2_ttf uses FreeType to update the size of an open font and then calls hb_ft_font_changed on the underlying harfbuzz font to update it (see the code for TTF_SetFontSizeDPI here). The calculation of character sizes and spacing happens here. Is this code doing something wrong, or did 4.4.0/4.4.1 introduce an unexpected bug?

Thanks in advance!

Austin

@behdad
Copy link
Member

behdad commented Jul 22, 2022

If I manually roll back HarfBuzz to 4.3.0 the problem disappears, so it's something that changed between that version and now that's causing problems.

Things did indeed change. I'm sorry it broke this. I'm looking into it. If you can share your SDL sample app it would help debugging. Thanks.

@behdad
Copy link
Member

behdad commented Jul 22, 2022

If you can share your SDL sample app it would help debugging. Thanks.

Nevermind. I can reproduce this now.

@behdad behdad closed this as completed in cb5ca6b Jul 22, 2022
@behdad
Copy link
Member

behdad commented Jul 22, 2022

Should be fixed.

@a-hurst
Copy link
Author

a-hurst commented Jul 22, 2022

Fantastic, thanks so much!

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

No branches or pull requests

2 participants