Page MenuHome

Add kerning support for 3DText
Needs ReviewPublic

Authored by Sebastian Witt (witt) on Oct 8 2016, 1:53 PM.
Tokens
"Like" token, awarded by stianandreassen."Like" token, awarded by pablovazquez."Burninate" token, awarded by EAW."Burninate" token, awarded by Memento."Love" token, awarded by Huperniketes."Love" token, awarded by sam_vh.

Details

Summary

This is my second approach on adding kerning support for the 3DText objects.
For a reference here is my first approach: https://developer.blender.org/T47725

Kerning is added by, keeping the Freetype2 Lib loaded and the data for the font face within the vFontData object.
So FT_Get_Kerning can be accessed while the vFontData exists.

I hope the code fits to all the standards!
Any kind of feedback is appreciated,

Sebastian Witt

Diff Detail

Repository
rB Blender

Event Timeline

Sebastian Witt (witt) retitled this revision from to Add kerning support for 3DText.
Sebastian Witt (witt) updated this object.
Sebastian Witt (witt) set the repository for this revision to rB Blender.

Patch is mostly OK I think, besides points noted below, and please respect our code style.

Wouldn’t mind @Sergey Sharybin (sergey)'s advice here though, he knows our 3DText code much better than I do…

source/blender/blenkernel/intern/font.c
271–275

Why remove this? it may lead to pf leaking? would rather add check on vfont->data->assoc_data (or maybe just remove the check on vfont->packedfile ?).

source/blender/blenlib/intern/freetypefont.c
504

Error, mismatch in signature with declaration of this func...

Sebastian Witt (witt) edited edge metadata.

I tried to address all the problems with the old revision.
Mainly possible packedfile data leaks and "BLI_vfontdata_freeft2" function definition.

If I can improve the code style in any way, I am happy and open for every critique/tips!
Kind regards
Sebastian Witt

Sebastian Witt (witt) marked 2 inline comments as done.Nov 4 2016, 4:38 PM
Sebastian Witt (witt) added inline comments.
source/blender/blenkernel/intern/font.c
271–275

You are right, I removed that due to the pf still containing the fontdata and which gets deleted if freed at this point. I am handling the pf memory later on when the vfont is removed. In case vfont is Null it still needs to be freed. Like you've said removing only vfont->packedfile should do the trick!

@Bastien Montagne (mont29), late reply. I can't think of anything wrong here. Think it's a useful feature.

source/blender/blenlib/BLI_vfontdata.h
47

Could it be called something less generic?

ogierm added a subscriber: ogierm.Sep 21 2020, 11:37 PM

Hey, I am working on a bachelor thesis - using Blender plugin to create a 3D presentation. I tried to use your code to fix the kerning, beceuase it is obviously important for a presentation, but I don't seem be able to make it work...
I'm using Blender 2.93.0, when I tried to compile it after the changes, in the file font.c the compiler couldnt find the function freePackedFile(vfont->data->assoc_data), so I used BKE_packedfile_free(vfont->data->assoc_data) and the compilation went fine, but the kerning was still not supported after runnig the compiled version.
Do you have any tips on how to make it work? Or do you have any info, if automatic kerning support will be added to Blender any time soon? Or perhaps do you have a binary, where the kerning is supported?
Thanks for any tips or comments :)

I'm a user and not a developer. This has been bugging me for years.
I don't believe anyone who is serious about typography could be without this feature.

Would this also work with the "String to Curves" geometry node?