[XeTeX] Restoring text to the default English font in Latex/fontspec/Bidi

François Charette firmicus at ankabut.net
Tue Sep 18 02:07:10 CEST 2007


sjo a écrit :
> Any help with the following would be much appreciated.
>
> In a bidi (English/Hebrew) setting, how do I set matters up so that
> the default English font is the standard CMR fonts (or some font say
> FENG) and in the bidi/Hebrew mode the standard font is say David (or
> some font FHEB). Here is a little test file that illustrates my
> problem.
>
> ==========
>
> \documentclass[12pt]{book}
> \usepackage[utf8]{inputenc}
> \usepackage[cm-default]{fontspec,xunicode,xltxtra}
> \usepackage{bidi}
> \setmainfont[Script=Hebrew]{FrankRuehl}
> \newfontfamily\hfd[Script=Hebrew,Scale=0.92]{David}
> \begin{document}
>
> %%A
> This text should be in CMR as cm-dfault was set.
>
> %%B
> \beginR\setRL Hebrew stuff in FrankRuehl in right to left mode
>
> \hfd Hebrew stuff in David in right to left
>
> %%C
> \beginL\setLR I would like this text to be in CMR say, how do I do this?
>
> ==================
>
> What I get at point C is the English test in David, not in CMR (or
> whatever I would like FENG to be).
>
> Jon
> _______________________________________________
> XeTeX mailing list
> postmaster at tug.org
> http://tug.org/mailman/listinfo/xetex
>
>   
Jon,

First of all I think you misunderstand the fontspec option cm-default. 
You've overriden it by specifying \setmainfont.

Here is what I did to achieve what you want. Note that I needed to 
change the fonts since I only have Type1 versions of Frank Ruehl and David.

\documentclass[12pt]{book}
\usepackage{fontspec}
\usepackage{xunicode,xltxtra}
\usepackage{bidi}
\newfontfamily\ezra[Script=Hebrew]{Ezra SIL}
\newfontfamily\adobeh[Script=Hebrew,Scale=0.92]{Adobe Hebrew}
\begin{document}

%%A
This text is in Latin Modern because no font was specified.

%%B
{\setRL\ezra
עברית : Hebrew stuff in Ezra in right to left mode

\adobeh עברית : Hebrew stuff in Adobe Hebrew in right to left
}
%%C

\setLR This is again left to right with default roman font.

%You can also simplify the above by defining an Hebrew environment:
\begin{verbatim}
\newenvironment{Hebrew}{\setRL\ezra}{\unsetRL}
\end{verbatim}

\newenvironment{Hebrew}{\setRL\ezra}{\unsetRL}

\begin{Hebrew}
עברית
\end{Hebrew}

English
\end{document}

See the attached pdf file.

Regards,

François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bidiquestion.pdf
Type: application/pdf
Size: 22775 bytes
Desc: not available
Url : http://tug.org/pipermail/xetex/attachments/20070918/09b346b1/attachment-0001.pdf 


More information about the XeTeX mailing list