Page MenuHome

Fix for T101481: 3D Text Objects Wingdings Font
AbandonedPublic

Authored by Harley Acheson (harley) on Oct 1 2022, 7:13 PM.

Details

Summary

Allow use of Wingdings and (most) other symbol fonts when using 3D Text
Objects, by setting explicit character mapping.


I first allowed the use of Wingdings and symbol fonts with a commit in 2021-08-04 rBae920d789ed3: VSE: Allow Wingdings and Symbol Fonts. At that time these types of fonts were detected as okay, but would then fail to load because they do not have a Unicode character map. So I set one in the same way it is done elsewhere.

However, this appears to have broken about a month later. Although I would be happy to know that I broke it myself with some change, I don't see any evidence of that. It appears that our check for "is this font okay?" has never set a character map. So this change in behavior appears to be a change in an updated FreeType. Its current behavior, when opening a face, is to set a Unicode charmap if available, but not set one if there is not a Unicode charmap. It used to try hard to set some "next-best" charmapping, but that was a bit silly in that you wouldn't know this happened, would have to ask for the setting, and most of the time it would be wrong.

Anyway, this patch just sets the same character mapping in check_freetypefont as we already have in objfnt_to_ftvfontdata and elsewhere.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) edited the summary of this revision. (Show Details)Oct 1 2022, 7:15 PM

Since this is matching objfnt_to_ftvfontdata, better move this to a static function, with a note that blf_ensure_face also has this logic.

(no need for extra review).

source/blender/blenkernel/intern/vfontdata_freetype.c
370

Worth cross-referencing with blf_ensure_face (changes there probably apply here too).

This revision is now accepted and ready to land.Oct 6 2022, 6:08 AM

@Campbell Barton (campbellbarton) - Since this is matching objfnt_to_ftvfontdata, better move this to a static function, with a note that blf_ensure_face also has this logic.

Sorry for the bother...because I really do not mind putting that character-mapping code into a static function that is shared by objfnt_to_ftvfontdata and check_freetypefont.

However, my preference is to remove the duplication that makes that necessary. I added a patch with what I mean: D16174: Fix for T101481: Improved VFont Loading, hopefully explaining it well enough.

Again, I don't mind doing this simply as we are doing here and leaving any further changes for early in 2.5 perhaps?