[XeTeX] fontspec and languages

Ulrike Fischer news3 at nililand.de
Wed Sep 11 11:24:55 CEST 2013


Am Tue, 10 Sep 2013 19:45:24 +0200 schrieb Javier Bezos:

> This is in fact a question about fontspec, but since it is
> used mainly with xetex (and luatex) I think I'll get better
> answers here.
> 
> The question is: Does fontspec provide a way to set the
> language so that it's always active even if other default
> features are changed.

Not that I know (and the code doesn't look as if it does). 

One could perhaps change the default language DFLT, but this will
disable the fallback to DFLT for fonts which don't know a language
and I have some doubts this is a good idea.

Imho the best way to change/set the language is to use
\addfontfeatures *and* defaultfontsfeatures (and hope that the user
doesn't use a \defaultfontfeatures afterwards):

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Color=FF0000}
\setmainfont{lmroman10-regular.otf}
\begin{document}

123 test fi

\ExplSyntaxOn
\expandafter\defaultfontfeatures\expandafter{\g_fontspec_default_fontopts_tl,Language=Turkish}
\ExplSyntaxOff
\addfontfeatures{Language=Turkish,Numbers=OldStyle,Color=CCCCCC}
123 test fi

\fontspec{lmroman10-regular.otf}
123 test fi
\end{document}




-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/



More information about the XeTeX mailing list