[XeTeX] Using different fonts for devanagari and latin characters

Zdenek Wagner zdenek.wagner at gmail.com
Sun Feb 12 17:16:06 CET 2012


2012/2/12 Mike Maxwell <maxwell at umiacs.umd.edu>:
> On 2/12/2012 7:47 AM, Zdenek Wagner wrote:
>>
>> Another possibility is to use ucharclasses...
>>
>> This is a small sample (no need to change fonts manually):
>>
>> \documentclass[12pt]{article}
>> \usepackage{fontspec}
>> \usepackage[Devanagari]{ucharclasses}
>> \setmainfont{Charis SIL}
>> \setTransitionTo{Devanagari}{\fontspec[Script=Devanagari]{Nakula}}
>> \begin{document}
>> I can write in English और वाक्य का एक भाग हिंदी में हो सकता है।
>> \end{document}
>
>
> This sort of thing came up several years ago on this mailing list (I don't
> recall the date, but it was before the 19 Dec 2010 date on the current
> ucharclasses documentation).  Some people on the list said that this idea
> would break where there were ambiguous characters.  I presume that would
> mostly be punctuation.  Some Unicode blocks have their own punctuation
> (there's a danda, roughly the equivalent of a period = full stop, in the
> above text), but often other blocks use ASCII or extended Latin punctuation.
>  I don't suppose that's much of a problem with left-to-right scripts, but I
> can at least imagine it messing up right-to-left scripts.  A period or paren
> or comma in the middle of Arabic, Hebrew, or Thaana text, say.
>
> I skimmed the documentation, but it doesn't mention this situation.  (It
> does mention potential problems with English and Vietnamese.)  However,
> there is a \setTransitionsForPunctuation (sxn 4.4), and maybe you could use
> this to work around the problem (if it is indeed a problem).
>
> Has anyone worked with mixing L2R and R2L scripts using this, and if so, did
> you run into problems?
> --
I have tried but the text did not contain parentheses. I will try if I
find some time.

>        Mike Maxwell
>        maxwell at umiacs.umd.edu
>        "My definition of an interesting universe is
>        one that has the capacity to study itself."
>        --Stephen Eastmond



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the XeTeX mailing list