Difference between revisions of "Fonts in XeTeX - Old Content"

From Wiki
Jump to navigation Jump to search
m (revealed a few more features in the example)
m (Listed type-exa presets.)
Line 17: Line 17:
 
  \setupbodyfont[times]
 
  \setupbodyfont[times]
  
Please note that there is absolutely no attempt to retain font metrics, so this will almost certainly re-flow legacy documents.
+
Please note that there is absolutely no attempt to retain font metrics, so this will almost certainly re-flow legacy documents. The following typescripts/typefaces from <tt>type-exa</tt> are thus available:
 +
* postscript
 +
* times
 +
* palatino
 +
* lucida (if you have the fonts)
  
 
==Wildcard typescripts==
 
==Wildcard typescripts==

Revision as of 14:33, 26 November 2004

< XeTeX | Fonts >

Fonts get special treatment in XeTeX. By supporting a rich, within-TeX means of font specification, one avoids the usual difficulties associated with the TeX font mess: no dealing with map files, encodings, Karl Berry naming schemes, tfms, or virtual fonts. This page describes the various typescripts introduced with type-xtx.

Common among all these typescripts is the Unicode encoding: [encoding=uc]

Compatibility Typescripts

The first class of typescript enables one to use familiar typescripts, such as times, palatino, postscript, and the like, from type-exa. The following typescripts are defined for the uc encoding:

times 
Times Roman - no slanted, no small caps
palatino 
Book Antiqua - (Apple's Palatino clone) no slanted, no small caps
helvetica 
Helvetica Neue - Apple's default Helvetica doesn't offer an oblique, so Helvetica Neue is substituted
courier 
Courier - No italics or oblique. None of Apple's default monospaced fonts ship with an oblique, so this typescript is necessarily limited.
lucida 
Lucida Bright, Sans, Typewriter, Calligraphy, Handwriting, and Fax are all provided with Microsoft's Office 2004. For those with that software and those fonts, these typescripts are provided to take advantage of the predefined ones in ConTeXt. Keep in mind that the lucida math fonts are still for-pay only.

You can simply invoke these typescripts with the familiar calls, except that they have the uc encoding:

\usetypescript[times][uc]
\setupbodyfont[times]

Please note that there is absolutely no attempt to retain font metrics, so this will almost certainly re-flow legacy documents. The following typescripts/typefaces from type-exa are thus available:

  • postscript
  • times
  • palatino
  • lucida (if you have the fonts)

Wildcard typescripts

XeTeX offers some nice features in terms of automatically finding related fonts in a family, namely the italic, bold, and bolditalic alternatives. To take advantage of that, there's a set of wildcard typescripts that take an arbitrary Macintosh font name as input, and provide as many of the alternatives it can find. To set these typescripts (and the calling conventions) apart from the familiar ones, the typescripts are identified with Xserif, Xsans, and Xmono. As they use some specific XeTeX features, they all use the uc encoding.

To call the typescripts, it's most convenient to define a typeface that uses these features. The named font slot should contain the display name of the Regular alternative (not the family name) of the font in question. The typefaces are callable with four, five, or six arguments:

\definetypeface[myface][rm][Xserif][Baskerville]
\definetypeface[myface][tt][Xmono] [Courier]       [default]
\definetypeface[myface][ss][Xsans] [Optima Regular][default][rscale=.87]

As you can see, you can activate relative scaling of face sizes. The above definitions look very much like any other typeface definition, except that the serif/sans/mono identifier is preceded with X, and that there is no underlying "Optima Regular" typescript defined anywhere. The rest is typescript and XeTeX magic.

Other typescripts

Typescript usage is best done by creating your own typeface and using it. There are no pre-defined combinations, only tools for making your own combinations. As you can use arbitrary fonts "on-the-fly" with the above wildcard typescripts, I see pre-built typescripts for Apple fonts as being more stifling to the designer than anything else!

hoefler 
Rich serif AAT font from Apple. There are many features in the font, not yet exploited by the basic typescript.
\definetypeface [MyFace][rm][serif][hoefler][default][encoding=uc]
lucidagrande 
Very extensive Unicode and language support in this sans serif AAT font from Apple. Only Regular and Bold weights are available.
\definetypeface [MyFace][ss][sans][lucidagrande][default][encoding=uc]
gillsans & gillsanslt 
Although there are not many features in this classic humanist sans, it is available at three different font weights. gillsans offers regular and bold, and gillsanslt offers light as the \tf variant and regular as the \bf weight.
\definetypeface [MyFace][ss][sans][gillsanslt][default][encoding=uc]
optima 
Nothing special in this typescript, except that it defines an OptimaBlack synonym for your use.
\definetypeface [MyFace][ss][sans][optima][default][encoding=uc]
zapfino & applechancery 
These rich AAT fonts are defined as 'handwriting' and 'calligraphy' fonts, respectively. By using them as 'serif' fonts, however, you can use other variants through the \it, \bf, etc. alternatives.
\definetypeface [MyFace][hw][handwriting][zapfino][default][encoding=uc] % or
\definetypeface [MyFace][rm][serif]      [zapfino][default][encoding=uc]

Non-Apple fonts

A couple of typescripts to get you started with non-Apple fonts:

timesnewroman & arial 
MS Office 2004 updates these fonts with quite impressive Unicode coverage.
\definetypeface [MS][rm][serif][timesnewroman][default][encoding=uc]
\definetypeface [MS][ss][sans] [arial]        [default][encoding=uc]
gentium 
SIL also produce a very attractive Unicode font, Gentium, that is available in both regular and italic varieties.
\definetypeface [MyFace][rm][serif][gentium][default][encoding=uc]

Usage

Once you define your own typeface combination, you invoke it with the name you gave it (the first parameter in \definetypeface), in \setupbodyfont or \switchtobodyfont:

\setupbodyfont[MyFace, 11pt]

Creating your own typescripts

Other font specifications

Don't forget that you can use one-off font definitions for special uses with \definedfont, \startfont/\stopfont and the like:

\definedfont["Hoefler Text:mapping=tex-text;Style Options=Engraved Text;
              Letter Case=All Capitals;color=229966" at 24pt]
Big Title
\usetypescript[sans][optima][all]
\startfont[OptimaBlack sa 2]
Fat title
\stopfont

--Adam 02:39, 26 Nov 2004 (CET)