manpagez: man pages & more
html files: harfbuzz
Home | html | info | man

Shaper selection

The basic version of hb_shape() determines its shaping strategy based on examining the capabilities of the font file. OpenType font tables cause HarfBuzz to try the ot shaper, while AAT font tables cause HarfBuzz to try the aat shaper.

In the real world, however, a font might include some unusual mix of tables, or one of the tables might simply be broken for the script you need to shape. So, sometimes, you might not want to rely on HarfBuzz's process for deciding what to do, and just tell hb_shape() what you want it to try.

hb_shape_full() is an alternate shaping function that lets you supply a list of shapers for HarfBuzz to try, in order, when shaping your buffer. For example, if you have determined that HarfBuzz's attempts to work around broken tables gives you better results than the AAT shaper itself does, you might move the AAT shaper to the end of your list of preferences and call hb_shape_full()

      char *shaperprefs[3] = {"ot", "default", "aat"};
      hb_shape_full(font, buf, userfeatures, num_features, shaperprefs);

to get results you are happier with.

You may also want to call hb_shape_list_shapers() to get a list of the shapers that were built at compile time in your copy of HarfBuzz.

© 2000-2021
Individual documents may contain additional copyright information.