libsdl-org/SDL_ttf

Font rendering broken when linked to HarfBuzz > 4.3.0?

a-hurst opened this issue · 6 comments

Just caught this problem testing out PySDL2 with the latest SDL2_ttf installed with homebrew, which recently updated its HarfBuzz from 4.3.0 to 4.4.1. For whatever reason, a change between these two versions breaks how TTF calculates character widths with HarfBuzz enabled such that updating a font's size with TTF_SetFontSize increasing the character size while only minimally affecting character spacing, so characters get squished together. When I manually uninstalled brew's harfbuzz 4.4.1 and reinstalled 4.3.0, the problem was immediately fixed. You can see the difference immediately with the PySDL2 ttf.py demo:

All the below images are using SDL_ttf 2.20.0 installed from Homebrew on macOS 12:

Font opened at 20pt (HarfBuzz 4.3.0):
Screen Shot 2022-07-21 at 7 20 32 PM
Font resized to 30pt with TTF_SetFontSize (HarfBuzz 4.3.0):
Screen Shot 2022-07-21 at 7 20 23 PM
Font opened at 20pt (HarfBuzz 4.4.1):
Screen Shot 2022-07-21 at 7 21 14 PM
Font resized to 30pt with TTF_SetFontSize (HarfBuzz 4.4.1):
Screen Shot 2022-07-21 at 7 21 24 PM

I don't have enough C knowledge to really help track down the cause, but I figured I should let you know before more distros and package managers update their HarfBuzz versions!

Can you please report this upstream to HarfBuzz?

@slouken Just did! Hopefully it's an easy fix.

Thanks!

I'm looking into this. Can you share the sample app?

I'm looking into this. Can you share the sample app?

Nevermind. I can reproduce this now.

Mainstream seems to have fixed this by harfbuzz/harfbuzz@cb5ca6b

Close this?