Like others, I had problems with the kerning data of my fonts being empty in msdf-atlas-gen (see #4 #43 #105). This is how I solved it, and what others can do to fix it.
The issue happens because FreeType only loads the kerning data from the gpos table if the build option TT_CONFIG_OPTION_GPOS_KERNING is defined in FreeType’s configuration file: include/freetype/config/ftoption.h. To solve the problem you need to uncomment this option and then build freetype.
The question then is how to modify FreeType and feed it to msdf-atlas-gen.
If you are building msdf-atlas-gen with vcpkg, i think the best option is to create an overlay port of FreeType and apply a diff patch there.
This feels finicky as it requires several manual steps by the user of the library. Maybe someone with a deeper knowledge of vcpkg can correct me.
- Solution using CMake and add_subdirectory
You can clone the FreeType repo, modify it, and then add to your CMakeLists.txt before msdf-atlas-gen.
In my case, I do it in a bash script (simplified example):
#!/bin/bash
git clone https://github.com/freetype/freetype
sed -i 's|/\* #define TT_CONFIG_OPTION_GPOS_KERNING \*/|#define TT_CONFIG_OPTION_GPOS_KERNING|' ./freetype/include/freetype/config/ftoption.h
Then I add freetype normally to CMake. Note I needed to add an alias so msdf-atlas-gen can properly find FreeType.
add_subdirectory(vendor/freetype)
add_library(Freetype::Freetype ALIAS freetype)
add_subdirectory(vendor/msdf-atlas-gen)
While I don’t have a direct suggestion for integrating this fix into msdf-atlas-gen itself, I hope this information will be useful for users who are experiencing similar issues.
Like others, I had problems with the kerning data of my fonts being empty in msdf-atlas-gen (see #4 #43 #105). This is how I solved it, and what others can do to fix it.
The issue happens because FreeType only loads the kerning data from the
gpostable if the build optionTT_CONFIG_OPTION_GPOS_KERNINGis defined in FreeType’s configuration file: include/freetype/config/ftoption.h. To solve the problem you need to uncomment this option and then build freetype.The question then is how to modify FreeType and feed it to msdf-atlas-gen.
If you are building msdf-atlas-gen with vcpkg, i think the best option is to create an overlay port of FreeType and apply a diff patch there.
This feels finicky as it requires several manual steps by the user of the library. Maybe someone with a deeper knowledge of vcpkg can correct me.
You can clone the FreeType repo, modify it, and then add to your CMakeLists.txt before msdf-atlas-gen.
In my case, I do it in a bash script (simplified example):
Then I add freetype normally to CMake. Note I needed to add an alias so msdf-atlas-gen can properly find FreeType.
While I don’t have a direct suggestion for integrating this fix into msdf-atlas-gen itself, I hope this information will be useful for users who are experiencing similar issues.