[HarfBuzz] Better handling variation selectors

Jonathan Kew jfkthame at googlemail.com
Fri Jun 14 01:28:01 PDT 2013

On 14/6/13 00:06, Behdad Esfahbod wrote:> Some progress, but there's 
more to do.  From the commit I just pushed out:
 > commit 79d1007a501fd63c0ba4d51038c513e6b8b94740
 > Author: Behdad Esfahbod <behdad at behdad.org>
 > Date:   Thu Jun 13 19:01:07 2013 -0400
 >      If variation selector is not consumed by cmap, pass it on to GSUB
 >      This changes the semantics of get_glyph() callback and expect that
 >      callbacks return false if the requested variant is not 
available, and
 >      then we will call them back with variation_selector=0 and will 
 >      the glyph for the selector in the glyph stream.
 >      Apparently most Mongolian fonts implement the Mongolian Variation
 >      Selectors using GSUB, not cmap.
 >      https://bugs.freedesktop.org/show_bug.cgi?id=65258
 >      Note that this doesn't fix the Mongolian shaping yet, because 
the way
 >      that's implemented is that the, say, 'init' feature ligates the 
 >      and the variation-selector.  However, since currently the variation
 >      selector doesn't have the 'init' mask on, it will not be matched...
 > I'm not quite sure how to address this.  Previously we only used to 
match the
 > feature mask on the first glyph in a ligature / sequence.  We changed 
that two
 > hackfests ago.

Seems like it should be possible to handle this in the Arabic shaper. 
Give variation selectors a new type JOINING_TYPE_VS. In 
arabic_joining(), they'll be treated like JOINING_TYPE_T, except that 
they record a new action INHERIT instead of NONE. Then when 
setup_masks_arabic() is setting the masks, it can check for INHERIT and 
copy the mask of the preceding glyph.

(No, I haven't actually coded/tested this.)


More information about the HarfBuzz mailing list