[HarfBuzz] How to get hb_face_t and hb_font_t without Freetype?
eliz at gnu.org
Wed May 29 15:15:40 UTC 2019
> Cc: behdad at behdad.org, harfbuzz at lists.freedesktop.org
> From: Jonathan Kew <jfkthame at gmail.com>
> Date: Sat, 11 May 2019 22:15:46 +0100
> > Would wrapping in a blob the buffer returned by GetFontData be enough?
> If you use GetFontData to get the complete font as a single buffer (i.e.
> pass zero for the dwTable parameter), yes.
> Alternatively, you could use hb_face_create_for_tables, with a
> reference_table_func that uses GetFontData to read individual tables
> when harfbuzz asks for them.
FTR, I found that using GetFontData to produce a blob that wraps the
entire data of a font does work, but is not really practical, except
in small test programs. If you have a program that occasionally needs
to load many fonts in order to display many different scripts at the
same time (Emacs basically does that all the time), you will likely
run out of memory, especially in 32-bit builds, because some fonts are
simply huge (I've seen fonts of several dozen MBs). A 32-bit build of
Emacs ran out of memory when displaying the HELLO file, which shows a
greeting in many different scripts.
So eventually, I went with the hb_face_create_for_tables method.
More information about the HarfBuzz