3

I have an issue in combination with the fontspec package and a ttf/otf font I am developing:

Kerning works fine in XeLaTeX (and e.g. in browsers etc.), but kerning is only partially applied in LuaLaTeX.

In accordance with option 3 in the first reply to How to report a bug in LuaTeX? I am reporting the LuaLaTeX issue here.

(According to Why does kerning work with LuaLaTex but not XeLaTex for the same font? kerning in LuaLaTeX is done completely differently than in XeLaTeX, so I am presuming the issue is not related to the fontspec package at all, nor to XeLaTeX.)

Details:

The font I am developing is based on some glyphs from Fredrick Brennan's monospaced hyperrealistic "TT2020" font, see https://ctrlcctrlv.github.io/TT2020/docs/moreinfo2.html

The trick in "TT2020" is that a GSUB table defines 9 slightly different glyphs for every type to emulate natural variations (e.g. glyphs named "a", "a.2", ..., "a.9").

TT2020 works well for me with TeXLive 2021 in both XeLaTeX and LuaLaTeX, characters are correctly rotated through the 9 glyphs.

The font I am developing in addition defines kerning between glyphs in a GPOS table (and a kern table), and works fine in fairly recent web browsers, on the Mac, as well as with TeXLive 2021 in XeLaTeX. But with TeXLive 2021 in LuaLaTeX kerning only works in some cases.

Here is a test document:

\documentclass{article}

% Commented out after comment by Davis Carlisle below
%\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{fontspec}

\begin{document}

% Replaced after comment by Marcel Krüger further below
\setmainfont{Jackwriter.ttf}
%\setmainfont{Jackwriter}[UprightFont=[Jackwriter.ttf]]
\lipsum[1]

xxxxxxxxxxxxxxxxxx

iiiiiiiiiiiiiiiiii

\end{document}

The referenced font is here:

The above source rendered:

The missing kerning in the LuaLaTeX output is maybe most obvious in the last line with the many "iiiiiii"s. (Since the font is based on a typewriter font, missing kerning does not show between all letters anyways. Note also that so far I only defined kerning between all lowercase glyphs but only partially for most other glyphs.)

Versions used according to console output:

  • XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021) (preloaded format=xelatex)
  • LuaHBTeX, Version 1.13.0 (TeX Live 2021)
  • LaTeX2e <2020-10-01> patch level 4
  • L3 programming layer <2021-02-18>

Mac OS Catalina: 10.15.7 (19H524)

5
  • 1
    never use \usepackage[T1]{fontenc} in a luatex/xetex document, that is forcing 8bit fonts (fortunately you have it before fontspec so it is over-ridden and does nothing) Apr 17 at 9:48
  • if it works in xetex your font probably works in lualatex in harf mode Apr 17 at 9:50
  • Welcome to TeX–LaTeX Stack Exchange!
    – Thérèse
    Apr 17 at 13:34
  • Can you give a hint, how to get TT2020 working with texlive 2021?
    – Keks Dose
    Apr 17 at 21:32
  • 1
    This works for me: ``` % !TEX TS-program = xelatex \documentclass{article} \usepackage{fontspec} \begin{document} \setmonofont{TT2020StyleE-Regular.ttf} \Huge\texttt{QBEEKEEPINBEEKEEPIN} \end{document} ``` (With the *.ttf in the same directory as the *.tex.)
    – Artecat
    Apr 18 at 5:16
3

It works in harf mode with lualatex

enter image description here

\documentclass{article}
\usepackage{lipsum}

\usepackage{fontspec}

\begin{document}

\setmainfont[Renderer=HarfBuzz]{Jackwriter.ttf}
\lipsum[1]

xxxxxxxxxxxxxxxxxx

iiiiiiiiiiiiiiiiii

\end{document}

You could raise an issue at luaotfload to see if this could be supported in the default mode as well.

3
  • Works also for me. Strange, though, that ` \setmainfont{Jackwriter}[Renderer=HarfBuzz,UprightFont=[Jackwriter.ttf]]` does not work, but possibly that is defined as something else...
    – Artecat
    Apr 17 at 10:06
  • @Artecat UprightFont=[Jackwriter.ttf] is a syntax error (UprightFont=Jackwriter.ttf should work though) which gets turned into something even weirder by fontspec. The resulting thing fails to parse in luaotfload, but luaotfload is quite tolerant when it comes to incorrect font specifications and just ignores everything after the first error, including the request to use HarfBuzz. Apr 17 at 10:13
  • I have submitted an issue at luaotfload as suggested: github.com/latex3/luaotfload/issues/182
    – Artecat
    Apr 17 at 11:44

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.