[luatex] font problem

Khaled Hosny khaledhosny at eglug.org
Tue Mar 27 16:45:58 CEST 2012


On Tue, Mar 27, 2012 at 03:44:40PM +0200, Herbert Voss wrote:
> With xelatex both values for 1ex are the same, but
> with lualatex I get  (10.67352pt) versus (3.43344pt)
> The reason why the sans serif \LaTeX is not correct.
> This happens only for LinBiolinum_R.otf and I do not
> know why.
> 
> \documentclass{article}
> \usepackage{fontspec}
> \setmainfont{Linux Libertine O}
> \setsansfont{Linux Biolinum O}
> \newdimen\EX
> \begin{document}
> \Huge
> \LaTeX (\EX=1ex \the\EX)
> 
> \sffamily
> \LaTeX (\EX=1ex \the\EX)
> 
> \end{document}

The font is broken (I sympathize with the developers since it is actually
a bug in FontForge that affects only some fonts, I had to post-process
one of the fonts I work on to fix a similar bug), but fortunately it can
be solved with LuaTeX. Adding the following lines just after loading
fontspec should do the trick:

\directlua {
local function fix_biolinum_xheight(fontdata)
  if fontdata.fullname:find("Linux Biolinum") then
    if fontdata.characters[string.byte("x")] then
      fontdata.parameters.x_height = fontdata.characters[string.byte("x")].height
    end
  end
end

luatexbase.add_to_callback("luaotfload.patch_font", fix_biolinum_xheight, "mypatch.fix_biolinum_xheight")
}

Regards,
 Khaled


More information about the luatex mailing list