[XeTeX] new font question: is this possible?
Zdenek Wagner
zdenek.wagner at gmail.com
Fri Mar 14 01:39:24 CET 2014
2014-03-13 19:09 GMT+01:00 François Patte <francois.patte at mi.parisdescartes.fr>:
> Bonjour,
>
> When writing a Sanskrit text, there are (at least) two ways: roman
> transliteration, or devanagari.
>
> In a transliterated text, there are much more blank spaces between
> "words" than in a devanagari text. I would like to be able to have only
> one file for a text and choose either transliteration or devanagari.
>
> Is it possible to have some active character which separates "words" in
> the file and this character will give a blank space, if I choose
> tranliteration, and will give a null space if I choose devanagari, but a
> null space which allows ligature if necessary.
>
> For instance, in the file we have: tasmād_dhetor_bijasya and we get,
> after compilation:
>
> tasmād dhetor bījasya (in transliteration)
>
> or
>
> तस्माद्धेतोर्बीजस्य (in devanagari)
>
> (I have chosen underscore as the active character, but it is not the
> best idea...)
>
The TECkit mapping is applied after all macros are expanded, just
before the horizontal list is built. You have to decide in advance
whether _ will expand to \space or to nothing. Thus you can do the
following:
\documentclass[a4paper,11pt]{report}
\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{%
FreeSerif%
}
\usepackage{polyglossia}% I prefer polyglossia to babel
\setdefaultlanguage{sanskrit}
\newfontfamily\sanskritfont[%
Script=Devanagari,Language=Sanskrit,AutoFakeSlant=0.2]{FreeSerif}
\begin{document}
\catcode`\_=13
\def\MyText{tat_sat śrī_bhagavān_uvāca}% _ not expanded here
% Sanskrit is the default language, no need to change the font
% As default, we have the transliteration, we have to define _
\def_{\space}
\MyText
{% Devanagari, redefine _ and add mapping
\def_{}
\addfontfeature{Mapping=RomDev}
\MyText
}
% Transliteration again
\MyText
\end{document}
The PDF is attached.
> Thank you for any light!
>
> --
> François Patte
> UFR de mathématiques et informatique
> Laboratoire CNRS MAP5, UMR 8145
> Université Paris Descartes
> 45, rue des Saints Pères
> F-75270 Paris Cedex 06
> Tél. +33 (0)1 8394 5849
> http://www.math-info.univ-paris5.fr/~patte
>
>
>
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
> http://tug.org/mailman/listinfo/xetex
>
--
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zwsanskrit.pdf
Type: application/pdf
Size: 5009 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20140314/3a7cab28/attachment.pdf>
More information about the XeTeX
mailing list