BLF: Improved Cached Fallback Font Setup #114018

Merged
Harley Acheson merged 1 commits from Harley/blender:FontSetup into main 2023-10-22 03:55:07 +02:00

1 Commits

Author SHA1 Message Date
Harley Acheson 6039290c33 BLF: Improved Cached Fallback Font Setup
buildbot/vexp-code-patch-coordinator Build done. Details
Changes to FontBLF initialization so that the cached fallback fonts
- which remain faceless until needed - get all required setup.
Otherwise they are not kerned and we also don't get metrics from them.

---

This is actually an old PR on Phab. https://archive.blender.org/developer/D15844

This largely just breaks up `blf_ensure_face` into two parts so that some setup can be called from it and also from the `blf_cache_face_requester` callback.

We distribute some fonts that are specific to particular languages or uses and we therefore do not want to fully set them up until they are actually used. But with the addition of the FreeType Caching subsystem those fonts do not get a Face until the caching system itself initiates it and we are informed via a callback. At that point calling blf_ensure_face does nothing since the face now exists. This means that they do not get some setup that they would have gotten if caching wasn't enabled or if they were not created to be initially faceless.

Without this fix, fallback fonts will not do kerning if the font supports that, but none of these fonts are used for Latin text anyway. They also will not support variable font features if they are of that type. And we would not get font metrics from them. All these things are now becoming more important.
2023-10-21 17:58:18 -07:00