16

The appended plain TeX example shows three cases:

  • maths alphabets \rm, \bf, \it using plain TeX setup
  • similarly maths alphabets loaded from "classical" Latin Modern fonts
  • similarly maths alphabets loaded with OpenType Latin Modern fonts

For the first two cases, text is set using ligatures; e.g., {\fam\itfam fin} will produce a ligature. In the final case when an OpenType font is used, the ligature doesn't appear. Using the font in-text shows that ligatures are being selected otherwise.

So what's going on? David Carlisle spotted this happening trying to fix up the behaviour of unicode-math, and I've been trying to figure out whether this is my fault! The same happens for both XeTeX and LuaTeX+luaotfload, so if it's an oversight, they are both culpable.

example of ligatures not working

%!TEX TS-program = XeTeX

\ifx\XeTeXversion\undefined
  \input luaotfload.sty
  \def\otf#1{file:#1.otf}
\else
  \def\otf#1{[#1.otf]}
\fi

\hsize=10cm
\parindent=0pt\relax

%%%%%%%%%%%%%%%%%%%%%%%%%%
\hrule
\bigskip

{\bf Default \TeX}

Roman, italic, and bold math families:
$$ {\fam0 abcfin} \quad {\fam\itfam } \quad {\fam\bffam abcfin} $$

%%%%%%%%%%%%%%%%%%%%%%%%%%

\font\myrm = ec-lmr10 at 10pt\relax
\font\mybf = ec-lmbx10 at 10pt\relax
\font\myit = ec-lmri10 at 10pt\relax

\newfam\rmmathfam
\newfam\bfmathfam
\newfam\itmathfam

\textfont\rmmathfam\myrm
\textfont\bfmathfam\mybf
\textfont\itmathfam\myit

\hrule
\bigskip

{\bf Loading new tfm fonts}

Roman ({\myrm abcfin}), italic ({\myit abcfin}), and bold ({\mybf abcfin}) families:
$$ {\fam\rmmathfam abcfin} \quad {\fam\itmathfam abcfin} \quad {\fam\bfmathfam abcfin} $$


%%%%%%%%%%%%%%%%%%%%%%%%%%

\font\Urm = "\otf{lmroman10-regular}" at 10pt\relax
\font\Ubf = "\otf{lmroman10-bold}" at 10pt\relax
\font\Uit = "\otf{lmroman10-italic}" at 10pt\relax

\newfam\Urmmathfam
\newfam\Ubfmathfam
\newfam\Uitmathfam

\textfont\Urmmathfam\Urm
\textfont\Ubfmathfam\Ubf
\textfont\Uitmathfam\Uit

\hrule
\bigskip

{\bf Loading new OpenType fonts}

Roman ({\Urm abcfin}), italic ({\Uit abcfin}), and bold ({\Ubf abcfin}) families:
$$ {\fam\Urmmathfam abcfin} \quad {\fam\Uitmathfam abcfin} \quad {\fam\Ubfmathfam abcfin} $$

\bye
9
  • maybe luaotfload doesn't do text shaping in math nodes?
    – michal.h21
    Jun 27 '15 at 8:08
  • I should have mentioned: same for XeTeX. Jun 27 '15 at 8:45
  • Did anything came out here? Here the problem came up again tex.stackexchange.com/questions/277362/…, and as far as I can see it is not the fault of fontspec (I get it with luaotfload alone too), and it happens in xetex too. Nov 9 '15 at 9:51
  • @UlrikeFischer — I don't think so, sorry; unicode-math applies the base mode (search for Renderer=Basic in the source if you're interested) … and I'm not sure where to go next Nov 9 '15 at 22:53
  • @WillRobertson: What do you mean with base mode in unicode-math? The fonts used by \mathrm or \operatorname don't seem to use it, I had to force it as you can see in my answer to the new question. In context the kerning is missing too and I tried to discuss it on the context list but all I could extract from Hans is "that node mode in math is different" and that in context there is an option to put operators names in a box so that text kerning can kick in. Nov 10 '15 at 8:39
13

For luatex you can load the fonts in base mode

enter image description here

\ifx\XeTeXversion\undefined
  \input luaotfload.sty
  \def\otf#1{file:#1.otf:mode=base}
\else
  \def\otf#1{[#1.otf]}
\fi

For xetex, I pinged Arthur in chat....

luaotfload documentation explains the need for this:

base mode works by mapping OpenType features to traditional TeX ligature and kerning mechanisms.

Supporting only non-contextual substitutions and kerning pairs, it is the slightly faster, albeit somewhat limited, variant.

node mode works by processing TeX’s internal node list directly at the lua end and supports a wider range of OpenType features.

The downside is that the intricate operations required for node mode may slow down typesetting especially with complex fonts and it does not work in math mode.

By default luaotfload is in node mode, and base mode has to be requested where needed, e.g. for math fonts.

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.