[XeTeX] font scope

Mike Maxwell maxwell at umiacs.umd.edu
Sun Nov 11 04:50:57 CET 2007


I guess I have a newbie question, about the scope of font commands. 
It's possible this is answered in the documentation, but I can't figure 
out where I found it (specifically the documentation on 
\newfontinstance).  Senility, I guess.

Anyway, here's the lines of code:

%-----------------
\usepackage{fontspec}
\setmainfont{Charis SIL}
\newfontinstance\DejaFont{DejaVu Sans}
...
some text in Charis \DejaFont{∼} some more text
%-----------------

I was expecting the "some more text" to come out in the Charis font, on 
the assumption that the scope of the \DejaFont command was the material 
in the {}, i.e. only the tilde.  (BTW, the tilde is U+223C, which is not 
really a tilde.)

Instead, the font change to the DejaVu Sans font remains until the next 
overt font change.

Obviously I'm not understanding the scope of this font change.  But in 
order to revert to the preceding font, I need to know what it is (it is 
of course Charis in this example, but I can't count on that in general). 
  What is the command to save the font, and then restore it?  Or better, 
is there a way to do what I want to do, namely limit the scope of the 
font change to a specified string?
-- 
	Mike Maxwell
	maxwell at umiacs.umd.edu
	"For over a thousand years, the British Empire was the guardian
	 of good grammar and the English language.
	 Before the dark times.  Before the Americans."
	--Bob Kenobi (Ben Kenobi's younger brother)


More information about the XeTeX mailing list