[OS X TeX] XeTeX

Bruno Voisin bvoisin at mac.com
Wed Apr 14 11:05:32 CEST 2004


Le 14 avr. 04, à 08:32, mike leonard a écrit :

> Thanks a lot. This gets me a lot closer to the
> functionality I was looking for. My only question now
> is whether there is a way to access XeTeX's fancy font
> commands from within a LaTeX document. I can do this
> using plain.sty within a \begin{plain}...\end{plain}
> environment, but this seems to defeat a lot of the
> purpose of compiling and using the LaTeX format in the
> first place.

You can probably do so, by mimicking the font declarations in the 
various font definition files for LaTeX.

You should probably use the U (for unknown) encoding, as fonts are 
Unicode in XeTeX, hence you cannot use T1. Possibly OT1 would work.

I managed to make work the following example:


\documentclass[12pt,a4paper]{article}

\DeclareFontFamily{U}{hoefl}{}
\DeclareFontShape{U}{hoefl}{m}{n}%
      {<-> "Hoefler\space Text"}{}
\DeclareFontShape{U}{hoefl}{m}{it}%
      {<-> "Hoefler\space Text\space Italic"}{}
\DeclareFontShape{U}{hoefl}{m}{sl}%
      {<-> ssub * hoefl/m/it}{}
\DeclareFontShape{U}{hoefl}{bx}{n}%
      {<-> "Hoefler\space Text\space Black"}{}
\DeclareFontShape{U}{hoefl}{b}{n}%
      {<-> ssub * hoefl/bx/n}{}
\DeclareFontShape{U}{hoefl}{bx}{it}%
      {<-> "Hoefler\space Text\space Black\space Italic"}{}
\DeclareFontShape{U}{hoefl}{bx}{sl}%
      {<-> ssub * hoefl/bx/it}{}
\DeclareFontShape{U}{hoefl}{b}{it}%
      {<-> ssub * hoefl/bx/it}{}
\DeclareFontShape{U}{hoefl}{b}{sl}%
      {<-> ssub * hoefl/bx/it}{}
\DeclareFontShape{U}{hoefl}{m}{sc}%
      {<-> "Hoefler\space Text:Letter\space Case=Small\space Caps"}{}
\renewcommand{\encodingdefault}{U}
\renewcommand{\rmdefault}{hoefl}

\begin{document}

Normal text.

\textbf{Bold text}.

\textit{Italic text}.

\textbf{\textit{Bold italic text}}.

\textsc{Small caps text}.

\end{document}


The trick seems to be to put explicit \space commands every time a 
space occurs in a font name à la XeTeX. You get one warning "fclose: 
Bad file descriptor" per font switch, but that doesn't seem to affect 
the output.

I don't think in any case you should use the UTF-8 support in the 
newest release of LaTeX (not yet finalized and hence not yet included 
in Gerben's packages), as, if i'm not mistaken, this essentially 
converts Unicode characters into LaTeX control sequences, and this is 
precisely what XeTeX is set to avoid.

Good luck!

Bruno Voisin
-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the macostex-archives mailing list