[HarfBuzz] Unicode ignorables treatment

Nikolay Sivov bunglehead at gmail.com
Mon Aug 24 02:52:09 PDT 2015


A little update to this. With Win10 release naturally I tried to run our 
dwrite/usp10 tests on it, and as it usually happens with new major 
release got some new failures - we're using Tahoma font for those tests 
for Latin strings (mainly because it exists on all windows version we 
care about, and wine provides it too). So what happened is that Tahoma 
was updated to include glyphs for control codes like 0x202B and 0x202C, 
those glyphs appear to be spaces with 0 widths.

According to my test fix [1] uniscribe calls ScriptGetCMap and 
ScriptShapeOpenType return exactly what font provides for those 
codepoints, no substitution to regular space codepoint is done. 
DirectWrite follows that pattern too, for reference [2].

Now reasonable question is how it works in DirectWrite case - it depends 
on what API layer you use. If you're using only shaper part 
(IDWriteTextAnalyzer) then it doesn't do anything about those codepoints 
- GetGlyphs() returns nominal glyphs from font, if not present .notdef 
index 0 is returned, GetGlyphPlacements() returns advances as they are 
specified in a font, meaning they are not forced to zero. However if 
high level API IDWriteTextLayout is used to get cluster metrics for such 
string you'll see that 'width' field in cluster metrics structure is set 
to 0.0; any high level client application that wants to simply draw some 
text is supposed to go through dwrite layout API (that in turn uses 
analyzer part to shape), so lower level details are hidden. And now with 
font updates (I haven't check but it's possible Tahoma is not the only 
one to get these new glyphs), this issue is buried until you use shaper 
API and some non-MS font.

I don't think there's anything wrong in a way HB does that, but if 
compatibility is important maybe some runtime option to disable 
overrides is worth considering (option being off by default of course).

[1] https://www.winehq.org/pipermail/wine-patches/2015-August/141805.html

[2] https://www.winehq.org/pipermail/wine-patches/2015-August/141762.html


More information about the HarfBuzz mailing list