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

Khaled Hosny khaledhosny at eglug.org
Tue May 12 03:52:47 PDT 2015


On Mon, May 11, 2015 at 08:49:48PM +0000, Louis Semprini wrote:
> 
> 
> > Date: Mon, 11 May 2015 21:35:49 +0200
> > From: khaledhosny at eglug.org
> > To: lsemprini at hotmail.com
> > CC: harfbuzz at lists.freedesktop.org
> > Subject: Re: [HarfBuzz] how to detect missing glyphs e.g. for font substitition
> > 
> > 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.
> 
> That's good to know, but for the second group of users, how do they
> detect the missing glyphs?  By looking for glyph index 0?

Yes (but as Konstantin said, it depends on what your font functions
return for missing glyphs).

Regards,
Khaled


More information about the HarfBuzz mailing list