Interest in integrating with HarfBuzz shaper?

Nikolay Sivov nsivov at codeweavers.com
Mon Jun 27 14:17:15 CDT 2022


On 6/24/22 20:29, Behdad Esfahbod wrote:
> Hi,
>
> I've been looking at the internal Wine implementation of usp10.dll, and
> wondering if there is an interest to integrate with HarfBuzz instead /
> optionally.

Hi, Behdad.

Uniscribe implementation hasn't been touched in a while. DirectWrite 
implementation currently supports all types of GSUB/GPOS lookups, uses 
structure and code taken from harfbuzz wrt to feature masks, loop 
organization, sorting, etc. Currently it only implements Arabic shaping.

My longer term plan was to move all that to a separate textshaping.dll 
that modern Windows releases are using, and link to it from both gdi32 
and dwrite, after removing existing uniscribe code. We don't need 
textshaping.dll interface to be compatible with Windows, because it's 
undocumented and isn't used by applications directly.
>
> The main hindrance is that HarfBuzz does NOT currently provide separate
> substitution vs positioning steps ala ScriptShape() and ScriptPosition().
> But I've been thinking about how to make that possibly happen, at least
> enough for Wine's needs.

Yes, I believe we talked about that some time (few years?) ago. 
Uniscribe's ScriptShape() and dwrite's GetGlyphs() are using very 
similar interface, and we'll need DWRITE_SHAPING_TEXT_PROPERTIES and 
DWRITE_SHAPING_GLYPH_PROPERTIES to be compatible with what Windows returns.

When I was working on this I found what some of the "reserved" fields 
mean in SHAPING_GLYPH_PROPERTIES, you can find structure definition in 
dlls/dwrite/dwrite_private.h:struct shaping_glyph_properties. I'm 
talking about last two fields "components" and "lig_component", that are 
important for GPOS handling.

Another field that harfbuzz does not provide I think is 
"DWRITE_SHAPING_GLYPH_PROPERTIES.justification" mask, which I believe is 
only useful for Arabic shaping, and roughly corresponds to character 
classes.

So technically, if we get correct ScriptShape()-style output from 
harfbuzz, including correct clustermap in WCHAR terms, we don't really 
need harfbuzz to produce ScriptPosition() output, because we have that 
implemented, and afaik it does not require script-specific handling, 
except maybe for features that have to be enabled.

Another consideration is that we'll likely have to import harfbuzz code, 
and build it as a static win32 library. That's not a decision I can 
make. I think the only build requirement would be a recent enough C++ 
compiler? And maybe ragel, at some point you had precompiled header in 
the tree. We'll have to ask Alexandre's opinion here.

We could also benefit from harfbuzz subsetter, and use it for fontsub 
and for Direct2D XPS printing.

>
> Regards,
>
> behdad
> http://behdad.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220627/6bc86279/attachment.htm>


More information about the wine-devel mailing list