Page MenuHome

Fix T100242: Handle Flushed FT Sizes
ClosedPublic

Authored by Harley Acheson (harley) on Aug 6 2022, 7:55 PM.

Details

Summary

Properly deal with FreeType cache flushing a font's ft_size. Set this
to NULL in finalizer, and add a blf_ensure_size to make sure it
exists only when needed.


Current code uses FreeType caching, which ensures only a limited number of faces and size structures are loaded simultaneously. Unfortunately this means that a font's size can be removed without us knowing. We deal with face removal properly but not size removal. This change properly sets the font->ft_size to NULL when it is removed by the cache. It also adds a blf_ensure_size function that just passes through if the font_ft_size exists, but requests and points to a new one if not.

Diff Detail

Repository
rB Blender

Event Timeline

We actually can't tolerate failure here, so using BLI_assert_unreachable() on failure inside blf_ensure_size

Krzysztof Trzciński (elmo) added inline comments.
source/blender/blenfont/intern/blf_font.c
1558

This needs return to not fail debug (or developer, whichever it is that enables warnings to be treated as errors) compilation.

Adding a return in blf_ensure_size after the BLI_assert_unreachable to calm compiler warning.

Harley Acheson (harley) marked an inline comment as done.Aug 6 2022, 8:46 PM
This revision is now accepted and ready to land.Aug 8 2022, 11:56 AM
This revision was automatically updated to reflect the committed changes.