[HarfBuzz] how to detect missing glyphs e.g. for font substitition

Khaled Hosny khaledhosny at eglug.org
Mon May 11 12:35:49 PDT 2015


On Mon, May 11, 2015 at 07:56:19AM +0000, Louis Semprini wrote:
> Or, must Harfbuzz callers first do a complete, separate pass where
> they run all code points of the input through some kind of mapping
> routine that uses the fonts' 'cmap' and other tables?  The latter
> would be a shame because it would require the Harfbuzz caller to
> duplicate a vast amount of the complexity that is nicely hidden in
> Harfbuzz in their own code.  It's also a shame because in most cases,
> no font substitution would be needed and so it would be inefficient in
> the average case.

Some HarfBuzz users do that i.e. check the font’s cmap table to see what
characters it supports and selects fallback fonts for what it doesn’t
before even calling HarfBuzz. Others rely on HarfBuzz, for example in
LibreOffice the run is first shaped with the user selected font, then
any contiguous runs of missing glyphs are reshaped with fallback fonts,
this have also the advantage of letting HarfBuzz do its normalisation
which can result in the font supporting more characters than it declares
in its cmap table.

Regards,
Khaled


More information about the HarfBuzz mailing list