Skip to content

[truetype] Add support for kerning from GPOS tables

David Saltzman requested to merge davidbsaltzman/freetype:master into master

This commit adds support for kerning from GPOS tables, while maintaining support for basic kern tables. FT_HAS_KERNING will be true for a font with either available and FT_Get_Kerning will still use the basic kern table data if avilable, otherwise check the GPOS kern feature.

This feature is disabled by default; it can be enabled with the TT_CONFIG_OPTION_GPOS_KERNING flag.

Only basic kerning (pair positioning with just an x advance) is supported from the GPOS layout features; support for that was added to make the existing FT_Get_Kerning API more consistently functional. FreeType does not intend to extend itself to further GPOS functionality though; a higher-level library like HarfBuzz can be used instead for that.

  • include/freetype/config/ftoption.h: add TT_CONFIG_OPTION_GPOS_KERNING
  • include/freetype/freetype.h: remove comments about unavailable GPOS kerning
  • include/freetype/internal/fttrace.h: add ttgpos trace handler
  • include/freetype/internal/sfnt.h: add load_gpos and get_gpos_kerning
  • include/freetype/internal/tttypes.h: add gpos font data entries
  • src/sfnt/sfdriver.c: add load_gpos and get_gpos_kerning
  • src/sfnt/sfnt.c: compile ttgpos.c
  • src/sfnt/sfobjs.c: load and free tt_gpos; check tt_gpos kerning availability
  • src/truetype/ttgpos.c: add file to implement GPOS pair kerning
  • src/sfnt/ttgpos.h: add header for access to tt_gpos functionality
  • src/truetype/ttdriver.c: get kerning from tt_gpos when there's no kern table
Edited by David Saltzman

Merge request reports