[Dev-luatex] HarfBuzz [slightly off-topic]
khaledhosny at eglug.org
Thu Feb 3 15:51:27 CET 2011
On Tue, Feb 01, 2011 at 07:21:44PM +0000, Graham Douglas wrote:
> Hi to all
> Apologies in advance for the slightly off-topic nature of this
> post. I've been reading about HarfBuzz which certainly looks to
> be an interesting project. From the project page there is a link
> to an article titled "State of Text Rendering" by Behdad Esfahbod
> Within that article is a section on TeX engines with a reference to
> XeTeX and LuaTeX --- I'm just quoting a small bit of the article which
> I hope is not too much out of context:
> "The XeTeX creator is working on HarfBuzz on behalf of Mozilla now,
> and plans to port XeTeX to HarfBuzz eventually. In the long term
> though, pdfTeX's successor luaTeX should be made to do the same
> thing. There is more to Unicode support than just shaping, and in
> those areas the TeX engines can gain a lot by building on top of
> existing libraries."
> At present my own understanding of the precise role that HarfBuzz could
> play is a little sketch/hazy right now, but I'm working on that ;-).
> In the meantime I'd be interested to know if, in theory, HarfBuzz
> could be
> usefully plugged into LuaTeX, such as via an external library
> (.so/.dll).From what I understand... HarfBuzz provides a shaping
> so that, for example, it could provide useful services such as the
> bidi algorithm, and information that could be useful for typesetting
> scripts such as Arabic. Again, I stress my currently incomplete
> understanding of the precise services HarfBuzz would provide. lso,
> how would you pass back to LuaTeX the results so that the LuaTeX engine
> could use them?
> If anyone could help me understand this a little more or indeed let
> me know if there really is nothing to explore that too would be
> good. I have not tried to compile HarfBuzz yet so have not played
> with it at all. I'm merely curious in light of the remarks on the
> HarfBuzz site.
> Thank to anyone who can shed some light on this for me.
HarfBuzz provide an OpenType layout engine (Graphite support existed at
some point, but were removed to be rewritten, AAT is planned in some
distant future) but no bidi (the client have to do it in its own or use
other libraries like fribidi).
HarfBuzz workflow is usually 1) loading a font in FreeType 2) shaping
text in HarfBuzz for that font 3) getting back glyph indices and
positions. Of course there are more details like itemizing the text,
selecting font features and so on.
FreeType is not mandatory, but using it simplifies the process.
Hans have written (and still improving) an OpenType layout engine
completely in lua(tex) and it more or less does what HarfBuzz would do,
it may support more features than HarfBuzz but HarfBuzz code is more
widely tested, so each have its pros and cons.
I can imagine a separate module where HarfBuzz is plugged into LuaTeX
allowing it to process node lists instead of text strings (HarfBuzz have
callbacks that I think can be used to plug function that deal with node
buffers instead of text strings), it can be an interesting exercise and
I expect HarfBuzz maintainer to be willing to cooperate.
More information about the dev-luatex