[HarfBuzz] vertical text for indic script ( Devnagri )
Richard Wordingham
richard.wordingham at ntlworld.com
Fri Jul 17 10:58:50 UTC 2020
On Fri, 17 Jul 2020 12:55:40 +0530
Vishal Gautam <15vishal15 at gmail.com> wrote:
> Hi All ,
>
> After shaping and rendering latin and CJK script in TTB vertical
> direction using harfbuzz shaping , now i want to render devnagri
> script , where multiple glyphs , most of the time , form a cluster .
> If i send devnagari text via harfbuzz and set direction "TTB" then
> advances ( see the highlighted portion in output ) returned by
> harfbuzz for all glyphs in a cluster indicate that harfbuzz is
> shaping each glyph for standalone rendering and ignoring the fact
> that glyph could form a cluster with another .
Does your font contain vertical advance widths? I suspect you're
seeing HarfBuzz default. For some styles, I think one would not want
vertical monospace.
> See the output of devnagri script codepoints in TTB direction .
> Input command :
>
> ./hb-shape --font-file="/Users/vgautam/Downloads/DevanagariMT.ttc"
> --unicodes="हिंदी
> टायपिंग"
> --direction=ttb --show-unicode --no-glyph-names
>
>
> Output Value :
>
>
> <U+0939,U+093F,U+0902,U+0926,U+0940,U+091F,U+093E,U+092F,U+092A,U+093F,U+0902,U+0917>
> [398=0 at -327,-2547+0,*-3293*|99=0 at -558,-2026+0,*-3293*|83=3 at -545,-2255+0,
> *-3293*|102=3 at -327,-2543+0,*-3293*|76=5 at -514,-2309+0,-3293|100=5@
> -327,-2252+0,-3293|91=7 at -599,-2252+0,-3293|398=8 at -327,-2547+0,-3293|86=8@
> -578,-2252+0,-3293|68=11 at -607,-2254+0,-3293]
Your font seems a little unusual. I don't see any non-spacing marks in
the positioning output, despite the presence of U+0902 in the input.
I tried hb-shape out on some Tai Tham fonts which don't have any
tables designed for vertical layout. Attached glyphs are staying
attached, even when GPOS assigns them non-zero advance widths.
Non-spacing marks are typically attached and spacing marks not, but
that is by no means universal.
> How should I shape indic text with harfbuzz for TTB direction .
> Should i shape devnagri as LTR text and then render cluster after
> cluster in vertical .
I suspect the ideal answer is to add vertical positioning tables to the
font. A work-around for their lack in your font is likely to be
unsatisfactory. There is not universal agreement on how to split
Devanagari into clusters - when do visible halants signal a cluster
boundary for vertical layout? I'm pretty sure that those before Nepali
case-endings do. In the mean time, your suggestion would usually work.
Richard.
More information about the HarfBuzz
mailing list