[XeTeX] "Hoefler Text" XeLaTeX interface

Jonathan Kew jonathan_kew at sil.org
Mon Oct 4 14:11:35 CEST 2004


On 4 Oct 2004, at 12:16 pm, Jonathan Kew wrote:

>> At the moment I need a separate font family for literally almost 
>> every (if I choose to make them, which I don't) permutation of font 
>> feature choice. But if there was an XeTeX command I didn't know about 
>> that would do say:
>>
>>   \font\f="Hoefler Text"
>>   \f
>>   text with normal ligatures
>>
>>   \xetexchangefontfeature{"Ligatures = Rare\space Ligatures;"}
>>   text with rare ligatures
>>
>> That would be fantastic. Is such a thing conceivable or in existence 
>> already?
>
> It's something I've thought about, though it would be a significant 
> break from the current model where a TeX \font is directly associated 
> with one specific ATSUI style. I can think of a couple of ways it 
> might be implemented, but I'm not ready to promise anything!
>
> In principle, you could probably do it directly in TeX macros even 
> now--use \fontname to get the name of the current font, and then 
> declare a new \font with the feature setting you want added. But that 
> sort of string manipulation in TeX macros can get tricky, I admit.
>

As a starting point, you could try this....

%%%%%%%%%%%%%%%%%%%%%%%%%
\def\myfont{Hoefler Text}
\font\testfont="\myfont" at 24pt
\testfont
\nopagenumbers \frenchspacing

\def\XeTeXchangefontfeature#1{%
   \edef\currentfont{\fontname\font\space}%
   \expandafter\getsizeandfeatures\currentfont at 10pt\relax
   \edef\newfeatures{\ifx\currfeatures\empty
     #1\else\currfeatures;#1\fi}%
   \font\newfont="\currfontname:\newfeatures" \currsize \newfont}
\def\getsizeandfeatures "#1" #2at #3\relax
  {\def\currfontname{#1}%
   \def\currsize{#2}\ifx\currsize\empty\def\currsize{at 10pt}\fi
   \expandafter\getfeatures\currfontname::\relax}
\def\getfeatures #1:#2:#3\relax
   {\def\currfontname{#1}\def\currfeatures{#2}}

This is a test for the
{\XeTeXchangefontfeature{Letter Case=Small Caps}Small Caps feature}
in the Hoefler Text font.
And here's {\XeTeXchangefontfeature{Letter Case=All Capitals;Style 
Options=Engraved Text}some text showing the Engraved Capitals.}

\end
%%%%%%%%%%%%%%%%%%%%%%%%%

I don't suppose this is particularly bulletproof, but it shows the 
general idea.

Enjoy!

JK



More information about the XeTeX mailing list