2

While looking at this question I noticed that some of the code ligatures from the JetBrains Mono font (freely available from their website) worked in xelatex, but not in lualatex. Compare:

Xelatex

Lualatex

Source

I had to add some characters to \verbatim@nolig@list so that the ligatures didn't appear in verbatim.

\documentclass[12pt]{article}
\usepackage{fontspec}
\setmonofont{JetBrains Mono}

\makeatletter
\AddToHook{cmd/verbatim@nolig@list/after}{\do \|\do \=\do \+\do \~\do \#\do \.\do \/\do \?\do \:\do \[\do \]}
\makeatother

\pagestyle{empty}

\begin{document}
\ttfamily
\begin{tabular}{rl}
<> & \verb|<>| \\
|=> & \verb!|=>! \\
<=| & \verb!<=|! \\
++ & \verb|++| \\
-> & \verb|->| \\
<- & \verb|<-| \\
<-> & \verb|<->| \\
<!-- & \verb|<!--| \\
\textasciitilde> & \verb|~>| \\ 
<\textasciitilde & \verb|<~| \\
\textasciitilde\textasciitilde> & \verb|~~>| \\
<\textasciitilde\textasciitilde & \verb|<~~| \\
->> & \verb|->>| \\
<<- & \verb|<<-| \\
--> & \verb|-->| \\
<-- & \verb|<--| \\
>-> & \verb|>->| \\
<-< & \verb|<-<| \\
/= & \verb|/=| \\
=> & \verb|=>| \\
<= & \verb|<=| \\
<=> & \verb|<=>| \\
\end{tabular}
\hspace{2cm}
\begin{tabular}{rl}
=>> & \verb|=>>| \\
<<= & \verb|<<=| \\
==> & \verb|==>| \\
<== & \verb|<==| \\
<==> & \verb|<==>| \\
>=> & \verb|>=>| \\
<=< & \verb|<=<| \\
\#\# & \verb|##| \\
\#\#\# & \verb|###| \\
|> & \verb!|>! \\
<| & \verb!<|! \\[0.5ex]
[||] & \verb![||]! \\
:?> & \verb|:?>| \\
::= & \verb|::=| \\
:: & \verb|::| \\
?? & \verb|??| \\
<+> & \verb|<+>| \\
.. & \verb|..| \\
</ & \verb|</| \\
/> & \verb|/>| \\
\#? & \verb|#?| \\
]\# & \verb|]#| 
\end{tabular}
\end{document}

With lualatex the ligatures for <->, ->>, >->, and <-< do not appear correctly. Is this a bug in lualatex (or luaotfload, etc.), or an issue with the font?

Note that adding [Contextuals=Alternate] as in this answer seems to make no difference.

5
  • 6
    use Renderer=HarfBuzz May 11, 2023 at 16:32
  • @UlrikeFischer Ah very simple, thanks. Is there a general rule (or place where I can find such a rule) for when and when not to use the Harfbuzz renderer?
    – mbert
    May 11, 2023 at 17:10
  • 2
    well when it works with xelatex but not with lualatex that is the first try. (That is doesn't work in node-mode can be a bug, I didn't try to check. You could open an issue at the luaotfload bug tracker.) May 11, 2023 at 17:17
  • 1
    @UlrikeFischer Opened an issue
    – mbert
    May 11, 2023 at 17:40
  • Since I thought Ulrike’s answer was good enough to keep around, I made it a Community Wiki answer.
    – Davislor
    May 11, 2023 at 22:35

1 Answer 1

1

As Ulrike Fischer answered in a comment, the first thing to try whenever something works in XeLaTeX and not LuaLaTeX is to load the font with Renderer=HarfBuzz. I don’t have that font to test, but you say it worked for you.

The reason is that, by default, XeTeX uses the HarfBuzz renderer for modern Unicode fonts, and LuaTeX uses its own experimental renderer. You’ve already reported this to them as a bug.

You must log in to answer this question.

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