2

MWE:

\documentclass[margin=0pt, 12pt]{standalone}

\usepackage{fontspec}
\usepackage{unicode-math}
\setmonofont{FiraCodeNerdFontPropo}[
  Extension = .ttf,
  Path = ../../../fonts/FiraCodeNerdFont/,
  UprightFont = *-Regular,
  BoldFont = *-Bold
]

\begin{document}
  \texttt{^^^^^^0f0072}
\end{document}

I used the font here: https://www.nerdfonts.com/font-downloads

Based on the font cheat sheet (https://www.nerdfonts.com/cheat-sheet), 0x0f0072 is a barcode icon.

The above code, when compiled with XeLaTeX, indeed gives a barcode icon.

However, when compiled with LuaLaTeX, the PDF shows a bank icon (which is 0x0f0070).

After some test I found that LuaLaTeX seems to shift every icon by 0x2.

I don't know if I missed something or this is just a bug.

2
  • I don't know how to do that in (Lua)latex, but I would try to access the glyphs via name I stead of number..
    – mickep
    Commented Mar 29 at 10:48
  • I wish I could. Unfortunately LaTeX doesn't have a material design icon package yet afaik...
    – zhtluo
    Commented Mar 29 at 17:47

1 Answer 1

4

The problem is not with supplementary planes but specifically with the private use planes. LuaLaTeX's default node mode does not expect private use codepoints to be input directly and therefore freely remaps them.

If you don't want this, you can use harf mode instead, e.g. with fontspec's Renderer = HarfBuzz option:

\documentclass{article}

\usepackage{fontspec}
\usepackage{unicode-math}
\setmonofont{FiraCodeNerdFontPropo}[
  Extension = .ttf,
  Path = ../../../fonts/FiraCodeNerdFont/,
  UprightFont = *-Regular,
  BoldFont = *-Bold,
  Renderer = HarfBuzz
]

\begin{document}
  \texttt{^^^^^^0f0072}
\end{document}
1
  • Thanks. harf as you provided indeed works when compiling to PDF, but does not seem to work on dvilualatex with dvisvgm when compiling to SVG (ERROR: can't load glyph 983154). Do you know why?
    – zhtluo
    Commented Mar 29 at 6:22

You must log in to answer this question.

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