If you don't need to do this from C necessarily, check out ftCLI: https://github.com/ftCLI/FoundryTools-CLI
Or "fonttools ttLib --help" from fonttools: https://github.com/fonttools/fonttools behdad http://behdad.org/ On Mon, Oct 23, 2023 at 6:44 AM Francesco Pretto <cez...@gmail.com> wrote: > Hello, > > I recently had to extract a TrueType font from a TTC font collection > as part of fixing bugs in the podofo library[1]. Since I couldn't find > an API suited for the task, I found myself in need to manually parse > the TTC Header, which is not a type exposed in the FreeType public > API. I believe FreeType could have helped me much better if, for > example, it would have provided a way to extract the actual face Table > Directory[2] from the font data. For example, a special tag TTAG_tdir > could be defined to access the raw Table Directory data with > FT_Load_Sfnt_Table, like the following: > > FT_ULong size = 0; > FT_Load_Sfnt_Table(face, TTAG_tdir, 0, NULL, &size); > > Interestingly enough, Windows GetFontData[3] seems to do something > similar (but with inverted semantics) when using the special table > "0", while to access whole file in case of collections it uses the > special ttcf "table tag". > > Since I already crafted my own solution, I'm not in a rush for > improvements in FreeType, but it could be something good to have in a > future release. > > Regards, > Francesco > > [1] > https://github.com/podofo/podofo/blob/df36740b176fa535a8dc6dfc5a1b940f84710aa8/src/podofo/private/FreetypePrivate.cpp#L177 > [2] > https://learn.microsoft.com/en-us/typography/opentype/spec/otff#table-directory > [3] > https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getfontdata > >