[XeTeX] Is it possible to set a fonts preference sequence in XeTeX?

Zdenek Wagner zdenek.wagner at gmail.com
Fri Mar 2 16:06:45 CET 2012


2012/3/2 Cosmia Luna <cosmius at gmail.com>:
> I'm working on documents with more than one language, usually English
> and Chinese. A single font can't render the documents perfect. I have
> manually set font for each language like {\fontspec{font for language
> A} text in language A}, or define a macro or environment.
>
> Also I work on more than one computer and they have different fonts
> installed, I just want to make a bit of change in my secondary
> computer but failed because Windows don't have DejaVu Serif by
> default, and I use Linux in most of time.
>
> So is it possible to define a fonts preference sequence, which can:
>
>     Define a font sequence [fontA, fontB, fontC,...].
>     for a single character ch:
>
>     if( fontA exists AND ch is defined in fontA ){
>         use fontA to render ch;
>     }else if( fontB exists AND ch is defined in fontB ){
>         use fontB to render ch;
>     }else if( fontC exists AND ch is defined in fontC ){
>         use fontB to render ch;
>     }...else{
>         throw NoAvailableFontException;
>     }
>
> It's OK if the implement is complex, since a external package doesn't bother.
>
I think it should be possible. If a font is not found, nullfont is
selected. However, DejaVu can freely be downloaded, thus you can
install it on Windows. You can then set a font per language by
polyglossia (I do not know whether Chinese is supported) or per
Unicode block by ucharclasses (not present in TeX Live but freely
available from CTAN).

> Thanks
>
> ----
>
> Cosmia Luna
>
>
>
> --------------------------------------------------
> 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



More information about the XeTeX mailing list