11

I know that I can type unicode characters by number in LuaTeX with ^^^^00a9 for example. Works for the copyright symbol.

I can't get it to work though for arbitrary symbols like ^^^^2764 (heart) or ^^^^260e (phone).

How can I make LuaTeX support these characters and why doesn't it work in the first place?

4
  • you will have a warning in the log that tells you the font you are using does not have that character. Feb 18, 2017 at 10:44
  • @DavidCarlisle This is not really a warning. Just a message saying: Missing character: There is no ❤ (U+2764) in font [lmroman10-regular]:+tlig;! Feb 18, 2017 at 16:21
  • 1
    @PaulGaborit yes a behaviour inherited from classical tex, it's not clear why it's not styled more as a Warning or at least sent to the terminal, but it's not changeable in the macro layer it's a low level feature of the engines. Feb 18, 2017 at 16:26
  • tex.stackexchange.com/a/119945 is related, but the answer given there seems to need some adjustment for the current version of TeX Live.
    – Thérèse
    Feb 18, 2017 at 19:40

1 Answer 1

18

LuaTeX supports all UTF-8 characters (directly or via ^^^^XXXX). Most fonts, however, do not have all the corresponding glyphs.

For each missing character, in the log file, you will find a message as:

Missing character: There is no ❤ (U+2764) in font [lmroman10-regular]:+tlig;!
\RequirePackage{luatex85}
\documentclass[varwidth=8cm,border=3mm]{standalone}
\usepackage{fontspec}

\newcommand\tryfont[1]{
  \setmainfont{#1}
  #1:\par
  COPYRIGHT SIGN: © ^^^^00a9\par
  HEAVY BLACK HEART: ❤ ^^^^2764\par
  BLACK TELEPHONE: ☎ ^^^^260e\par
  \vspace{1em}
}

\begin{document}
\tryfont{Latin Modern Roman}
\tryfont{Source Code Pro}
\tryfont{DejaVu Sans}
\end{document}

enter image description here

1
  • 1
    +1 Many fonts have a lot of glyphs, but usually is to support different languages and styles, not icon-like symbols as a phone. Among serious fonts (by "serious" I mean professional look, full set of styles,etc.), DejaVu should be one of the best at this respect, but it would be nice of know of others good with similar or more complete set of utf8 icons, specially among serif fonts.
    – Fran
    Feb 21, 2017 at 20:23

You must log in to answer this question.

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