[XeTeX] Russian fonts
Jonathan Kew
jonathan at jfkew.plus.com
Fri Jan 16 13:37:20 CET 2009
On 16 Jan 2009, at 11:45, Olly Powell wrote:
> Sorry, I forgot to include the Preamble.
>
> Jonathan's answer is spot on. Works perfectly in Times new Roman
> works perfectly.
>
> \documentclass{book}
> \usepackage{fontspec,xunicode,xltxtra}
> \newcommand{\russ}[1]{{\fontspec{Times New Roman}#1}}
> \newcommand{\rusp}[1]{{\fontspec{Perestroika}#1}}
>
Note that if you select a suitable font (that includes Cyrillic as
well as Latin) using \setmainfont, you don't need to do anything
further in order for Russian text to show up properly as well.
(If you need hyphenation within the russian, then you'll need to
switch languages using babel or polyglossia; that's a separate matter
from the font/encoding issue.)
Also, if you do want to create commands like this, don't use \fontspec
directly in them; it's much more efficient to use \newfontfamily to
declare the family you want to use, and then use this within your
markup commands:
\newfontfamily{\russfam}[Script=Cyrillic]{Times New Roman}
\newcommand{\russ}[1]{{\russfam #1}}
or something like that. (The Script=Cyrillic option may not be needed,
but in theory at least, a font could contain separate kerning or other
tables for Cyrillic vs Latin, in which case this would activate the
appropriate features.) See the fontspec manual for more details.
JK
More information about the XeTeX
mailing list