Fwd: Drawing vertical text glyphs

Mark Hung marklh9 at gmail.com
Mon May 3 00:56:50 UTC 2021

Hi Lubos,

I investigate a little bit more in last few days.

Since Libreoffice unified all the text layout to use Harfbuzz, it would be
best to achieve the result consistent with output generated from Harfbuzz
utilities. Binaries can be downloaded from [1]. Here are some examples I
use to verify:

./hb-view -O png -o ~/output.png \
--shapers=ot,fallback \
--direction ttb \
--font-funcs=ot \
~/下載/kaiu.ttf "「風調,雨順」"

./hb-shape -O text \
--shapers=ot,fallback \
--direction ttb \
--font-funcs=ot \
~/下載/kaiu.ttf "「風調,雨順」"

You can check if it is a text renderer's problem this way when something
goes wrong.
Note that LibreOffice use default font function implementation from
Harfbuzz (opentype, --font-funcs=ot ), while the utility use  Freetype
library ( --font-funcs=ft ) by default. I find that an
important Windows built-in font (Kaiu.ttf) doesn't work well with Harfbuzz
ot font functions.

Skia text renderer works with [2], but it means that other text renderers
are broken.
Since Harfbuzz utilities also use Cairo, I believe we must be able to
achieve consistent results
at least with Cairo.  My fix there seems to work[3].

For Windows, I think it's not possible to make old ExTextOutW API correct
for vertical writing. It is possible to use DWriteTextRenderer for vertical
writing[4][5]. There are still some clipping issues, though.

I don't have a Mac so someone needs to fix that if it's broken.


Mark Hung
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20210503/dcb11609/attachment.htm>

More information about the LibreOffice mailing list