font management simplified (was Re: [OS X TeX] Trump Mediaeval fonts_

Bruno Voisin bvoisin at mac.com
Fri Oct 1 10:34:29 CEST 2004


Le 1 oct. 04, à 04:08, Scott Murman a écrit :

> i think i would consider switching to xetex if it supported pdf output 
> directly.  just too convenient a feature to give up.
>
> -SM-

I think it does: by default xetex creates a file in .xdv (extended 
.dvi) format then launches xdv2pdf automatically, to convert it to .pdf 
format, in a way completely transparent to the user. Actually, to see 
the intermediate .xdv file you have to use instead "xetex -no-pdf".

If you meant inclusion of .pdf figures, then XeTeX does that as well, 
together with inclusion of .jpeg, .pict, and all graphical formats 
known to Mac OS X (actually QuickTime). Ross Moore has written a 
definition file xetex.def, included in the distribution, which allows, 
using the graphics and/or color packages with XeLaTeX, inclusion of 
many graphical formats (apparently .pdf, .png, .jpg, .pict, .tif, .psd, 
.mac, .sgi, .tga, .gif), use of colour, rotation and scaling.

Beware though: XeTeX handles fonts in Mac OS X format in a 
straightforward way, together with OpenType fonts. It does not, 
however, handles PostScript fonts in Unix .pfa or .pfb formats, which 
are the formats in which PostScript fonts are handled by teTeX. This 
means, in particular, that the common LaTeX packages for using 
PostScript fonts, for example mathptmx.sty, mathpazo.sty, times.sty, 
helvet.sty and courier.sty, won't work.

You'll have to write font declarations yourself, which is not so 
difficult. And this will allow you to activate or disactivate at will 
the special features in each font.

For example, suppose you want to write text in the Hoefler Text font in 
"florish style", say with quaint ligatures (st, ct, etc.), swash 
capitals, diphthong ligatures, and the like. "All" you have to do is 
include in the preamble of your LaTeX document:

\DeclareFontFamily{U}{hoeftxt}{}
\DeclareFontShape{U}{hoeftxt}{m}{n}
   {<-> "Hoefler\space Text:
           Ligatures=Rare\space Ligatures,Diphthong\space Ligatures;
           Character\space Alternates=Alternates
        "}{}
\DeclareFontShape{U}{hoeftxt}{m}{it}
   {<-> "Hoefler\space Text\space Italic:
           Ligatures=Rare\space Ligatures,Diphthongs;
           Character\space Alternatives=Normal\space Vertical\space 
Position
        "}{}
\DeclareFontShape{U}{hoeftxt}{b}{n}
   {<-> "Hoefler\space Text\space Black:
           Ligatures=Rare\space Ligatures,Diphthongs;
           Character\space Alternatives=Alternates
        "}{}
\DeclareFontShape{U}{hoeftxt}{b}{it}
   {<-> "Hoefler\space Text\space Black\space Italic:
           Ligatures=Rare\space Ligatures,Diphthongs;
           Character\space Alternatives=Lower\space Case\space Numbers
        "}{}
\DeclareFontShape{U}{hoeftxt}{bx}{n}
   {<-> ssub * hoeftxt/b/n}{}
\DeclareFontShape{U}{hoeftxt}{bx}{it}
   {<-> ssub * hoeftxt/b/it}{}
\DeclareFontShape{U}{hoeftxt}{m}{sc}
   {<-> "Hoefler\space Text:
           Letter\space Case=Small\space Caps;
           Character\space Alternates=Alternates
        "}{}
\renewcommand{\encodingdefault}{U}
\renewcommand{\rmdefault}{hoeftxt}

For knowing the exact names of the fonts, to be used in the above, you 
may use Font Book where the name, appropriate for XeTeX, is called 
Display Name. And for knowing the exact names, for each font instance, 
of the different features that the font has to offer, you may use 
TextEdit, select the font panel (Cmd-T), select a font and style, click 
on the scroll wheel icon at the bottom left of the panel and then 
select, in the menu that appears, "Typography…".

For OpenType fonts there are similar possibilities, with slightly 
different syntax. I don't own OpenType fonts myself, thus I've never 
tried, but there are examples of the use of OpenType fonts with XeLaTeX 
in the XeTeX mailing list archive. For example, stuff like this:

\DeclareFontFamily{U}{AdobeGaramondPro}{}
\DeclareFontShape{U}{AdobeGaramondPro}{m}{n}%
     {<-> "Adobe\space Garamond\space Pro:+onum"}{}

or that:

\DeclareFontShape{U}{owp}{m}{sc}{
    <-> "Warnock\space Pro:+onum, +smcp"
    }{}

nay even that

\DeclareFontShape{U}{owp}{m}{sc}{
    <-8.9> "Warnock\space Pro\space Caption:+onum, +smcp"
    <9.0-12.9> "Warnock\space Pro:+onum, +smcp"
    <13.0-24.9> "Warnock\space Pro\space Subhead:+onum, +smcp"
    <25.0-> "Warnock\space Pro\space Display:+lnum, +smcp"
}{}

An archive of such definition files is available at 
<http://jbreitenbuch.wooster.edu/~jonb/AdobeTypeClassicsplus.zip>.

When the font has no feature to offer, things are much simpler 
(boring?). For Palatino, Helvetica and Courier that might be:

\DeclareFontFamily{U}{osxppl}{}
\DeclareFontShape{U}{osxppl}{m}{n}
   {<-> "Palatino"}{}
\DeclareFontShape{U}{osxppl}{m}{it}
   {<-> "Palatino\space Italic"}{}
\DeclareFontShape{U}{osxppl}{b}{n}
   {<-> "Palatino\space Bold"}{}
\DeclareFontShape{U}{osxppl}{b}{it}
   {<-> "Palatino\space Bold\space Italic"}{}
\DeclareFontShape{U}{osxppl}{bx}{n}
   {<-> ssub * osxppl/b/n}{}
\DeclareFontShape{U}{osxppl}{bx}{it}
   {<-> ssub * osxppl/b/it}{}
\DeclareFontShape{U}{osxppl}{m}{sl}
   {<-> ssub * osxppl/m/it}{}
\DeclareFontShape{U}{osxppl}{b}{sl}
   {<-> ssub * osxppl/b/it}{}
\DeclareFontShape{U}{osxppl}{bx}{sl}
   {<-> ssub * osxppl/bx/it}{}

\DeclareFontFamily{U}{osxphv}{}
\DeclareFontShape{U}{osxphv}{m}{n}
   {<-> s* [0.95] "Helvetica"}{}
\DeclareFontShape{U}{osxphv}{b}{n}
   {<-> s* [0.95] "Helvetica\space Bold"}
\DeclareFontShape{U}{osxphv}{bx}{n}
   {<-> ssub * osxphv/b/n}{}

\DeclareFontFamily{U}{osxpcr}{}
\DeclareFontShape{U}{osxpcr}{m}{n}
   {<-> "Courier"}{}
\DeclareFontShape{U}{osxpcr}{b}{n}
   {<-> "Courier\space Bold"}{}
\DeclareFontShape{U}{osxpcr}{bx}{n}
   {<-> ssub * osxpcr/b/n}{}

\renewcommand{\encodingdefault}{U}
\renewcommand{\rmdefault}{osxppl}
\renewcommand{\sfdefault}{osxphv}
\renewcommand{\ttdefault}{osxpcr}

A final more word: Mac OS X fonts, as declared above, are appropriate 
for text, but not for math. By default, the math fonts that Xe(La)TeX 
uses are CM, which generally look way too thin compared with PostScript 
fonts. In case you write maths and wants XeLaTeX to use the text font 
for some of the maths, you need to add more declarations. For example, 
for Hoefler text that would be:

\DeclareFontFamily{U}{hoefmat}{}
\DeclareFontShape{U}{hoefmat}{m}{n}
   {<-> "Hoefler\space Text:
         Number\space Case=Upper\space Case\space Numbers
        "}{}
\DeclareFontShape{U}{hoefmat}{m}{it}
   {<-> "Hoefler\space Text\space Italic:
           Smart\space Swashes=!Line\space Final\space Swashes,
                               !Line\space Initial\space Swashes;
           Number\space Case=Uppercase\space Numbers
        "}{}
\DeclareFontShape{U}{hoefmat}{b}{n}
   {<-> "Hoefler\space Text\space Black:
           Number\space Case=Diphthong\space Ligatures
        "}{}
\DeclareFontShape{U}{hoefmat}{b}{it}
   {<-> "Hoefler\space Text\space Black\space Italic:
           Smart\space Swashes=!Line\space Final\space Swashes,
                               !Line\space Initial\space Swashes;
           Number\space Case=Normal\space Vertical\space Position
        "}{}
\DeclareFontShape{U}{hoefmat}{bx}{n}
   {<-> ssub * hoefmat/b/n}{}
\DeclareFontShape{U}{hoefmat}{bx}{it}
   {<-> ssub * hoefmat/b/it}{}
\newcommand{\mtdefault}{hoefmat}

\SetSymbolFont{operators}{normal}{\encodingdefault}{\mtdefault}{m}{n}
\SetSymbolFont{operators}{bold}  {\encodingdefault}{\mtdefault}{b}{n}
\SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\mtdefault}{m}{n}
\SetMathAlphabet{\mathbf}{normal}{\encodingdefault}{\mtdefault}{b}{n}
\SetMathAlphabet{\mathit}{normal}{\encodingdefault}{\mtdefault}{m}{it}
\SetMathAlphabet{\mathrm}{bold}  {\encodingdefault}{\mtdefault}{b}{n}
\SetMathAlphabet{\mathit}{bold}  {\encodingdefault}{\mtdefault}{b}{it}

This tells XeLaTeX to use Hoefler Text for numbers, for letters (called 
by \mathrm, \mathit etc.) and for log-like functions (\cos \sin etc.). 
The feature selections (swashes and number case) are here to prohibit 
the use of swash letters and old-style numbers in maths. You may also 
prefer to emulate the style of old math books, with old-style numbers 
for text and normal math size, and standard numbers for sub- and 
superscripts. Then you would declare stuff like:

\DeclareFontFamily{U}{hoefmat}{}
\DeclareFontShape{U}{hoefmat}{m}{n}
   {<-9> "Hoefler\space Text:
          Number\space Case=Upper\space Case\space Numbers
         "
    <9-> "Hoefler\space Text
         "}{}
\DeclareFontShape{U}{hoefmat}{m}{it}
   {<-9> "Hoefler\space Text\space Italic:
            Smart\space Swashes=!Line\space Final\space Swashes,
                                !Line\space Initial\space Swashes;
            Number\space Case=Uppercase\space Numbers
         "
    <9-> "Hoefler\space Text\space Italic:
            Smart\space Swashes=!Line\space Final\space Swashes,
                                !Line\space Initial\space Swashes
         "}{}
\DeclareFontShape{U}{hoefmat}{b}{n}
   {<-9> "Hoefler\space Text\space Black:
            Number\space Case=Diphthong\space Ligatures
         "
    <9-> "Hoefler\space Text\space Black
         "}{}
\DeclareFontShape{U}{hoefmat}{b}{it}
   {<-9> "Hoefler\space Text\space Black\space Italic:
            Smart\space Swashes=!Line\space Final\space Swashes,
                                !Line\space Initial\space Swashes;
            Number\space Case=Normal\space Vertical\space Position
         "
    <9-> "Hoefler\space Text\space Black\space Italic:
            Smart\space Swashes=!Line\space Final\space Swashes,
                                !Line\space Initial\space Swashes
         "}{}
\DeclareFontShape{U}{hoefmat}{bx}{n}
   {<-> ssub * hoefmat/b/n}{}
\DeclareFontShape{U}{hoefmat}{bx}{it}
   {<-> ssub * hoefmat/b/it}{}
\newcommand{\mtdefault}{hoefmat}

\SetSymbolFont{operators}{normal}{\encodingdefault}{\mtdefault}{m}{n}
\SetSymbolFont{operators}{bold}  {\encodingdefault}{\mtdefault}{b}{n}
\SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{\mtdefault}{m}{n}
\SetMathAlphabet{\mathbf}{normal}{\encodingdefault}{\mtdefault}{b}{n}
\SetMathAlphabet{\mathit}{normal}{\encodingdefault}{\mtdefault}{m}{it}
\SetMathAlphabet{\mathrm}{bold}  {\encodingdefault}{\mtdefault}{b}{n}
\SetMathAlphabet{\mathit}{bold}  {\encodingdefault}{\mtdefault}{b}{it}

Not sure this can still be called "font management simplified", but 
where would be the fun otherwise ;-)

Bruno Voisin

NB 1 As you can see I'm a XeTeX enthusiast, thus I'm probably not 
objective!

NB 2 The inconsistent naming of the AAT features in some OS X fonts, as 
you can see above in the Hoefler Text examples, are a reported bug to 
Apple.
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the Macostex-archives mailing list