[luatex] Experimental Harfbuzz package
michal.h21 at gmail.com
Wed May 13 17:49:11 CEST 2015
I've tried to use Lua bindings for Harfbuzz text shaper, provided by
Sile , with LuaLaTeX. The Sile Harfbuzz bindings library provides
two functions, one loads a font to Harfbuzz, the second does actual
text shaping with selected font.
I used sample font loader from LuaTeX wiki  as the base. It seems
to work for both OpenType and classical TeX fonts, with little
modification. For OpenType fonts, immediately following glyph nodes
with the same font, language and attributes are collected in
pre_linebreak_filter callback, the text is processed with Harfbuzz,
table with characters is returned, new glyphs with properties of old
nodes are created and the old nodes are replaced with the new ones.
All node types other than glyph are leaved in the node list as they
This means that only separate parts of a word may be shaped, when it
contains whatsit node for example, which may result in missing
ligature or other features sometimes. Also, because only a word is
processed at any moment, this may not suffice for complex scripts like
Arabic, where it is important where line start ending play role in the
shaping (if I understand it correctly). In particular, my Arabic tests
seems to be OK with some fonts, but they seems to fail with Khaled
Hosny's Amiri for some reason.
The package for LuaLaTeX is located on Github , some sample files
show Latin, Devanagari, Cyrillic and Greek scripts . Note that
hyphenation of Greek and Russian seems to work using Babel. The other
example shows various Asian and Arabic scripts: .
The package is highly experimental and I am sure it has many
shortcomings, I listed some issues in the README, but at least it is a
proof of concept that Harfbuzz can be used with LuaTeX.
More information about the luatex