[XeTeX] what is \setmainfont used for?

Ulrike Fischer news3 at nililand.de
Fri Feb 10 00:07:39 CET 2017


Am Thu, 9 Feb 2017 23:20:51 +0100 schrieb François Patte:

> I don't understant how to use \setmainfont. It seems that something has
> changed between texlive-2014 and texlive-2016.
> 
> If I compile this :
> 
> <----------------------------
> \documentclass[a4paper,twoside,11pt]{book}
> 
> \usepackage{fontspec}
> \usepackage{polyglossia}
> \setdefaultlanguage{sanskrit}
> 
> \setmainfont{%
>   FreeSerif%
> }%
> [%
> Mapping=velthuis-sanskrit,%
> Script=Devanagari,
> ]
> 
> \begin{document}
>   ekaadaya.h eka uttaro v.rddhirye.saa.m te ekottaraa.h
>   ekaadaya"scaikottaraa"sca te tathaa eva.mvidhaa vyastaa.h
>   apasavyakramasthaapitaa.h a"nkaa.h kramasthitai.h
> 
> \end{document}
> <--------------------------------
> 
> Output is not in devanagari
> 

The problem is that fontspec adds by default "Ligature=TeX". In
xelatex this is implemented through a mapping and so disables the
Mapping=velthuis-sanskrit.

This has been already discussed and hopefully Will will correct in
the near future. In the mean time you can disable the ligature
mapping:

\documentclass[a4paper,twoside,11pt]{book}

\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{sanskrit}

\defaultfontfeatures[\rmfamily,\sffamily]{} %<---

\setmainfont{%
  FreeSerif%
}%
[%
Mapping=velthuis-sanskrit,%
Script=Devanagari,
]

%
\begin{document}
  ekaadaya.h eka uttaro v.rddhirye.saa.m te ekottaraa.h
  ekaadaya"scaikottaraa"sca te tathaa eva.mvidhaa vyastaa.h
  apasavyakramasthaapitaa.h a"nkaa.h kramasthitai.h

\end{document}

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



More information about the XeTeX mailing list