3

I am currently trying the new HarfBuzz renderer in TeXLive 2020 (using LuaHBTeX v. 1.12.0) with the STIX2 set of (serif/math) fonts.

Rendering seems alright with my main font (and I can confirm mode=harf is used in the log file).

But rendering of math font is buggy: superscripts and fraction bars are either absent or misplaced.

Is this a known current limitation of the Harfbuzz renderer?


Edit

As per the comment just below, the HarfBuzz renderer is simply not supported for math because the math layout is always done by the engine itself and HarfBuzz doesn't seem to provide math parameters anyway (see https://github.com/latex3/luaotfload/issues/141#issuecomment-609932891).

Harfbuzz does not seem to have anything to do with math layout (see description) though it might be able to provide layout information for OpenType fonts (but it might be very limited): https://harfbuzz.github.io/harfbuzz-hb-ot-math.html

3
3

Short version

In LuaLaTex, the HarfBuzz renderer is not and probably will not be supported for math fonts. Just use theBase mode instead.

Long version

As documented in the page you link in your question:

HarfBuzz itself does not implement a math layout solution. The functions and types provided can be used by client programs to access the font data necessary for typesetting OpenType Math layout.

So the only thing we could do using HarfBuzz would be to extract some math parameters from the font file. Given that the same parameters are already extracted by the current base and node fontloaders there is no need to use HarfBuzz here.

Also there is a special problem we would have with using these values: For "MathKern"s (special kerning values for subscripts and superscript) there is a table in an OpenType font such that for every height, one value can be selected based on a simple algorithm. This lookup is implemented in LuaTeX, so we just have to provide the raw table from the font to LuaTeX. This isn't really available in HarfBuzz because HarfBuzz too is implementing the lookup algorithm instead of providing the raw table. Therefore HarfBuzz does provide all data necessary for math layout, but it does too much interpretation to be useable in LuaTeX. If we would still try to use it, we would have to parse the raw OpenType file from Lua which would just reimplement parts of the base fontloader.

(Also there is a smaller issue that the math OpenType functions are not exposed by the Lua wrapper, so we would need to extend that first in order to use HarfBuzz here.)

So altogether, we can't implement math fonts using HarfBuzz easily and there is no reason to invest more work into this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.