4

LuaHBTeX has different handling of missing thin space glyph in fonts from previous luatex or xetex versions.

\documentclass[margin=5pt]{standalone}
\usepackage{fontspec}
\setmainfont{Courgette Regular}
\begin{document}
foo bar\,bazμ 
\end{document}

There is a thin space (U+202F) between foo and bar, and the font is missing glyphs for this and for the mu character.

Rendering in HBTeX (version 1.12.0 from Debian's TeX Live, with luaotfload version 2020-02-02 3.12):

enter image description here

Rendering in xelatex:

enter image description here

It seems that some special handling of missing whitespace characters has been removed, which may be surprising to users.

5
  • No nothing has been removed. Previously missing chars were simply ignored, now they insert a notdef glyph. You can revert to the old behaviour with [RawFeature={notdef=false}] Apr 15, 2020 at 9:15
  • Also adding [Renderer=HarfBuzz] to \setmainfont generates the same output you got with XeTeX. Apr 15, 2020 at 9:19
  • @UlrikeFischer: it seems to me that there was some special handling of this thin space character, because the missing mu glyph was rendered differently from the missing U+202F glyph. With notdef=false, both the cross glyphs disappear whereas with older version, only the thin space disappeared. Apr 15, 2020 at 9:39
  • @EricMarsden If I try your example with TeXLive 2019, I get the same behavour as TeXLive 2020. In TeXLive 2018, I get the same output as with notdef=false. I would be very surprised if any non-HarfBuzz version of luaotfload gave the same as the XeTeX version. Apr 15, 2020 at 9:53
  • My memory must be incorrect concerning the behaviour of older luatex versions, my apologies; I have updated the question. So it seems to be xetex and the HarfBuzz renderer that have some special handling of this missing U+202F glyph. Apr 15, 2020 at 10:22

1 Answer 1

5

The missing characters just used to be ignored (with warning in the log file).

You can make adjustments for them, so they appear as themselves if the font has the glyphs, or provide a substitution.

\documentclass{article}

\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Libertinus Serif}

\newcommand{\substitutechar}[2]{% #1 = character, #2 = substitution
  \newunicodechar{#1}{\iffontchar\font`#1 #1\else#2\fi}%
}

\substitutechar{^^^^202f}{\,}
\substitutechar{μ}{\ensuremath{\mu}}

\pagestyle{empty}

\begin{document}

foo bar\,bazμ

\showoutput

\end{document}

If I compile the example, I get

....\TU/LibertinusSerif(0)/m/n/10 f
....\TU/LibertinusSerif(0)/m/n/10 o
....\kern0.07 (font)
....\TU/LibertinusSerif(0)/m/n/10 o
....\TU/LibertinusSerif(0)/m/n/10
....\TU/LibertinusSerif(0)/m/n/10 b
....\TU/LibertinusSerif(0)/m/n/10 a
....\TU/LibertinusSerif(0)/m/n/10 r
....\kern1.66672
....\TU/LibertinusSerif(0)/m/n/10 b
....\TU/LibertinusSerif(0)/m/n/10 a
....\TU/LibertinusSerif(0)/m/n/10 z
....\TU/LibertinusSerif(0)/m/n/10 μ

If I remove the \setmainfont line, the font will be Latin Modern Roman that, like your Courgette font, lacks both U+202F and U+03BC, I get

....\TU/lmr/m/n/10 f
....\TU/lmr/m/n/10 o
....\kern0.28 (font)
....\TU/lmr/m/n/10 o
....\kern1.66672
....\TU/lmr/m/n/10 b
....\TU/lmr/m/n/10 a
....\TU/lmr/m/n/10 r
....\kern1.66672
....\TU/lmr/m/n/10 b
....\TU/lmr/m/n/10 a
....\TU/lmr/m/n/10 z
....\mathon
....\OML/cmm/m/it/10 ^^V
....\mathoff

that shows the substitutions have been performed.

1
  • Thanks, perhaps a package that put together all imaginable character substitutions of this form might be useful, especially for users of free fonts that tend to have more missing glyphs than commercial fonts. Apr 15, 2020 at 10:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .