How do I balance script-oriented OpenType features with other OpenType features using DirectWrite?

前端 未结 2 1093
闹比i
闹比i 2021-02-06 03:08

Full disclosure: I\'m working on my libui GUI framework\'s text API. This wraps DirectWrite on Windows, Core Text on OS X, and Pango (which uses HarfBuzz for OpenType shaping) o

2条回答
  •  被撕碎了的回忆
    2021-02-06 03:53

    After some discussions with Peter Sikking and Ebrahim Byagowi, I went and debugged a more general-purpose program I built quickly to test things, and I figured out what's going on internally.

    First, however, I will say this applies to Uniscribe and DirectWrite equally.

    As it turns out, DirectWrite is always providing a set of default OpenType features, regardless of what feature set I use! The situation is that the list of default features provided differs depending on whether I load my own features or not, and depending on the shaping engine. For the latn script in horizontal writing mode and for English, this is done with the "generic engine".

    If I don't provide any features, the generic engine will load script-specific features. For horizontal latn, this list is

    locl
    ccmp
    rlig
    rclt
    calt
    liga
    clig
    

    If I do provide features, the generic engine will use the same default list for all scripts:

    locl
    ccmp
    rclt
    rlig
    mark
    mkmk
    dist
    

    So I don't know what to do about this. I could probably just provide liga and a few others myself in libui code (marked as a HACK of course), but this is still weird. I'm not sure what the motivation is either. Either way, this explains the behavior I'm seeing.

提交回复
热议问题