[HarfBuzz] Font substitution
Dominik Röttsches
drott at google.com
Tue Nov 17 17:41:55 PST 2015
Hi Simon,
On Thu, Nov 12, 2015 at 12:59 AM, Behdad Esfahbod
<behdad.esfahbod at gmail.com> wrote:
> On 15-11-12 12:19 AM, Simon Cozens wrote:
>> Can anyone point me at some sample code which allows performs font
>> substitution? I'm guessing the way to do this is to detect notdefs,
>> break the buffer around them and then try the notdef'd glyphs in another
>> font.
>> Has anyone got some fairly accessible code which does this already?
The main shaping loop in Chrome is here:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp&sq=package:chromium&l=549&rcl=1447771613
The first stage is run segmentation, which we do by
"needs-rotate-for-vertical?",
"needs-uppercasing-for-synthetic-smallcaps", and script in Chrome.
Once you have the segmented runs, we start shaping, and then extract
the results as you described above. One important aspect here is to
ideally perform fallback on a grapheme cluster basis. In Chrome, we
currently do that by using HarfBuzz' cluster values.
Dominik
More information about the HarfBuzz
mailing list