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 want to declare more than one font so XeTeX can use other fonts when first font did not have a specific glyph. How can I do that? In windows when the current font does not have a glyph, other font are used to show that glyph.(e.g. I want insert tick (✓) directly, not with \Checkmark)

I know that I can use a Unicode font like code2000 but as you know this kind of fonts generally are not pretty enough.

\documentclass{article}
\usepackage{bbding}
\begin{document}
\section{NOK}
 (✓)  (✗)
\section{OK}
(\Checkmark )  (\XSolidBrush)
\end{document}

enter image description here

\documentclass{article}
\usepackage{bbding}
\usepackage{fontspec}
\setmainfont{Arial Unicode MS}

\begin{document}
\section{OK}
 (✓)  (✗)
\section{OK}
(\Checkmark )  (\XSolidBrush)
\end{document}

enter image description here

At least I want to specify two fonts (e.g.\setfont{Arial,Code200}) ,a main font and a Unicode one so it can be used for missed glyphs.

share|improve this question
    
What have you tried? Did it work? –  doncherry May 1 '12 at 20:17
    
Duplicate of Using TeX for writing papers on linguistics. –  Alan Munn May 2 '12 at 3:57
3  
You can't have XeTeX automatically switch fonts if it doesn't find the glyph in one font. But you can create environments or commands for surrounding the IPA font. –  Alan Munn May 2 '12 at 3:58
1  
If you only need to add a few characters from a different font (and you know in advance which they are), you can use newunicodechar. See, e.g., tex.stackexchange.com/a/41148/83 –  Caramdir May 2 '12 at 4:02
    
Possible duplicate: tex.stackexchange.com/questions/41130/… –  Mechanical snail Oct 21 '12 at 5:55
add comment

1 Answer 1

Using two (or more) fonts in XeLaTeX (or LuaLaTeX) is very easy, since the fontspec package which handles fonts for those engines provides commands for loading new fonts and assigning macro names to them.

What you cannot do is have automatic switching from one font to another if XeTeX fails to find a glyph in a particular font.

Here's an example of font switching used for inserting phonetic characters (which many fonts don't have). The standard font that linguists use for phonetics is Doulos SIL. You can use it in XeLaTeX in the following way:

\documentclass{article}
\usepackage{fontspec}
% We are using Linux Libertine O as our main serifed font
\setmainfont{Linux Libertine O}
% now declare a command \doulos to load the Doulos SIL font
\newfontfamily\doulos{Doulos SIL}
% now create a \textIPA{} command
\DeclareTextFontCommand{\textIPA}{\doulos}
\begin{document}
Here is some text in the main font.
% We now have two ways to enter IPA characters directly in the document:
% Use the \doulos command inside a group
{\doulos [ðɪsɪzsəmfənɛtɪks]}
% or use the \textIPA command
\textIPA{[ðɪsɪzsəmfənɛtɪks]}
\end{document}

In your new example using checkmarks and crosses, you can do things similarly. Here I've used Arial Unicode MS and Zapf Dingbats to show two different versions of these characters (I don't have the Code2000 font). But the principle is exactly the same.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial Unicode MS}
\newfontfamily\dingbats{Zapf Dingbats}
\DeclareTextFontCommand{\textding}{\dingbats}
\begin{document}
\section{In the main font}
 (✓)  (✗)
\section{In the Dingbats font}
{ (\textding{✓})  (\textding{✗})}
\end{document}

output of code

share|improve this answer
    
Can you please update your answer according to updated question? –  PHPst Feb 14 '13 at 8:19
add comment

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.