mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 06:51:01 +01:00
#6499 added caches for the vertical advance and origin, but also changed what the origin is: its x became half the horizontal advance (as hb-ot does) instead of FreeType's horiBearingX - vertBearingX, and a glyph FreeType fails to load got a cached origin of 0 instead of the callback returning false. That changed shaping output for fonts whose vertical bearings are not centered (e.g. bitmap-only fonts), and stopped the fallback to h_origins on load failure. Keep the caches, but cache both the x and y FreeType computes, the same way as before #6499, and return false on load failure without caching anything. Values that don't fit the unsigned cache after sign normalization are simply not cached. Testing: meson test -C build passes. test-ft now checks the batched origins against FreeType's bearings and that a failed load returns false on repeat queries. hb-shape --font-funcs=ft --direction=ttb output over NotoSansKR plus 80 shape/api test fonts, at several sizes, a variation, and negative scale (810 runs) is identical to the commit before #6499; on main 30 of those differed (aat-feat, chromacheck-cbdt, chromacheck-sbix). Follow-up to #6499 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>