[HarfBuzz] Support for optical 'opdb' feature(s)

Khaled Hosny khaledhosny at eglug.org
Fri Mar 15 15:24:30 PDT 2013


Hi all,

I’m considering the possibility of adding support for ‘opbd’ feature in
XeTeX, and I have some questions.

The OpenType feature registry description¹ is a bit contradicting, but
my understanding is that ‘opbd’ is a merely user interface shorthand,
and the actual features are ‘ltbd’ and ‘rtbd’.

Given the nature of glyph protrusion and the way it is implemented in
XeTeX, those features can not simply be turned on during shaping, they
need to be applied separately after line breaking, also XeTeX needs to
query the protrusion values independent of the shaping process as they
can influence line breaking.

I have been thinking of ways to do this without requiring a dedicating
HarfBuzz API, something like creating a new buffer with the glyph I want
to gets its protrusion value (with a special get_glyph() function to
accept glyph ids instead of characters), applying ‘ltbd’ or ‘rtbd’ as
appropriate and measuring the difference x advance/offset of the shaped
glyph to the advance width stored in the font. But this is 1) too
complex 2) fragile since other features that are applied by default can
interfere.

So I’m asking if HarfBuzz can provide an API to retrieve optical bounds,
something like:

hb_ot_layout_get_glyph_optical_bounds (face, gid, side)
  if side == left:
     query ‘ltbd’
  else if side == right
     query ‘rtbd’


There aren’t any fonts with such features in the wild AFAIK, but I have
a modified version of TeX Gyre Pagella than I used to test this feature
in LuaTeX a while ago².

Regards,
Khaled

¹ http://www.microsoft.com/typography/otspec/features_ko.htm#opbd
² http://www.khaledhosny.org/files/tmp/TeXGyrePagella-Regular-opbd.otf



More information about the HarfBuzz mailing list