|
From: | Behdad Esfahbod |
Subject: | Re: [IDEA] Facilities to extract TT fonts from TTC font collections |
Date: | Mon, 23 Oct 2023 10:13:08 -0600 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |