Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Font File Parser with GPos Kerning Table Support for rendering Glyphs

I am looking for a way to extract glyph bitmaps, glyph metrics and kerning data from font files (.ttf, .otf) with a support for GPos Kerning Tables.

I have used the FreeType Library before, but it does not support GPos Tables.

like image 371
stimulate Avatar asked Jul 05 '17 17:07

stimulate


1 Answers

I solved this by using HarfBuzz. This 'hello harfbuzz' sample shows how to initialize the library setting it up with a FreeType font. To extract kerning data, I created and shaped a buffer for each combination of letters I supported ('AA', 'AB', etc) and used the positioning data from hb_buffer_get_glyph_positions to infer the kerning offsets by comparing it to the advance values from FreeType.

like image 124
Columbo Avatar answered Oct 09 '22 00:10

Columbo