[HarfBuzz] 'vert' substitutions in CJK fonts

Grigori Goronzy greg at chown.ath.cx
Fri Feb 8 02:02:16 PST 2013


On 02/06/2013 09:50 PM, Behdad Esfahbod wrote:
> Grigori, welcome to the darker sides of text rendering :).
>
> This is what Pango does, and what eventually I want to make easier doing with
> HarfBuzz:
>
> [...]
> This is really useful.  For example, by default when Pango sees text in Arabic
> script, it behaves as if it's in Arabic language.  But if I set LANGUAGE=en,fa
> in my system, then Pango will attribute untagged Arabic script text to Persian
> instead of Arabic language.
>

Thanks for the great and detailed explanation.

> The other problem you point it is also handled by resolving
> Script=Common/Inherited characters to their neighboring scripts.  So in this
> case, even the punctuation will be marked 'kana'.
>

Yeah, I still need to implement this, but it shouldn't be too hard.

> That said, it is a known shortcoming of OpenType, that a lone punctuation
> character cannot hit any script tables other than DFLT...
>

Additionally, in Japanese punctuation characters are often only 
surrounded by Kanji (Han) characters - these aren't part of the kana 
script and can't even be mapped to a specific language (because they're 
used in various languages). :(

>> And lastly, can I force HarfBuzz to just
>> use the first 'vert' substitution lookup in case there's none to be
>> found with matching or DFLT script/language system?
>
> Not really / easily.  You can use the hb-ot.h API to detect that, and find the
> OT LangSys tag that *does* have the substitution, then use
> hb_ot_tag_to_language() to get a language tag that when passed back to
> HarfBuzz, will choose that substitution.
>

That might be good enough (for the "vert" feature), I'll take a look at it.

Best regards
Grigori




More information about the HarfBuzz mailing list