Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Vertical Text Layout For Qt

Vertical Text Layout For Qt

A Project Fair slides about experimental CJK vertical text layout support for the Qt framework.

Jiang Jiang

April 15, 2011
Tweet

More Decks by Jiang Jiang

Other Decks in Technology

Transcript

  1. What’s this used for? CJK (Chinese, Japanese and Korean) publications

    commonly have vertical written forms: text flow from top to bottom, progress from right to left Mongolian is also written from top to bottom, but progress from left to right Still widely used in Japanese and Traditional Chinese • • •
  2. Why work on it now? CSS Writing Mode Level 3

    (http://www.w3.org/TR/css3-writing- modes/) defines new writing modes: horizontal-tb, vertical-rl and vertical-lr WebKit for Mac and Chrome already have implementations for this QDeclarativeText, etc. may want to have similar features • • •
  3. Targets Support for vertical text layout in low level text

    class: QTextLayout Add a new option to QTextOption: setTextOrientation(int orientation), orientation can be either Qt::Vertical or Qt::Horizontal May add text progression option later • • •
  4. Details For fonts that support vertical layout it’s pretty simple:

    just make sure we use the vertical font metrics and select proper OpenType GSUB/GPOS features for vertical layout (realigned punctuations, etc.) For “dumb” fonts it requires some other hacks Mixed scripts (latin text in vertical Chinese) need more care • • •
  5. Status Have working implementations on Mac/Core Text and X11/HarfBuzz. Should

    work on Windows and other HarfBuzz based systems as well. (Already a patch making use of this in QtWebKit) Line breaking support is still a little bit buggy. Relatively small amount of changes, planning to merge into master (Qt 5?) • • •