5

I'm using a title font which has very few characters, and I need '+' and '=' for a given title, which are missing. Using fontspec, is it possible to import only these two missing glyphs from another font?

Note: it is a very similar question to this one, but I'd like to know if it can be done easily with fontspec.

raphink
  • 31,894

1 Answers1

3

If the symbols are used only in a few cases, the most efficient solution is to define \newcommand{\biggerplus}{{\myplusfont +}}, where \myplusfont is the declaration for choosing the substitute font.

If you really need to use directly + and =, then I suggest

\newfontfamily{\mytitlefont}{Some Font}
\newcommand{\choosetitlefont}{\mytitlefont\mytitlefonttrue}
\newif\ifmytitlefont
\let\pluschar=+
\catcode`+=\active
\protected\def+{\ifmytitlefont{\myplusfont\pluschar}\else\pluschar\fi}
\let\equalschar==
\catcode`==\active
\protected\def={\ifmytitlefont{\myplusfont\equalschar}\else\equalschar\fi}

Instead of calling \mytitlefont for typesetting the titles, you'll call \choosetitlefont.

Solutions with \XeTeXintercharclass would avoid activating the characters, but will have the conditional anyway.

egreg
  • 1,121,712