I'm using xelatex
with xepersian
package. What I'm trying to do is to use a specific font for Persian parts of the text (Persian/Arabic Unicode characters) and another one for English parts (English Unicode characters).
In HTML + CSS, I can easily do:
p { font-family: persianfont, englishfont }
Using correct fonts where persianfont
only supports Persian characters and englishfont
only supports English characters, HTML renders text correctly.
It tries to render the character with the first font, but if it doesn't exist in it, it moves to the next one. (We can say englishfont
is a fallback font here)
Now I'm trying to achieve this in TeX
.
I tried the code below, but only the last font is applied:
\settextfont[Mapping=english]{Garamond}
\settextfont[Mapping=arabic]{B NAZANIN.ttf}
Also, the Mapping doesn't seem to work.
- I don't want to use a single font which supports both languages
- I don't want to use
\begin ... \end
for every English font in the document! I want it to be automatic.