[HarfBuzz] How to get hb_face_t and hb_font_t without Freetype?
jfkthame at gmail.com
Sat May 11 10:08:42 UTC 2019
On 11/05/2019 10:39, Eli Zaretskii wrote:
> Is it possible to create a hb_face_t without going through Freetype?
> If so, could someone please tell what that would entail?
You can use hb_face_create_for_tables, passing it a function that can
retrieve font tables (as hb_blobs) when requested by harfbuzz.
This is what Firefox does, to use harfbuzz with Windows or MacOS font
APIs; a starting point to explore the Firefox code would be , where
we call hb_face_create_for_tables and pass it HBGetTable as the
reference_table_func. This calls down to the GetFontTable() method,
which has separate implementations for the various platforms.
> The tutorial only shows how to create hb_font_t using Freetype, and I
> found no other documentation related to this, except the functions'
> signatures. The implementations of hb_ft_face_create and
> hb_ft_face_create look deceptively simple, so maybe it wouldn't be
> hard to implement something similar without going through Freetype.
> But the question is what is needed from the data stashed away by
> hb_blob_create, and where is that data used? I guess there are some
> callbacks specific to Freetype which the HarfBuzz shaper needs, and
> those callbacks need to access the blob data? But none of that seems
> to be documented.
> Could someone please post some information about these issues, or
> point me to existing documentation if I missed it?
> The context for these questions is WIP to add a HarfBuzz shaping
> capabilities to Emacs on MS-Windows. The existing HarfBuzz
> integration, for Posix platforms, uses Freetype, because Freetype is
> already used by Emacs on Posix systems to access font capabilities.
> But on Windows Emacs uses native Windows interfaces to access and
> utilize font and text metrics data, so going through Freetype would
> probably add interfaces whose equivalents already exist. The question
> is how to use those equivalents to give HarfBuzz what it needs.
> HarfBuzz mailing list
> HarfBuzz at lists.freedesktop.org
More information about the HarfBuzz