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.

5
  • 1
    Why not use math mode e.g. $1+1=2$?
    – Leo Liu
    Commented Aug 12, 2011 at 11:10
  • That is a good idea, but my title font is scaled (huge is not big enough for my needs), so the math font doesn't scale the same.
    – raphink
    Commented Aug 12, 2011 at 11:12
  • 1
    Switch to another font for the two glyphs. Commented Aug 12, 2011 at 14:36
  • @Ulrike: that would work too, but I wanted to know if there was a cleaner way (just in case).
    – raphink
    Commented Aug 12, 2011 at 14:44
  • The clean way is to use a better font. All other solutions involve a font switch which you can do in various ways (commands, \XeTeXinterclass) but still is a font switch. Commented Aug 12, 2011 at 15:07

1 Answer 1

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.

You must log in to answer this question.

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