Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
Why not use math mode e.g. $1+1=2$? –  Leo Liu Aug 12 '11 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. –  ℝaphink Aug 12 '11 at 11:12
1  
Switch to another font for the two glyphs. –  Ulrike Fischer Aug 12 '11 at 14:36
    
@Ulrike: that would work too, but I wanted to know if there was a cleaner way (just in case). –  ℝaphink Aug 12 '11 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. –  Ulrike Fischer Aug 12 '11 at 15:07

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.