[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits

Khaled Hosny khaledhosny at eglug.org
Wed May 16 20:56:54 PDT 2012

On Wed, May 16, 2012 at 11:28:41PM -0400, Behdad Esfahbod wrote:
> On 05/16/2012 07:58 AM, Khaled Hosny wrote:
> > On Tue, May 15, 2012 at 08:54:24PM -0700, Behdad Esfahbod wrote:
> >>     [util] Add hb-ot-shape-closure tool
> >>     
> >>     Computes all the glyphs that may be generated given a font and
> >>     set of Unicode characters.
> > 
> > Cool!
> > 
> > I was thinking in a similar, but slightly different tool that would be
> > used to help subsetting fonts for small pieces of text, instead of
> > returning all possible glyphs, it returns to set of glyphs: final glyphs
> > that will be shown and any intermediate glyphs that were processed
> > during OT layout, so I keep the final glyphs and put some dummy outlines
> > in the intermediate ones and remove everything else. Not sure how easy
> > is that, but just in case.
> So, from what I understand, you only care about:
>   * Final glyphs, since they are to be displayed,


>   * Initial, cmap glyphs, since they have to be in the font for fontconfig etc
> to consider it supported.
> You don't really care about intermediate glyphs if they are going to be
> replaced.  Right?  I'm ignoring GPOS contour attachment points, etc here.

I need to keep the intermediate glyphs (even if just empty) for GSUB
substitution to work. What I’m thinking about is a font subset to
display very few words and I want to cut the glyphs to the absolute
minimum without breaking glyph substitution. Lets say I want to subset a
font to display the word “خالد”, I’ll need three kinds of glyphs:

  * cmap glyphs ← dummy contour for fontconfig etc.
  * intermediate glyphs: khah.init, alef.fina, etc ← empty glyph to keep
    GSUB layout working
  * final glyph: khah.init_preAlef, alef.fina_posKhah etc.

Without the intermediate glyphs the layout engine will not proceed to
the final glyphs. Of course the layout can be changed to alleviate the
need for them, but this will need a special subsetter, and I’m trying to
use existing ones.

Obtaining initial and final glyphs is easy with hb-shape, what is
missing is the intermediate ones.

> But I see where you are coming from.  I can add this one too.  It's a bit of a
> different design from what I have right now, but I can probably add it by
> adding a generic /observer/ pattern to the GSUB/GPOS machinery, which kinda
> would be useful otherwise too...

The current tool fits fine for general subsetting, which is pretty
useful (it arrived just in time actually, I need it to make language
subset of my fonts :), but I'm talking about optimising special subsets.


More information about the HarfBuzz mailing list