XeTeX output 2005.03.07:2246

advertisement
The fontspec package
Will Robertson
2005/03/07
v1.6
Abstract
This package provides functionality for selecting families of fonts with extended feature sets in XETEX-based LATEX in Mac OS X. \fontspec[!opts"]{!font"}
selects arbitrary fonts; \defaultromanfont sets the default for the whole document, with analogous commands for sans and mono. Other commands are
provided for the advanced selection of a large (and extensible) number of rich
font features.
Contents
1 Introduction
1.1 Usage
1.2 Warning
1.3 About this manual
2
2
2
2
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
4.14
2 Font selection
2.1 Default font families
2.2 Arbitrary bold/italic fonts
2.3 Font instances for efficiency
2
3
3
3 Selecting font features
3.1 Default settings
3.2 Changing the currently
selected features
4
4 5 Defining new features
12
5 6 fontspec in the future
14
4 Available font features
4.1 Different features for different font shapes
4.2 Font independent options
4.3 Ligatures
4.4 Letters
5 7 The code
7.1 User commands
6
7.2 Internal macros
6
7.3 keyval definitions
7
7.4 Italic small caps
7
7.5 Selecting maths fonts
15
16
18
24
36
37
4
1
Number Options
Swashes
Diacritics
Vertical position
Fractions
Character Alternates
Variants
Style Options
AAT font axes
OpenType scripts and
languages
8
8
8
9
9
10
11
11
11
11
1 Introduction
With the introduction of Jonathan Kew’s XETEX,1 Mac OS X users can now easily
access system-wide fonts directly in a TEX variant, providing a best of both worlds
environment. XETEX eliminates the need for all those files required for installing
fonts (.tfm, .vf, .map,…) and provides an easy way to select fonts in Plain TEX:
\font\zapf="Times New Roman" at 10pt.
However, it was still necessary to write cumbersome font definition files for
LATEX, since the NFSS had a lot more going on behind the scenes to allow easy
commands like \bfseries and \emph.
This package almost entirely eliminates this need by providing a completely
automatic way to select font families in LATEX for arbitrary fonts. Furthermore, it
allows (again, almost) total control over the selection of rich font features such
as number case and fancy ligatures present in many modern fonts provided with
Mac OS X.
1.1 Usage
There are no options for this package: simply call it in your preamble somewhere.
As of v1.6, it is necessary to explicitly request Ross Moore’s xunicode package if
you want access to use LATEX’s various methods for accessing extra characters and
accents (for example, \textbullet, \"u, \O, and so on).
This is highly recommended, since macros such as \% will otherwise give you
incorrect output. Note however that this will also break some characters in the
default Computer Modern fonts, but you’re not using XETEX to use them, are you!
\usepackage{fontspec,xunicode}
1.2 Warning
(→ An example warning!)
I still consider this package to be experimental, so I’m not ensuring backwards
compatibility at all costs. v1.6 has introduced some changes in font options. I don’t
want to weigh the package down with old ways of doing things, so unfortunately
this will mean that some old documents will need to be modified in order to
compile correctly again.
Such things, and some other comments, are noted in the margin like this (←),
with a red arrow if the change is relevant to the current release of the package.
1.3 About this manual
This document has been typeset with XETEX using a variety of fonts to display
various features that the package supports. Examples of AAT fonts are displayed
in a shade of blue, whereas OpenType examples (which are a little more scarce;
there will be more in the next version) are in red.
2 Font selection
\fontspec
\fontspec["font features#]{"font name#} is the base command of the package, used
1 http://scripts.sil.org/xetex
2
for selecting the specified "font name# (which is the Mac OS X display name of the
font) in a LATEX family. We shall look at font features later. As an example, look
how easy it is to select the Hoefler Text typeface:
\fontspec{Hoefler Text}
\shortpangram \\
{\itshape
\shortpangram}\\
{\scshape
\shortpangram}\\
{\itshape\scshape\shortpangram}\\
\bfseries
\shortpangram \\
{\itshape
\shortpangram}\\
{\scshape
\shortpangram}\\
{\scshape\itshape\shortpangram}\\
The five boxing wizards jump quickly.
The five boxing wizards jump quickly.
T"# $%&# '()%*+ ,%-./01 2345 63%789:.
T"# $%&# '()%*+ ,%-./01 2345 63%789:.
The five boxing wizards jump quickly.
The five boxing wizards jump quickly.
T"# $%&# '()%*+ ,%-./01 2345 63%789:.
T"# $%&# '()%*+ ,%-./01 2345 63%789:.
The fontspec package takes care of the necessary font definitions for those shapes
as shown above automatically. Furthermore, it is not necessary to install the font
for XETEX in any way whatsoever: every font that exists in one of Mac OS X’s font
folders may be accessed.
Note that this package redefines the \itshape and \scshape commands in
order to allow them to select italic small caps in conjunction.
2.1 Default font families
\setromanfont
\setsansfont
\setmonofont
The \setromanfont, \setsansfont, and \setmonofont commands are used to
select the default font families for the entire document. They take the same arguments as \fontspec. For example:
Pack my box with five dozen liquor jugs.
Pack my box with five dozen liquor jugs.
Pack my box with five dozen liquor jugs.
\setromanfont{Baskerville}
\setsansfont[Scale=0.86]{Skia Regular}
\setmonofont[Scale=0.8]{Monaco}
\rmfamily\pangram\par
\sffamily\pangram\par
\ttfamily\pangram
To match the families’ sizes, you should use the Scale option with trial and error
until the heights of the lowercase letters are equal. (Although there are more
factors involved, this can often give a reasonable result.)
Unlike \fontspec, these commands may also be used in the preamble. In fact,
they must be used there if you wish to set the default math fonts (e.g., \mathrm
et al.). The fontspec package must also be loaded after any maths-font–changing
packages (e.g., euler) for this to occur.
There are some warnings that get printed in this situation, but they don’t affect
the output (as far as I know). I don’t yet know enough about maths fonts to know
why this happens or how to prevent it.
2.2 Arbitrary bold/italic fonts
The automatic bold, italic, and bold italic font selections will not be adequate
for the needs of every font: while some fonts mayn’t even have bold or italic
shapes, others can have many to chose between.2 The BoldFont and ItalicFont
2 In the former case, a skilled (or lucky) designer may be able to chose well-matching accompanying
shapes from a different font altogether.
3
(→ These options used to be
called Bold and Italic, and these
shorter names may still be used
if you desire.)
options (←) are provided for these situations. If only one of these is used, the bold
italic font is requested as the default from the new font.
\fontspec[BoldFont={Helvetica Neue}]
{Helvetica Neue UltraLight}
Helvetica Neue UltraLight
\\
{\itshape
Helvetica Neue UltraLight Italic} \\
{\bfseries
Helvetica Neue
} \\
{\bfseries\itshape
Helvetica Neue Italic} \\
Helvetica Neue UltraLight
Helvetica Neue UltraLight Italic
Helvetica Neue
Helvetica Neue Italic
(→ Yes, BoldItalic also works)
If a bold italic shape is not defined, or you want to specify both custom bold and
italic shapes, the BoldItalicFont option is provided (←).
Optima
Optima Italic
Optima ExtraBlack
Optima ExtraBlack (italic?)
Optima Bold Italic
\fontspec[BoldFont={Optima ExtraBlack}]{Optima Regular}
Optima
\\
{\itshape
Optima Italic
}
\\
{\bfseries
Optima ExtraBlack
}
\\
{\bfseries\itshape Optima ExtraBlack (italic?) }
\\
\addfontfeature{BoldItalic={Optima Bold Italic}}
{\bfseries\itshape Optima Bold Italic
}
The \addfontfeature command is described in Section 3.2 on the following page.
(By rights, the \bfseries\itshape declaration should have resulted in an error
because the shape doesn’t exist. I don’t know why it doesn’t in this case.)
2.3 Font instances for efficiency
\newfontinstance
For cases when a specific font with a specific feature set is going to be re-used
many times in a document, it is inefficient to keep calling \fontspec for every
use. While the command does not define a new font instance after the first call,
the feature options must still be parsed and processed.
For this reason, instances of a font may be created with the \newfontinstance
command, as shown in the following example:
F(*; %*1;.*7#1 $(/
#$$%7%#*7:
\newfontinstance\secfont[Letters=SmallCaps]{Hoefler Text}
\secfont Font instances for efficiency
3 Selecting font features
The four commands discussed each take one optional argument for accessing the
features of the requested font. These features that are generally unavailable or
harder to access in regular LATEX. These options are described in Section 4 on the
next page. There are, however, two other commands which are used to choose
font features, and they must be introduced first.
3.1 Default settings
\defaultfontfeatures
It is possible to define options that are applied with every subsequent font selection command. This is done with the \defaultfontfeatures{"options#} command, with the desired options as for any other font call.
This command was used to automatically colour all of the examples in this
document. New calls of \defaultfontfeatures overwrite previous ones.
4
Some ‘defaulť Hoefler Text 0123456789
Now in green with lining figures:
?@ABCDEFGH
\fontspec{Hoefler Text}
Some `default' Hoefler Text 0123456789
\par
\defaultfontfeatures
{Numbers=Uppercase, Colour=009900}
\fontspec{Hoefler Text}
Now in green with lining figures: 0123456789
3.2 Changing the currently selected features
\addfontfeatures
The \addfontfeatures command allows font features to be changed without
knowing what features are currently selected or even what font is being used.
A good example of this could be to add a hook to all tabular material to have
monospaced numbers:
‘In 1842, 999 people sailed 97 miles in 13
boats. In 1923, 111 people sailed 54 miles in
56 boats.’
Year
People
Miles
Boats
1842
1923
999
111
75
54
13
56
\addfontfeature
\fontspec[Numbers=OldStyle]{Skia Regular}
`In 1842, 999 people sailed 97 miles in
13 boats. In 1923, 111 people sailed 54
miles in 56 boats.'
\vspace{3em}
\addfontfeatures{Numbers={Monospaced,Lining}}
\begin{tabular}{@{} cccc @{}}
\toprule Year & People & Miles & Boats \\
\midrule 1842 & 999
& 75
& 13
\\
1923 & 111
& 54
& 56
\\
\bottomrule
\end{tabular}
This command may also be executed under the alias \addfontfeature.
3.2.1 Priority
Features defined with \addfontfeatures override features specified by \fontspec, which in turn override features specified by \defaultfontfeatures. If in
doubt, whenever a new font is chosen for the first time, an entry is made in the
transcript (.log) file displaying the font name and the features requested.
4 Available font features
This section covers each and every font feature catered for by this package. Some
have been used already in examples for the font commands. There are too many
to list in this introduction, but for a first taste of what is available, here is an
example of the Apple Chancery typeface:
\fontspec[
Colour=CC00CC,
Numbers=OldStyle,
VerticalPosition=Ordinal,
Variant=2]{Apple Chancery}
\Large
My 1st example of\\ Apple Chancery
!y 1"# e$amp%e o&
'pp%e C(ancer)
5
4.1 Different features for different font shapes
It is entirely possible that separate fonts in a family will require separate options;
e.g., Hoefler Text Italic contains various swash options that are unavailable in the
upright shapes.
Using the Bold-, Italic-, and BoldItalicFeatures options, separate font
features may be added to those shapes. As an example, let’s colour each shape
differently:
\fontspec[
Numbers=Lining,
BoldFeatures={Colour=AA0000},
ItalicFeatures={Colour=008833},
BoldItalicFeatures={Colour=AA8833},
]{Hoefler Text}
0 -- Normal\par
{\itshape
1 -- Italic}\par
{\bfseries
2 -- Bold}\par
{\bfseries\itshape 3 -- Bold Italic}
? – Normal
; – Italic
; – Bold
; – Bold Italic
Combined with the options for selecting arbitrary fonts for the different shapes,
these separate feature options allow the selection of arbitrary weights in (at least)
the Skia typeface:
\fontspec[
BoldFont={Skia Regular},
BoldFeatures={Weight=2},
]{Skia Regular}
Skia Regular\par
{\bfseries Skia Regular `Bold'}\par
Skia Regular
Skia Regular ‘Bold’
4.2 Font independent options
These features may be used with any font. Scale takes a single numeric argument for scaling the font glyphs, and was demonstrated in Section 2.1 on page 3.
Mapping enables an XETEX text-mapping scheme.
\fontspec[Mapping=tex-text]{Cochin}
``!`A small amount of--- text!''
“¡A small amount of— text!”
Colour (or Color), also shown in Section 3.1 on page 4 and Section 4 on the
preceding page, uses XETEX font calls to set the colour of the font. The colour
is defined as a triplet of two-digit Hex RGB values, with optionally another value
for the transparency (where 00 is completely transparent and FF is opaque.)
WSPR
\fontsize{48}{48}
\fontspec{Hoefler Text Black}
{\addfontfeature{Color=FF000099}W}\kern-1ex
{\addfontfeature{Color=0000FF99}S}\kern-0.8ex
{\addfontfeature{Color=DDBB2299}P}\kern-0.8ex
{\addfontfeature{Color=00BB3399}R}
XETEX has more advanced colour management abilities, but they cannot be accessed through this package (yet, if at all).
6
4.3 Ligatures
Ligatures refer to the replacement of two separate characters with a specially
drawn glyph for functional or æsthetic reasons. For AAT fonts, you may choose
from any combination of Required, Common, Rare (or Discretionary), Logos, Rebus, Diphthong, Squared, AbbrevSquared, and Icelandic.
The first three are also supported in OpenType fonts, which may also use
Historical and Contextual. To turn a ligature option off, prefix its name with No:
e.g., NoDiphthong.
striK firefly
strict firefly
Rare: Ð Þ ð þ
Logos: 
Rebus: ‰
Diphthong: Æ Œ æ œ
\fontspec[Ligatures=Rare]{Hoefler Text}
\Large strict firefly \par
\fontspec[Ligatures=NoCommon]{Hoefler Text}
strict firefly\vspace{1em}
\fontspec
[Ligatures={Rare,Logos,Rebus,Diphthong}]
{Palatino} \large
Rare: Dh Th dh th
\par
Logos: apple
\par
Rebus: \%0
\par
Dipht\null hong: AE OE ae oe
Some other Apple AAT fonts have those ‘Rare’ ligatures contained in the
Icelandic feature. Notice also that the old TEX trick of splitting up a ligature
with an empty brace pair does not work in XETEX; you must use a 0 pt kern or
\hbox to split the characters up.
4.4 Letters
(→ This feature changed names
along with its options in v1.6,
breaking backwards
compatibility!)
The Letters feature (←) specifies how the letters in the current font will look. For
AAT fonts, you may choose from Normal, Uppercase, Lowercase, SmallCaps, and
InitialCaps.
THIS SENTENCE NO VERB.
this sentence no verb.
This Sentence No Verb.
\fontspec[Letters=Uppercase]{Palatino}
THIS Sentence no verb.
\par
\fontspec[Letters=Lowercase]{Palatino}
THIS Sentence no verb.
\par
\fontspec[Letters=InitialCaps]{Palatino}
THIS Sentence no verb.
OpenType fonts have some different options: SmallCaps, PetiteCaps, SMALLCAPS,
PETITECAPS, and Unicase. Petite caps are smaller than small caps. Mixed case
commands turn lowercase letters into the smaller caps letters, whereas uppercase
options turn the capital letters to the smaller caps (good, e.g., for applying to
already uppercase acronyms like ‘NASA’). Finally, unicase is a weird hybrid of
upper and lower case letters.
THIS SENTENCE ɴ ʀʙ.
ʜɪ ɴɴ no verb.
\fontspec[Letters=SmallCaps]{Warnock Pro}
THIS SENTENCE no verb.
\par
\fontspec[Letters=SMALLCAPS]{Warnock Pro}
THIS SENTENCE no verb.
7
4.5 Number Options
The Numbers feature defines how numbers will look in the selected font. For both
AAT and OpenType fonts, they may be a combination of Lining or OldStyle
and Proportional or Monospaced (the latter is good for tabular material). The
synonyms Uppercase and Lowercase are equivalent to Lining and OldStyle, respectively. The differences have been shown previously in Section 3.2 on page 5.
For OpenType fonts, there is also the SlashedZero option which replaces the
default zero with a slashed version to prevent confusion with an uppercase ‘O’ (I
presume).
0123456789 123456789
\fontspec[Numbers=Lining]{Warnock Pro}
0123456789
\fontspec[Numbers=SlashedZero]{Warnock Pro}
0123456789
4.6 Swashes
Swashes are fancy ornaments on letters. The options are WordInitial, WordFinal,
LineInitial, LineFinal, and Inner (also known as ‘non-final’). As non-exclusive
selectors, like the ligatures, you can turn them off by prefixing their name with
No.
=her> is a? th> @egemit>
‘Inner’ MwaNes can Aometimes
contain the archaic long s.
\fontspec
[Swashes={WordInitial,WordFinal}]
{Hoefler Text Italic}
where is all the vegemite
\bigskip
\fontspec[Swashes=Inner]{Hoefler Text}
`Inner' swashes can \emph{sometimes} \\
contain the archaic long~s.
For OpenType fonts, all but the LineInitial and Inner features are also supported in OpenType, and Contextual turns on contextual swashes.
Without Contextual Swashes
With Contextual Swashes; cf. W C S
\fontspec{Warnock Pro}\itshape
Without Contextual Swashes\par
\fontspec[Swashes=Contextual]{Warnock Pro}
With Contextual Swashes; cf. W C S
4.7 Diacritics
(→ Note that Hoefler Text has a
bug which means that diacritics
cannot be turned off at all!)
Diacritics refer to characters that are made up from multiple elements, for example, accented characters. You may either choose to Show, Hide or Decompose
them in AAT fonts. I would recommend using the proper TEX input conventions
for obtaining such characters instead.
Some fonts include O/ etc. as diacritics for writing Ø. I believe this to be a
mistake (they should be ligatures instead if anything), but we’re stuck with it
now. You’ll want to turn them off (imagine typing hello/goodbye and getting
‘helløgoodbye’ instead!) by decomposing the two characters in the diacritic into
the ones you actually want (←).
8
Ó Ö Ø
O´ O¨ O/
Better: Ó Ö Ø
\fontspec[Diacritics=Show]{Palatino}
O´ \quad O¨ \quad O/ \par
\fontspec[Diacritics=Decompose]{Palatino}
O´ \quad O¨ \quad O/ \par
Better: \'O \"O \O
The Hide option is for Arabic-like fonts which may be displayed either with or
without vowel markings.
No options for OpenType fonts.
4.8 Vertical position
Some subscript (Superior) and superscript (Inferior) numbers and letters (and
a small amount of punctuation, sometimes) are availabe in various fonts. The
Ordinal feature is (supposed to be) contextually sensitive to only raise characters
that appear directly after a number.
Normal /0123453 6789:6;:
1/< 2ⁿ> 33> 4<? 0<? 8ABC>2
\fontspec{Skia Regular}
Normal
\fontspec[VerticalPosition=Superior]{Skia Regular}
Superior
\fontspec[VerticalPosition=Inferior]{Skia Regular}
Inferior\\
\fontspec[VerticalPosition=Ordinal]{Skia Regular}
1st 2nd 3rd 4th 0th 8abcde
OpenType fonts also have the option ScientificInferior which extends further
below the baseline than Inferiors, as well as Numerator and Denominator for
creating arbitrary fractions (see next section). Beware, the Ordinal feature will
not work correctly for all OpenType fonts!
Sup ˡⁿʳˢ ⁽⁻¹²³⁴⁵⁶⁷⁾
Numerator 
Denominator 
Scientific Inferior ₁₂₃₄₅
‘Ordinals’ 1ˢt 2ⁿd 3ʳd 4h 0h
\fontspec[VerticalPosition=Superior]{Warnock Pro}
Sup abdehilmnorst (-\$12,345.67)
\fontspec[VerticalPosition=Numerator]{Warnock Pro}
Numerator 12345
\fontspec[VerticalPosition=Denominator]{Warnock Pro}
Denominator 12345
\fontspec[VerticalPosition=ScientificInferior]{Warnock Pro}
Scientific~Inferior 12345
\fontspec[VerticalPosition=Ordinal]{Warnock Pro}
`Ordinals' 1st 2nd 3rd 4th 0th
4.9 Fractions
This feature works with both AAT and OpenType fonts, with some differences,
to create ‘vulgar’ fractions.
In AAT fonts, the ‘fraction slash’ or solidus character, which may be obtained
by typing OPT SHIFT 1, is (supposed) to be used to create fractions. If the Fractions feature is used, then (supposedly) only pre-drawn fractions will be used.
Using DiagonalFractions (AAT only), the font will attempt to create the fraction from superscript and subscript characters. This is shown in the following
example by Hoefler Text, whose font support may not be turned off.
9
\fontspec{Hoefler Text}
13579⁄24680 (fraction slash) \par
\quad 13579/24680 (regular slash) \bigskip
OPQRS⁄TUVWX (fraction slash)
13579/24680 (regular slash)
½ 5⁄6 (fraction slash)
1/2 5/6 (regular slash)
\fontspec[Fractions]{Palatino}
½ \quad 5⁄6 (fraction slash)
\par
1/2 \quad 5/6 (regular slash)
It appears that my ‘verbatim’ font is actually also applying these rules. How irritating. OpenType fonts simply use a regular text slash to create fractions:
1/2
½
1/4 5/6 13579/24680
¼ 5/6 13579/24680
\fontspec{Warnock Pro}
1/2 \quad 1/4 \quad 5/6 \quad 13579/24680\par
\fontspec[Fractions]{Warnock Pro}
1/2 \quad 1/4 \quad 5/6 \quad 13579/24680\par
In both AAT and OpenType fonts, NoFractions turns off such fractions.
You may wish to use a command like the following to build arbitrary vulgar
fractions in fonts with numerator and denominator glyphs if the font doesn’t support it explicitly: (it is not necessary considered good form to use such fractions)
There’s a reason they’re
called ‘vulgar’! ⁄
\newcommand*\vulgarfraction[2]{%
{\addfontfeature{VerticalPosition=Numerator}#1}%
\textfractionsolidus
{\addfontfeature{VerticalPosition=Denominator}#2}}
\fontspec{Warnock Pro} There's a reason they're called `vulgar'!
\vulgarfraction{13579}{24680}
(Requires the xunicode package for \textfractionsolidus; also note that \vulgarfraction is not provided by fontspec.)
4.10 Character Alternates
Alternates are tricky, because there’s no definition for what they can be. This
is where the swashes are in Hoefler Text, but you can’t guarantee that this is
where they’ll always be or that they’ll use the same number. So unfortunately
selection of Character Alternates must be done numerically on a per font basis
(although Section 5 on page 12 may help a little in this regard).
Sphinx Of Black Quartz, J30+# M: V(,
Bphinx Cf Dlack Quartz, J30+# E: F(,
\fontspec[Alternate=0]{Hoefler Text Italic}
Sphinx Of Black Quartz, {\scshape Judge My Vow}
\fontspec[Alternate=1]{Hoefler Text Italic}
Sphinx Of Black Quartz, {\scshape Judge My Vow}
For an OpenType font, any assignment of the alternates will turn on stylistic alternates (OpenType feature +salt).
\fontspec{Warnock Pro}\large
K Q R k v w y\par
\fontspec[Alternate=1]{Warnock Pro}
K Q R k v w y
KQRkvwy
KQRkvwy
10
4.11 Variants
The Variant feature takes a single numberical input for choosing different alphabetic shapes. Don’t mind my fancy example :) I’m just looping through the nine
( ! ) variants of Zapfino.
d!"#$%&'(
\Huge
\newcounter{var}\newcounter{trans}
\raisebox{0pt}[\height][0pt]{%
\whiledo{\value{var}<9}{%
\stepcounter{trans}%
\fontspec[Variant=\thevar,
Colour=005599\thetrans\thetrans]{Zapfino}%
\makebox[0.75\width]{d}%
\stepcounter{var}}}
For OpenType fonts, Variant selects a Stylistic Set, specified numerically between
one and twenty. I don’t have a font to demonstrate this feature with, unfortunately.
4.12 Style Options
Style options are defined in AAT as one of the following: Display, Engraved,
IlluminatedCaps, TitlingCaps (supported by OpenType), or TallCaps. I only
wish I had a font that could demonstrate them all.
[\]^_`abcdefgh
ijklmnopqrstuv
\fontspec[StyleOptions=Engraved]{Hoefler Text}
[ABCDEFGHIJKLM
\hfill\null\par\hfill
NOPQRSTUVWXYZ]
4.13 AAT font axes
Weight and Width are continuous font parameter axes like you used to be able to
find in Multiple Master fonts. The only font I know of which supports these is
Skia. Luckily it comes with Mac OS X!
Really light and extended Skia
Really fat and condensed Skia
\fontspec[Weight=0.5,Width=3]{Skia Regular}
Really light and extended Skia
\par
\fontspec[Weight=2,Width=0.5]{Skia Regular}
Really fat and condensed Skia
4.14 OpenType scripts and languages
When dealing with fonts that include glyphs for various languages, they may
contain different font features for the different character sets and languages it
supports. These may be selected with the Script and Language features. The
possible options are tabulated in Table 1 on the next page and Table 2 on page 13,
respectively. Note however that very few fonts even take some of these options
into account, so most of them are included only for completeness.
In the following example, the same font is used to typeset the verbatim input
and the XETEX output. Because the Script is only specified for the output, the text
is rendered incorrectly in the verbatim input. Many thanks to Jonathan Kew, Yves
Codet and Gildas Hamel for their contributions towards this example.
11
얎씭않앨앻씩
‫ٽځ‬뾯٪‫ڂ‬
‫ھۘۦ‬
‫މݾݽ‬쁢‫މݶ‬-‫ݸݶޑނݸފ ݥݪލޅ‬
ࣻऀघऀएऒࣲ ࣼऌंࣾं쪳
‫ܺܚܴ ܦܸܷܗܺܜ ܺܚܴ ܦܸ܌‬
ࠇ뽙ࠑࠢ ࠝࠇ뼹
쐬쐽
ӼԀ ԋӴ ԠӸ
Arabic
Armenian
Balinese
Bengali
Bopomofo
Braille
Buginese
Buhid
Byzantine Music
Canadian Syllabics
Cherokee
CJK Ideographic
Coptic
Cypriot Syllabary
Cyrillic
Default
Deseret
Devanagari
Ethiopic
Georgian
Glagolitic
Gothic
Greek
Gujarati
Gurmukhi
Hangul Jamo
Hangul
Hanunoo
Hebrew
Hiragana
Katakana
Japanese
Javanese
Kannada
Kharosthi
Khmer
Lao
Latin
\fontspec[Script=Arabic]{Code2000}
ՏԲԻՃՉԱ
\par\bigskip
\fontspec[Script=Devanagari]{Code2000}
‫ځٽ‬٬‫ڏ‬٪‫ڂ‬
\par\bigskip
\fontspec[Script=Bengali]{Code2000}
ۘ‫ھۦ‬
\par\bigskip
\fontspec[Script=Gujarati]{Code2000}
‫މݶމݾޖݿݽ‬-‫ݸݶޑނފݸ ݥݪލޅ‬
\par\bigskip
\fontspec[Script=Malayalam]{Code2000}
ࣻऀघऀएࣲऒ ࣼऌंࣾंघँ
\par\bigskip
\fontspec[Script=Gurmukhi]{Code2000}
‫ܺܚܴ ܸܦܷܗܺܜ ܺܚܴ ܸܦ܌‬
\par\bigskip
\fontspec[Script=Tamil]{Code2000}
ࠇࠋ࠘ࠑࠢ ࠇࠝࠅ࠘
\par\bigskip
\fontspec[Script=Hebrew]{Code2000}
ӿԌԀӼӿԢӴԋӸԠ
Limbu
Linear B
Malayalam
Math
Maths
Mongolian
Musical Symbols
Myanmar
N’ko
Ogham
Old Italic
Old Persian Cuneiform
Oriya
Osmanya
Phags-pa
Phoenician
Runic
Shavian
Sinhala
Sumero-Akkadian Cuneiform
Syloti Nagri
Syriac
Tagalog
Tagbanwa
Tai Le
Tai Lu
Tamil
Telugu
Thaana
Thai
Tibetan
Tifinagh
Ugaritic Cuneiform
Yi
Table 1: Defined Scripts for OpenType fonts.
5 Defining new features
\newfontfeature
This package cannot hope to contain every possible font feature. Two commands
are provided for selecting features that have are not available out of the box. If
you are using them a lot, chances are I’ve left something out, so please let me
know.
\newfontfeature{"tag#}{"feature string#} takes two arguments: "tag# is the
name to reference the new feature by when selecting it in your font; and "feature
string# the string that activates the particular font feature. For example, Zapfino
contains a non-standard feature ‘Avoid d-collisions’. To access it with this package, you could do the following:
12
Abaza
Abkhazian
Adyghe
Afrikaans
Afar
Agaw
Altai
Amharic
Arabic
Aari
Arakanese
Assamese
Athapaskan
Avar
Awadhi
Aymara
Azeri
Badaga
Baghelkhandi
Balkar
Baule
Berber
Bench
Bible Cree
Belarussian
Bemba
Bengali
Bulgarian
Bhili
Bhojpuri
Bikol
Bilen
Blackfoot
Balochi
Balante
Balti
Bambara
Bamileke
Breton
Brahui
Braj Bhasha
Burmese
Bashkir
Beti
Catalan
Cebuano
Chechen
Chaha Gurage
Chattisgarhi
Chichewa
Chukchi
Chipewyan
Cherokee
Chuvash
Comorian
Coptic
Cree
Carrier
Crimean Tatar
Church Slavonic
Czech
Danish
Dargwa
Woods Cree
German
Default
Dogri
Divehi
Djerma
Dangme
Dinka
Dungan
Dzongkha
Ebira
Eastern Cree
Edo
Efik
Greek
English
Erzya
Spanish
Estonian
Basque
Evenki
Even
Ewe
French Antillean
Farsi
Finnish
Fijian
Flemish
Forest Nenets
Fon
Faroese
French
Frisian
Friulian
Futa
Fulani
Ga
Gaelic
Gagauz
Galician
Garshuni
Garhwali
Ge’ez
Gilyak
Gumuz
Gondi
Greenlandic
Garo
Guarani
Gujarati
Haitian
Halam
Harauti
Hausa
Hawaiin
Hammer-Banna
Hiligaynon
Hindi
High Mari
Hindko
Ho
Harari
Croatian
Hungarian
Armenian
Igbo
Ijo
Ilokano
Indonesian
Ingush
Inuktitut
Irish
Irish Traditional
Icelandic
Inari Sami
Italian
Hebrew
Javanese
Yiddish
Japanese
Judezmo
Jula
Kabardian
Kachchi
Kalenjin
Kannada
Karachay
Georgian
Kazakh
Kebena
Khutsuri Georgian
Khakass
Khanty-Kazim
Khmer
Khanty-Shurishkar
Khanty-Vakhi
Khowar
Kikuyu
Kirghiz
Kisii
Kokni
Kalmyk
Kamba
Kumaoni
Komo
Komso
Kanuri
Kodagu
Korean Old Hangul
Konkani
Kikongo
Komi-Permyak
Korean
Komi-Zyrian
Kpelle
Krio
Karakalpak
Karelian
Karaim
Karen
Koorete
Kashmiri
Khasi
Kildin Sami
Kui
Kulvi
Kumyk
Kurdish
Kurukh
Kuy
Koryak
Ladin
Lahuli
Lak
Lambani
Lao
Latin
Laz
L-Cree
Ladakhi
Lezgi
Lingala
Low Mari
Limbu
Lomwe
Lower Sorbian
Lule Sami
Lithuanian
Luba
Luganda
Luhya
Luo
Latvian
Majang
Makua
Malayalam Traditional
Mansi
Marathi
Marwari
Mbundu
Manchu
Moose Cree
Mende
Me’en
Mizo
Macedonian
Male
Malagasy
Malinke
Malayalam Reformed
Malay
Mandinka
Mongolian
Manipuri
Maninka
Manx Gaelic
Moksha
Moldavian
Mon
Moroccan
Maori
Maithili
Maltese
Mundari
Naga-Assamese
Nanai
Naskapi
N-Cree
Ndebele
Ndonga
Nepali
Newari
Nagari
Norway House Cree
Nisi
Niuean
Nkole
N’ko
Dutch
Nogai
Norwegian
Northern Sami
Northern Tai
Esperanto
Nynorsk
Oji-Cree
Ojibway
Oriya
Oromo
Ossetian
Palestinian Aramaic
Pali
Punjabi
Palpa
Pashto
Polytonic Greek
Pilipino
Palaung
Polish
Provencal
Portuguese
Chin
Rajasthani
R-Cree
Russian Buriat
Riang
Rhaeto-Romanic
Romanian
Romany
Rusyn
Ruanda
Russian
Sadri
Sanskrit
Santali
Sayisi
Sekota
Selkup
Sango
Shan
Sibe
Sidamo
Silte Gurage
Skolt Sami
Slovak
Slavey
Slovenian
Somali
Samoan
Sena
Sindhi
Sinhalese
Soninke
Sodo Gurage
Sotho
Albanian
Serbian
Saraiki
Serer
South Slavey
Southern Sami
Suri
Svan
Swedish
Swadaya Aramaic
Swahili
Swazi
Sutu
Syriac
Tabasaran
Tajiki
Tamil
Tatar
TH-Cree
Telugu
Tongan
Tigre
Tigrinya
Thai
Tahitian
Tibetan
Turkmen
Temne
Tswana
Tundra Nenets
Tonga
Todo
Turkish
Tsonga
Turoyo Aramaic
Tulu
Tuvin
Twi
Udmurt
Ukrainian
Urdu
Upper Sorbian
Uyghur
Uzbek
Venda
Vietnamese
Wa
Wagdi
West-Cree
Welsh
Wolof
Tai Lue
Xhosa
Yakut
Yoruba
Y-Cree
Yi Classic
Yi Modern
Chinese Hong Kong
Chinese Phonetic
Chinese Simplified
Chinese Traditional
Zande
Zulu
Table 2: Defined Languages for OpenType fonts. Note that they are sorted in alphabetical not by name but by OpenType tag (which you don’t need to know,
now).
13
)*+,d*-./0 012d*3
)*+,!*-./0 012!*3
\newfeaturecode
\newfontfeature{AvoidD}{Special=Avoid d-collisions}
\newfontfeature{NoAvoidD}{Special=!Avoid d-collisions}
\fontspec[AvoidD,Variant=1]{Zapfino}
sockdolager rubdown \par
\fontspec[NoAvoidD,Variant=1]{Zapfino}
sockdolager rubdown
Of course, you may perform similar operations with OpenType features, e.g.,
\newfontfeature{OTSwash}{+swsh} to activate swash forms.
\newfeaturecode{"tag#}{"feature number#}{"selector number#} performs the
same function as the last macro, but instead of using a string, it takes two arguments to define the "feature number# and "selector number# of the feature. It works
only for AAT fonts. There is no mechanism yet for the package to help inform
you what codes are available for a specific font, sorry.
\newfeaturecode{Swash}{17}{1}
\fontspec[Swash]{Hoefler Text Italic}
This is XeTeX by Jonathan Kew.
Gis is HeIeH by Jonathan Jew.
6 fontspec in the future
This package is still under development, so there are some features I mean to
include that haven’t yet made it. It also serves as my to-do list :)
1. If/when XETEX allows it, I’d like to be able to automatically scale fonts to
match their x-heights. At present this is not possible, however.
2. Support for fonts with a range of optical sizes.
3. I’d like to build in a mechanism in the package that can inform the user
what font features are available for a requested font.
4. Far off into the future: can fonts with Greek letters be used for ad-hoc maths
fonts? (Probably not, but worth investigation.)
Change History
v1.0
General: Initial version.
v1.1
General: Name change to fontspec.
\setromanfont: Implemented (with friends).
v1.2
General: Initial OpenType support.
v1.3
General: More OpenType support.
\defaultfontfeatures: Implemented.
\newfeaturecode: Implemented.
\newfontfeature: Implemented.
v1.3a
General: Bug fix for OpenType small caps.
14
1
1
16
1
1
17
18
18
34
v1.4
General: Support for Weight and Width AAT features.
25
\AtBeginDocument: Selects the default \mathXX fonts.
37
\defaultfontfeatures: Name changed from \setdefaultoptions.
17
v1.5
General: New options for arbitrary bold/italic shapes.
24
\addfontfeatures: Implemented.
17
\ifEqFonts: Added check for empty font.
23
\zf@fontspec: Added code for choosing arbitrary bold/italic fonts.
19
Checks if the font family has already been defined.
19
NFSS specifiers now take the default values.
19
\zf@make@font@shapes: Absorbed font-checking from \zf@fontspec 20
v1.5a
\AtBeginDocument: Added fix for Computer Modern maths.
37
v1.6
General: Bold option aliased to BoldFont
24
LetterCase is now Letters and options changed appropriately.
34
All AAT Fractions features offered.
36
Feature selection code uses more keyval.
24
New OpenType feature: Language
25
New OpenType feature: Script
25
OpenType letters features: PetiteCaps and PETITECAPS.
34
OpenType ligature features: Contextual and Historical.
34
OpenType stylistic sets supports under the Variant option.
36
\addfontfeatures: Removed \relaxing of temporary macros.
17
\AtBeginDocument: Removed mathtime support since XeTeX doesn’t
handle virtual fonts. Why did I put it in in the first place?
37
\fontspec: Removed \zf@currfont (don’t think it’s necessary)
16
\ifEqStr: Removed entirely from code. keyval \setkeys used instead. 23
\newfontfeature: newff counter now uses LaTeX methods rather than
primitive TeX. I don’t know if there is any advantage to this.
18
\newfontinstance: Implemented.
17
\setromanfont: Changed \..default assigning to use \let
16
\zf@fontspec: Added code for choosing arbitrary bold/italic font features.
19
Writes some info to the .log file
19
\zf@get@feature@requests: Removed the space between the comma
and \zf@options when it’s concatenated with the defaults. This fixes that
bug in the big Apple Chancery example.
21
7 The code
Herein lies the implementation details of this package. Welcome! It’s my first.
For some reason, I decided to prefix all the package internal command names
and variables with zf. I don’t know why I chose those letters, but I guess I just
liked the look/feel of the letters together at the time.
1 !∗fontspec"
Only proceed if it is XETEX that is doing the typesetting.
2 \expandafter\ifx\csname XeTeXversion\endcsname\relax
3
4
\@latex@error{^^J
*************************************************^^J
15
*** Sorry!
^^J
*** The fontspec package only works with XeTeX. ^^J
*************************************************^^J
}
5
6
7
8
9 \fi
While the business of encoding names is up in the air, I’ll continue to use the U
encoding.
10 \def\zf@enc{U}
11 %\RequirePackage[\zf@enc]{fontenc}
12 \renewcommand\encodingdefault{\zf@enc}
\define@key
\setkeys
The keyval package makes processing comma separated inputs very simple with
the \define@key and \setkeys commands:
— \define@key{"family#}{"option#}{"commands to process#}
— \setkeys{"family#}{"input list#}
\define@key is used to define each "option#, grouped by "family#, each of which
executes its "commands to process# when it is included in an "input list# in a call to
\setkeys.
13 \RequirePackage{keyval}
7.1 User commands
This section contains the definitions of the commands detailed in the user documentation. Only the ‘top level’ definitions of the commands are contained herein;
they all use or define macros which are defined or used later on in Section 7.2 on
page 18.
7.1.1 Font selection
\fontspec
This is the main command of the package that selects fonts with various features.
It takes two arguments: the Mac OS X font name and the optional requested features of that font. It simply runs \zf@fontspec, which takes the same arguments
as the top level macro and puts the new-fangled font family name into the global
\zf@family. Then this new font family is selected.
14 \newcommand*\fontspec[2][]{%
15
16
\setromanfont
\setsansfont
\setmonofont
\zf@fontspec[#1]{#2}%
\fontfamily\zf@family\selectfont}
The following three macros perform equivalent operations setting the default
font (using \let rather than \renewcommand because \zf@family will change in
the future) for a particular family: roman, sans serif, or typewriter (monospaced).
I end them with \normalfont so that if they’re used in the document, the change
registers immediately.
17 \newcommand*\setromanfont[2][]{%
\zf@fontspec[#1]{#2}%
\let\rmdefault\zf@family
20
\normalfont}
21 \newcommand*\setsansfont[2][]{%
18
19
16
\zf@fontspec[#1]{#2}%
\let\sfdefault\zf@family
24
\normalfont}
25 \newcommand*\setmonofont[2][]{%
26
\zf@fontspec[#1]{#2}%
27
\let\ttdefault\zf@family
28
\normalfont}
22
23
\newfontinstance
This macro takes the arguments of \fontspec with a prepended "instance
cmd# (code for middle optional argument generated by Scott Pakin’s newcommand.py). This command is used when a specific font instance needs to be referred
to repetitively (e.g., in a section heading) since continuously calling \zf@fontspec
is inefficient because it must parse the option arguments every time.
\zf@fontspec defines a font family and saves its name in \zf@family. So
then this value is expanded in a temporary macro also containing the unexpanded
commands to later select the font family to which it refers. Finally, the requested
name for the font instance is \leted from the temporary macro.
29 \newcommand\newfontinstance[1]{%
30
\@ifnextchar[{\newfontinstance@i#1}{\newfontinstance@i#1[]}}
31 \def\newfontinstance@i#1[#2]#3{%
32
33
34
\zf@fontspec[#2]{#3}%
\edef\zf@tempinst{\noexpand\fontfamily{\zf@family}\noexpand\selectfont}%
\let#1\zf@tempinst}
7.1.2 Font feature selection
\defaultfontfeatures
\zf@default@options
This macro takes one argument that consists of all of feature options that will
be applied by default to all subsequent \fontspec, et al., commands. It stores its
value in \zf@default@options (initialised empty), which is concatenated with
the individual macro choices in the \zf@get@feature@requests macro.
35 \newcommand*\defaultfontfeatures[1]{\def\zf@default@options{#1}}
36 \let\zf@default@options\@empty
\addfontfeatures
In order to be able to extend the feature selection of a given font, two things need
to be known: the currently selected features, and the currently selected font. Every
time a font family is creating, this information is saved inside a control sequence
with the name of the font family itself.
This macro extracts this information, then appends the requested font features
to add to the already existing ones, and calls the font again with the top level
\fontspec command.
The default options are not applied (which is why they’re saved and restored
with \zf@default@options@old), so this means that the only added features to
the font are strictly those specified by this command.
\addfontfeature is defined as an alias, as I found that I often typed this instead when adding only a single font feature.
37 \newcommand*\addfontfeatures[1]{%
38
39
40
41
\let\zf@default@options@old\zf@default@options
\let\zf@default@options\@empty
\edef\zf@thisinfo{\csname\f@family\endcsname}%
\fontspec
17
[\expandafter\@firstoftwo\zf@thisinfo, #1]%
{\expandafter\@secondoftwo\zf@thisinfo}%
44
\let\zf@default@options\zf@default@options@old}
45 \let\addfontfeature\addfontfeatures
42
43
7.1.3 Defining new font features
\newfontfeature
\newfontfeature takes two arguments: the name of the feature tag by which to
reference it, and the string that is used to select the font feature. It uses a counter
to keep track of the number of new features introduced; every time a new feature
is defined, a control sequence is defined made up of the concatenation of +zfand the new feature tag. This long-winded control sequence is then called upon
to update the font family string when a new instance is requested.
46 \newcounter{newff}
47 \newcommand*\newfontfeature[2]{%
48
49
50
51
52
\newfeaturecode
\stepcounter{newff}%
\expandafter\edef\csname +zf-#1\endcsname{+zf-\thenewff}%
\define@key{zf}{#1}[true]{%
\zf@update@family{\csname +zf-#1\endcsname}%
\zf@update@ff{#2}}}
This is similar to above, but simply defines a new AAT feature code (second two
arguments) with a new name (first argument). Maybe I should just give users
access to the \zf@make@feature command?
53 \newcommand*\newfeaturecode[3]{%
54
\define@key{zf}{#1}[true]{\zf@make@feature{#2}{#3}{}}}
7.2 Internal macros
\zf@fontspec
This is the command that defines font families for use. Given a list of font features for a requested font (#1, which is later set in \zf@macname globally for the
\zf@set@font@type and \zf@make@aat@feature@string macros), it will define
an NFSS family for that font and put the family name into \zf@family.
Then we check with \zf@set@font@type whether the font is AAT or OpenType, and convert the requested features to font definition strings. This is performed with \zf@get@feature@requests, in which \setkeys retrieves the requested font features and processes them. To build up the complex family name,
it concatenates each font feature with the family name of the font. So since
\setkeys is run more than once (since different font faces may have different
feature names), we only want the complex family name to be built up once, hence
the zf@firsttime conditionals.
55 \newcommand*\zf@fontspec[2][]{%
56
57
58
59
60
61
62
\edef\zf@options{#1}%
\edef\zf@macname{#2}%
\edef\zf@family{\zap@space #2 \@empty}%
\zf@set@font@type{#2}%
\zf@firsttimetrue
\zf@get@feature@requests
\zf@firsttimefalse
18
Now that we have the complex family name, we can check to see if the family has
already been defined, and if not, do so. Once the family name is created, save in
it the user string of the requested options and font name for use with \addfontfeatures (this info is separately braced for easy extraction with the \@first- and
\@secondoftwo commands).
63
64
65
66
67
\expandafter\ifx\csname\zf@family\endcsname\relax
\wlog{fontspec: Defining font family for "#2"
with options [\zf@current@options]}%
\edef\zf@info{{\zf@current@options}{#2}}%
\expandafter\let\csname\zf@family\endcsname\zf@info
Now the font family and its shapes are defined in the NFSS.
All NFSS specifications take their default values, so if any of them are redefined, the shapes will be selected to fit in with the current state. For example, if
\bfdefault is redefined to b, all bold shapes defined by this package will also be
assigned to b.
The strings \zf@bf, et al., are used to store the name of the custom bold, et al.,
font, if requested as user options. If they are empty, the default bold, et al., fonts
are used.
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
\DeclareFontFamily{\zf@enc}{\zf@family}{}%
\zf@make@font@shapes{#2}{\mddefault}{\updefault}%
% BOLD
\let\zf@options@old\zf@options
\def\zf@options{\zf@options@old,\zf@bf@options}%
\ifx\zf@bf\@empty
\zf@make@font@shapes[#2]{#2/B}{\bfdefault}{\updefault}%
\else
\zf@make@font@shapes{\zf@bf}{\bfdefault}{\updefault}%
\fi
\let\zf@options\zf@options@old
% ITALIC
\let\zf@options@old\zf@options
\def\zf@options{\zf@options@old,\zf@it@options}%
\ifx\zf@it\@empty
\zf@make@font@shapes[#2]{#2/I}{\mddefault}{\itdefault}%
\else
\zf@make@font@shapes{\zf@it}{\mddefault}{\itdefault}%
\fi
\let\zf@options\zf@options@old
If requested, the custom fonts take precedence when choosing the bold italic font.
When both italic and bold fonts are requested and the bold italic font hasn’t been
explicitly specified (a rare occurance, presumably), the new bold font is used to
define the new bold italic font.
88
89
90
91
92
93
94
\let\zf@options@old\zf@options
\def\zf@options{\zf@options@old,\zf@bfit@options}%
\ifx\zf@bfit\@empty
\ifx\zf@bf\@empty
\ifx\zf@it\@empty
\zf@make@font@shapes[#2]{#2/BI}{\bfdefault}{\itdefault}%
\else
19
95
96
97
98
99
100
101
102
103
104
\zf@make@font@shapes{\zf@it/B}{\bfdefault}{\itdefault}%
\fi
\else
\zf@make@font@shapes{\zf@bf/I}{\bfdefault}{\itdefault}%
\fi
\else
\zf@make@font@shapes{\zf@bfit}{\bfdefault}{\itdefault}%
\fi
\let\zf@options\zf@options@old
\fi}
7.2.1 Fonts
\zf@set@font@type
This macro sets zf@aat or zf@opentype booleans accordingly depending if the
font in \zf@macname is an AAT font or an OpenType font, respectively.
105 \newcommand*\zf@set@font@type[1]{%
\zf@aatfalse
\zf@opentypefalse
108
\font\zf@testfont = "#1" at 10pt
109
\count255 = \XeTeXcountfeatures\zf@testfont
110
\ifnum\count255 > 0
111
\zf@aattrue
112
\zf@opentypefalse
113
\else
114
\count255 = \XeTeXOTcountscripts\zf@testfont
115
\ifnum\count255 > 0
116
\zf@opentypetrue
117
\zf@aatfalse
118
\fi
119
\fi}
120 \newif\ifzf@aat
121 \newif\ifzf@opentype
106
107
\zf@make@font@shapes
This macro uses \DeclareFontShape to define the font shape in question. It is
necessary to wrap the whole thing in \nfss@catcodes so that the scale factor
works. This necessitates \globaldefs=1 so the macro is visible to the rest of the
package. The mandatory arguments are: the font name, the font series, and the
font shape. The optional argument checks against the font name and doesn’t
proceed with the macro if they are equal.
122 \begingroup
123
124
125
126
127
128
129
130
131
132
133
\nfss@catcodes
\globaldefs=1
\newcommand*\zf@make@font@shapes[4][]{%
\ifEqFonts{#1}{#2}\then\else
\edef\zf@macname{#2}%
\zf@get@feature@requests
\ifx\zf@scale\@empty
\let\zf@scale@str\@empty
\else
\edef\zf@scale@str{s*[\zf@scale]}%
\fi
20
134
135
\DeclareFontShape{\zf@enc}{\zf@family}{#3}{#4}%
{<-> \zf@scale@str "#2:\zf@ff"}{}%
Next, the small caps are defined. \zf@test@smallcaps is used to define the appropriate string for activating small caps in the font, if they exist. If we are defining
small caps for the upright shape, then the small caps shape default is used. For
an italic font, however, the shape parameter is overloaded and we must call italic
small caps by their own identifier. See Section 7.4 on page 36 for the code that
enables this usage.
\zf@test@smallcaps
\ifx\zf@smallcaps\@empty\else
138
\ifx #4\updefault
139
\edef\zf@scshape{\scdefault}%
140
\fi
141
\ifx #4\itdefault
142
\edef\zf@scshape{\sidefault}%
143
\fi
144
\DeclareFontShape
145
{\zf@enc}{\zf@family}{#3}{\zf@scshape}%
146
{<-> \zf@scale@str "#2:\zf@ff\zf@smallcaps"}{}%
147
\fi
148
\fi}
149 \endgroup
136
137
\zf@update@family
This macro is used to build up a complex family name based on its features. It
basically concatenates the family name with a string of lower case letters which
uniquely denote its features.
\zf@firsttime is set true in \zf@fontspec only the first time \f@get@feature@requests
is called, so that the family name is only created once.
150 \newcommand*{\zf@update@family}[1]{%
\ifzf@firsttime
\let\zf@family@old\zf@family
153
\xdef\zf@family{\zf@family@old #1}%
154
\fi}
155 \newif\ifzf@firsttime
151
152
7.2.2 Features
\zf@get@feature@requests
This macro is a wrapper for \setkeys which expands and adds a default specification to the original passed options. It begins by initialising the commands used
to hold font-feature specific strings.
156 \newcommand*\zf@get@feature@requests{%
157
158
159
160
161
162
163
164
165
\ifzf@firsttime
\let\zf@scale\@empty
\let\zf@bf
\@empty
\let\zf@it
\@empty
\let\zf@bfit \@empty
\let\zf@bf@options \@empty
\let\zf@it@options \@empty
\let\zf@bfit@options\@empty
\fi
21
166
167
168
169
170
171
172
173
174
\zf@test@smallcaps
\let\zf@ff\@empty
\ifx\zf@default@options\@empty
\edef\zf@current@options{\zf@options}%
\else
\edef\zf@current@options{\zf@default@options,\zf@options}%
\fi
\edef\zf@process@options
{\noexpand\setkeys{zf}{\zf@current@options}}%
\zf@process@options}
This macro checks if the font contains small caps, and if so creates the string for
accessing them in \zf@smallcaps. The OpenType portion of this macro has been
adapted/stolen from Jonathan Kew’s osxfonts.sty package.
175 \newcommand*\zf@test@smallcaps{%
\let\zf@smallcaps\@empty
\ifzf@aat
178
\zf@make@aat@feature@string{3}{3}{zf@smallcaps@string}%
179
\ifx\zf@smallcaps@string\@empty\else
180
\edef\zf@smallcaps{\zf@smallcaps@string;}%
181
\fi
182
\fi
183
\ifzf@opentype
184
\font\zf@testfont="\zf@macname" at 10pt
185
\count255 = \XeTeXOTcountscripts\zf@testfont
186
\ifnum\count255 > 0
187
\count255 = 0
188
\zf@featurecount = \XeTeXOTcountfeatures\zf@testfont "6C61746E "0
189
\loop\ifnum\count255 < \zf@featurecount
190
\ifnum\XeTeXOTfeaturetag\zf@testfont "6C61746E "0
191
\count255 = "736D6370 % 'smcp'
192
\edef\zf@smallcaps{+smcp,}%
193
\count255 = \zf@featurecount
194
\else
195
\advance\count255 by 1
196
\fi
197
\repeat
198
\fi
199
\fi}
200 \newcount\zf@featurecount
176
177
\zf@update@ff
\zf@ff is the string used to define the list of specific font features. Each time
another font feature is requested, this macro is used to add that feature to the list.
AAT features are separated by semicolons, OpenType features by commas.
201 \newcommand*{\zf@update@ff}[1]{%
202
203
204
205
206
207
208
209
\begingroup
\let\zf@ff@old\zf@ff
\ifzf@aat
\xdef\zf@ff{\zf@ff@old #1;}%
\fi
\ifzf@opentype
\xdef\zf@ff{\zf@ff@old #1,}%
\fi
22
210
\zf@make@feature
\endgroup}
This macro is called by each feature key selected, and runs according to which
type of font is selected. Note that it does not check to see if an OpenType feature
exists.
211 \newcommand*\zf@make@feature[3]{%
212
213
214
215
216
217
218
219
220
221
222
\zf@make@aat@feature@string
\ifzf@aat
\zf@make@aat@feature@string{#1}{#2}{zf@thisfontfeature}%
\ifx\zf@thisfontfeature\@empty\else
\zf@update@family{+#1,#2}%
\zf@update@ff{\zf@thisfontfeature}%
\fi
\fi
\ifzf@opentype
\zf@update@family{#3}%
\zf@update@ff{#3}%
\fi}
This macro takes the numerical codes for a font feature and creates a specified
macro containing the string required in the font definition to turn that feature on
or off. Used primarily in \zf@make@aat@feature, but also used to check if small
caps exists in the requested font.
223 \newcommand*\zf@make@aat@feature@string[3]{%
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
\ifEqStr
\font\zf@fontone="\zf@macname" at 10pt
\edef\zf@this@featurename{\XeTeXfeaturename\zf@fontone #1}%
\ifx\zf@this@featurename\@empty
\expandafter\edef\csname #3\endcsname{\@empty}%
\else
\edef\zf@this@selectionname{\XeTeXselectorname\zf@fontone #1 #2}%
\ifx\zf@this@selectionname\@empty
\expandafter\edef\csname #3\endcsname{\@empty}%
\else
\expandafter\edef\csname #3\endcsname
{\ifnum\XeTeXisexclusivefeature\zf@fontone #1 > 0
\zf@this@featurename=\zf@this@selectionname%
\else
\ifodd #2
\zf@this@featurename=!\zf@this@selectionname%
\else
\zf@this@featurename=\zf@this@selectionname%
\fi
\fi}%
\fi
\fi}
\ifEqStr was a conditional for checking it two strings are the same. It no longer
exists.
\ifEqFonts
A conditional for checking if two fonts are the same. If one of the arguments is
empty, special provision needs to be taken, since there is no font with an empty
string for a name. This case arises when \zf@make@font@shapes doesn’t take its
optional argument.
23
245 \let\then\iftrue
246 \def\ifEqFonts#1#2\then{%
247
248
249
250
251
252
253
254
255
256
\edef\@tempa{#1}%
\ifx\@tempa\@empty
\let\@tempa\@empty
\else
\font\zf@fontone = "#1" at 10pt
\edef\@tempa{\fontname\zf@fontone}%
\fi
\font\zf@fonttwo = "#2" at 10pt
\edef\@tempb{\fontname\zf@fonttwo}%
\ifx\@tempa\@tempb}
7.3 keyval definitions
This is the tedious section where we correlate all possible (eventually) font feature
requests with their XETEX representations.
7.3.1 Bold/italic choosing options
The Bold, Italic, and BoldItalic features are for defining explicitly the bold
and italic fonts used in a font family. v1.6 introduced arbitrary font features for
these shapes (BoldFeatures, etc.), so the names of the shape-selecting options
were appended with Font for consistency.
257 \define@key{zf}{Bold}{\edef\zf@bf{#1}%
258
\zf@update@family{bf:\zap@space #1 \@empty}}
259 \define@key{zf}{Italic}{\edef\zf@it{#1}%
260
\zf@update@family{it:\zap@space #1 \@empty}}
261 \define@key{zf}{BoldItalic}{\edef\zf@bfit{#1}%
262
\zf@update@family{bfit:\zap@space #1 \@empty}}
263
264 \define@key{zf}{BoldFont}{\edef\zf@bf{#1}%
265
\zf@update@family{bf:\zap@space #1 \@empty}}
266 \define@key{zf}{ItalicFont}{\edef\zf@it{#1}%
267
\zf@update@family{it:\zap@space #1 \@empty}}
268 \define@key{zf}{BoldItalicFont}{\edef\zf@bfit{#1}%
269
\zf@update@family{bfit:\zap@space #1 \@empty}}
270
271 \define@key{zf}{BoldFeatures}{\def\zf@bf@options{#1}}
272 \define@key{zf}{ItalicFeatures}{\def\zf@it@options{#1}}
273 \define@key{zf}{BoldItalicFeatures}{\def\zf@bfit@options{#1}}
7.3.2 Font-independent options
These options can be applied to any font. Both spellings (American and correct)
of ‘colour’ offered.
274 \define@key{zf}{Scale}{%
\zf@update@family{+scale:#1}%
\edef\zf@scale{#1}}
277 \define@key{zf}{Colour}{%
278
\zf@update@family{+col:#1}%
279
\zf@update@ff{color=#1}}
275
276
24
280 \define@key{zf}{Color}{%
\zf@update@family{+col:#1}%
\zf@update@ff{color=#1}}
283 \define@key{zf}{Mapping}{%
284
\zf@update@family{+map:#1}%
285
\zf@update@ff{mapping=#1}}
281
282
7.3.3 AAT-exclusive features
286 \define@key{zf}{Weight}{%
\ifzf@aat
\zf@update@family{+weight:#1}%
289
\zf@update@ff{weight=#1}%
290
\fi}
291 \define@key{zf}{Width}{%
292
\ifzf@aat
293
\zf@update@family{+width:#1}%
294
\zf@update@ff{width=#1}%
295
\fi}
287
288
7.3.4 OpenType-exclusive features
296 \define@key{zf}{Script}{\ifzf@opentype\bgroup\setkeys{zf@scpt}{#1}\egroup\fi}
297 \newcommand*\zf@make@scpt@feature[2]{%
\define@key{zf@scpt}{#1}[true]{%
\zf@update@family{+scpt:#2}%
300
\zf@update@ff{script=#2}}}
301 \zf@make@scpt@feature{Arabic}{arab}
302 \zf@make@scpt@feature{Armenian}{armn}
303 \zf@make@scpt@feature{Balinese}{bali}
304 \zf@make@scpt@feature{Bengali}{beng}
305 \zf@make@scpt@feature{Bopomofo}{bopo}
306 \zf@make@scpt@feature{Braille}{brai}
307 \zf@make@scpt@feature{Buginese}{bugi}
308 \zf@make@scpt@feature{Buhid}{buhd}
309 \zf@make@scpt@feature{Byzantine Music}{byzm}
310 \zf@make@scpt@feature{Canadian Syllabics}{cans}
311 \zf@make@scpt@feature{Cherokee}{cher}
312 \zf@make@scpt@feature{CJK Ideographic}{hani}
313 \zf@make@scpt@feature{Coptic}{copt}
314 \zf@make@scpt@feature{Cypriot Syllabary}{cprt}
315 \zf@make@scpt@feature{Cyrillic}{cyrl}
316 \zf@make@scpt@feature{Default}{DFLT}
317 \zf@make@scpt@feature{Deseret}{dsrt}
318 \zf@make@scpt@feature{Devanagari}{deva}
319 \zf@make@scpt@feature{Ethiopic}{ethi}
320 \zf@make@scpt@feature{Georgian}{geor}
321 \zf@make@scpt@feature{Glagolitic}{glag}
322 \zf@make@scpt@feature{Gothic}{goth}
323 \zf@make@scpt@feature{Greek}{grek}
324 \zf@make@scpt@feature{Gujarati}{gujr}
325 \zf@make@scpt@feature{Gurmukhi}{guru}
326 \zf@make@scpt@feature{Hangul Jamo}{jamo}
327 \zf@make@scpt@feature{Hangul}{hang}
298
299
25
328 \zf@make@scpt@feature{Hanunoo}{hano}
329 \zf@make@scpt@feature{Hebrew}{hebr}
330 \zf@make@scpt@feature{Hiragana}{kana}
331 \zf@make@scpt@feature{Katakana}{kana}
332 \zf@make@scpt@feature{Japanese}{kana}
333 \zf@make@scpt@feature{Javanese}{java}
334 \zf@make@scpt@feature{Kannada}{knda}
335 \zf@make@scpt@feature{Kharosthi}{khar}
336 \zf@make@scpt@feature{Khmer}{khmr}
337 \zf@make@scpt@feature{Lao}{lao }
338 \zf@make@scpt@feature{Latin}{latn}
339 \zf@make@scpt@feature{Limbu}{limb}
340 \zf@make@scpt@feature{Linear B}{linb}
341 \zf@make@scpt@feature{Malayalam}{mlym}
342 \zf@make@scpt@feature{Math}{math}
343 \zf@make@scpt@feature{Maths}{math}
344 \zf@make@scpt@feature{Mongolian}{mong}
345 \zf@make@scpt@feature{Musical Symbols}{musc}
346 \zf@make@scpt@feature{Myanmar}{mymr}
347 \zf@make@scpt@feature{N'ko}{nko }
348 \zf@make@scpt@feature{Ogham}{ogam}
349 \zf@make@scpt@feature{Old Italic}{ital}
350 \zf@make@scpt@feature{Old Persian Cuneiform}{xpeo}
351 \zf@make@scpt@feature{Oriya}{orya}
352 \zf@make@scpt@feature{Osmanya}{osma}
353 \zf@make@scpt@feature{Phags-pa}{phag}
354 \zf@make@scpt@feature{Phoenician}{phnx}
355 \zf@make@scpt@feature{Runic}{runr}
356 \zf@make@scpt@feature{Shavian}{shaw}
357 \zf@make@scpt@feature{Sinhala}{sinh}
358 \zf@make@scpt@feature{Sumero-Akkadian Cuneiform}{xsux}
359 \zf@make@scpt@feature{Syloti Nagri}{sylo}
360 \zf@make@scpt@feature{Syriac}{syrc}
361 \zf@make@scpt@feature{Tagalog}{tglg}
362 \zf@make@scpt@feature{Tagbanwa}{tagb}
363 \zf@make@scpt@feature{Tai Le}{tale}
364 \zf@make@scpt@feature{Tai Lu}{talu}
365 \zf@make@scpt@feature{Tamil}{taml}
366 \zf@make@scpt@feature{Telugu}{telu}
367 \zf@make@scpt@feature{Thaana}{thaa}
368 \zf@make@scpt@feature{Thai}{thai}
369 \zf@make@scpt@feature{Tibetan}{tibt}
370 \zf@make@scpt@feature{Tifinagh}{tfng}
371 \zf@make@scpt@feature{Ugaritic Cuneiform}{ugar}
372 \zf@make@scpt@feature{Yi}{yi
}
373
374 \define@key{zf}{Language}{\ifzf@opentype\bgroup\setkeys{zf@lang}{#1}\egroup\fi}
375 \newcommand*\zf@make@lang@feature[2]{%
\define@key{zf@lang}{#1}[true]{%
\zf@update@family{+lang:#2}%
378
\zf@update@ff{language=#2}}}
379 \zf@make@lang@feature{Abaza}{ABA}
376
377
26
380 \zf@make@lang@feature{Abkhazian}{ABK}
381 \zf@make@lang@feature{Adyghe}{ADY}
382 \zf@make@lang@feature{Afrikaans}{AFK}
383 \zf@make@lang@feature{Afar}{AFR}
384 \zf@make@lang@feature{Agaw}{AGW}
385 \zf@make@lang@feature{Altai}{ALT}
386 \zf@make@lang@feature{Amharic}{AMH}
387 \zf@make@lang@feature{Arabic}{ARA}
388 \zf@make@lang@feature{Aari}{ARI}
389 \zf@make@lang@feature{Arakanese}{ARK}
390 \zf@make@lang@feature{Assamese}{ASM}
391 \zf@make@lang@feature{Athapaskan}{ATH}
392 \zf@make@lang@feature{Avar}{AVR}
393 \zf@make@lang@feature{Awadhi}{AWA}
394 \zf@make@lang@feature{Aymara}{AYM}
395 \zf@make@lang@feature{Azeri}{AZE}
396 \zf@make@lang@feature{Badaga}{BAD}
397 \zf@make@lang@feature{Baghelkhandi}{BAG}
398 \zf@make@lang@feature{Balkar}{BAL}
399 \zf@make@lang@feature{Baule}{BAU}
400 \zf@make@lang@feature{Berber}{BBR}
401 \zf@make@lang@feature{Bench}{BCH}
402 \zf@make@lang@feature{Bible Cree}{BCR}
403 \zf@make@lang@feature{Belarussian}{BEL}
404 \zf@make@lang@feature{Bemba}{BEM}
405 \zf@make@lang@feature{Bengali}{BEN}
406 \zf@make@lang@feature{Bulgarian}{BGR}
407 \zf@make@lang@feature{Bhili}{BHI}
408 \zf@make@lang@feature{Bhojpuri}{BHO}
409 \zf@make@lang@feature{Bikol}{BIK}
410 \zf@make@lang@feature{Bilen}{BIL}
411 \zf@make@lang@feature{Blackfoot}{BKF}
412 \zf@make@lang@feature{Balochi}{BLI}
413 \zf@make@lang@feature{Balante}{BLN}
414 \zf@make@lang@feature{Balti}{BLT}
415 \zf@make@lang@feature{Bambara}{BMB}
416 \zf@make@lang@feature{Bamileke}{BML}
417 \zf@make@lang@feature{Breton}{BRE}
418 \zf@make@lang@feature{Brahui}{BRH}
419 \zf@make@lang@feature{Braj Bhasha}{BRI}
420 \zf@make@lang@feature{Burmese}{BRM}
421 \zf@make@lang@feature{Bashkir}{BSH}
422 \zf@make@lang@feature{Beti}{BTI}
423 \zf@make@lang@feature{Catalan}{CAT}
424 \zf@make@lang@feature{Cebuano}{CEB}
425 \zf@make@lang@feature{Chechen}{CHE}
426 \zf@make@lang@feature{Chaha Gurage}{CHG}
427 \zf@make@lang@feature{Chattisgarhi}{CHH}
428 \zf@make@lang@feature{Chichewa}{CHI}
429 \zf@make@lang@feature{Chukchi}{CHK}
430 \zf@make@lang@feature{Chipewyan}{CHP}
431 \zf@make@lang@feature{Cherokee}{CHR}
27
432 \zf@make@lang@feature{Chuvash}{CHU}
433 \zf@make@lang@feature{Comorian}{CMR}
434 \zf@make@lang@feature{Coptic}{COP}
435 \zf@make@lang@feature{Cree}{CRE}
436 \zf@make@lang@feature{Carrier}{CRR}
437 \zf@make@lang@feature{Crimean Tatar}{CRT}
438 \zf@make@lang@feature{Church Slavonic}{CSL}
439 \zf@make@lang@feature{Czech}{CSY}
440 \zf@make@lang@feature{Danish}{DAN}
441 \zf@make@lang@feature{Dargwa}{DAR}
442 \zf@make@lang@feature{Woods Cree}{DCR}
443 \zf@make@lang@feature{German}{DEU}
444 \zf@make@lang@feature{Default}{DFLT}
445 \zf@make@lang@feature{Dogri}{DGR}
446 \zf@make@lang@feature{Divehi}{DIV}
447 \zf@make@lang@feature{Djerma}{DJR}
448 \zf@make@lang@feature{Dangme}{DNG}
449 \zf@make@lang@feature{Dinka}{DNK}
450 \zf@make@lang@feature{Dungan}{DUN}
451 \zf@make@lang@feature{Dzongkha}{DZN}
452 \zf@make@lang@feature{Ebira}{EBI}
453 \zf@make@lang@feature{Eastern Cree}{ECR}
454 \zf@make@lang@feature{Edo}{EDO}
455 \zf@make@lang@feature{Efik}{EFI}
456 \zf@make@lang@feature{Greek}{ELL}
457 \zf@make@lang@feature{English}{ENG}
458 \zf@make@lang@feature{Erzya}{ERZ}
459 \zf@make@lang@feature{Spanish}{ESP}
460 \zf@make@lang@feature{Estonian}{ETI}
461 \zf@make@lang@feature{Basque}{EUQ}
462 \zf@make@lang@feature{Evenki}{EVK}
463 \zf@make@lang@feature{Even}{EVN}
464 \zf@make@lang@feature{Ewe}{EWE}
465 \zf@make@lang@feature{French Antillean}{FAN}
466 \zf@make@lang@feature{Farsi}{FAR}
467 \zf@make@lang@feature{Finnish}{FIN}
468 \zf@make@lang@feature{Fijian}{FJI}
469 \zf@make@lang@feature{Flemish}{FLE}
470 \zf@make@lang@feature{Forest Nenets}{FNE}
471 \zf@make@lang@feature{Fon}{FON}
472 \zf@make@lang@feature{Faroese}{FOS}
473 \zf@make@lang@feature{French}{FRA}
474 \zf@make@lang@feature{Frisian}{FRI}
475 \zf@make@lang@feature{Friulian}{FRL}
476 \zf@make@lang@feature{Futa}{FTA}
477 \zf@make@lang@feature{Fulani}{FUL}
478 \zf@make@lang@feature{Ga}{GAD}
479 \zf@make@lang@feature{Gaelic}{GAE}
480 \zf@make@lang@feature{Gagauz}{GAG}
481 \zf@make@lang@feature{Galician}{GAL}
482 \zf@make@lang@feature{Garshuni}{GAR}
483 \zf@make@lang@feature{Garhwali}{GAW}
28
484 \zf@make@lang@feature{Ge'ez}{GEZ}
485 \zf@make@lang@feature{Gilyak}{GIL}
486 \zf@make@lang@feature{Gumuz}{GMZ}
487 \zf@make@lang@feature{Gondi}{GON}
488 \zf@make@lang@feature{Greenlandic}{GRN}
489 \zf@make@lang@feature{Garo}{GRO}
490 \zf@make@lang@feature{Guarani}{GUA}
491 \zf@make@lang@feature{Gujarati}{GUJ}
492 \zf@make@lang@feature{Haitian}{HAI}
493 \zf@make@lang@feature{Halam}{HAL}
494 \zf@make@lang@feature{Harauti}{HAR}
495 \zf@make@lang@feature{Hausa}{HAU}
496 \zf@make@lang@feature{Hawaiin}{HAW}
497 \zf@make@lang@feature{Hammer-Banna}{HBN}
498 \zf@make@lang@feature{Hiligaynon}{HIL}
499 \zf@make@lang@feature{Hindi}{HIN}
500 \zf@make@lang@feature{High Mari}{HMA}
501 \zf@make@lang@feature{Hindko}{HND}
502 \zf@make@lang@feature{Ho}{HO}
503 \zf@make@lang@feature{Harari}{HRI}
504 \zf@make@lang@feature{Croatian}{HRV}
505 \zf@make@lang@feature{Hungarian}{HUN}
506 \zf@make@lang@feature{Armenian}{HYE}
507 \zf@make@lang@feature{Igbo}{IBO}
508 \zf@make@lang@feature{Ijo}{IJO}
509 \zf@make@lang@feature{Ilokano}{ILO}
510 \zf@make@lang@feature{Indonesian}{IND}
511 \zf@make@lang@feature{Ingush}{ING}
512 \zf@make@lang@feature{Inuktitut}{INU}
513 \zf@make@lang@feature{Irish}{IRI}
514 \zf@make@lang@feature{Irish Traditional}{IRT}
515 \zf@make@lang@feature{Icelandic}{ISL}
516 \zf@make@lang@feature{Inari Sami}{ISM}
517 \zf@make@lang@feature{Italian}{ITA}
518 \zf@make@lang@feature{Hebrew}{IWR}
519 \zf@make@lang@feature{Javanese}{JAV}
520 \zf@make@lang@feature{Yiddish}{JII}
521 \zf@make@lang@feature{Japanese}{JAN}
522 \zf@make@lang@feature{Judezmo}{JUD}
523 \zf@make@lang@feature{Jula}{JUL}
524 \zf@make@lang@feature{Kabardian}{KAB}
525 \zf@make@lang@feature{Kachchi}{KAC}
526 \zf@make@lang@feature{Kalenjin}{KAL}
527 \zf@make@lang@feature{Kannada}{KAN}
528 \zf@make@lang@feature{Karachay}{KAR}
529 \zf@make@lang@feature{Georgian}{KAT}
530 \zf@make@lang@feature{Kazakh}{KAZ}
531 \zf@make@lang@feature{Kebena}{KEB}
532 \zf@make@lang@feature{Khutsuri Georgian}{KGE}
533 \zf@make@lang@feature{Khakass}{KHA}
534 \zf@make@lang@feature{Khanty-Kazim}{KHK}
535 \zf@make@lang@feature{Khmer}{KHM}
29
536 \zf@make@lang@feature{Khanty-Shurishkar}{KHS}
537 \zf@make@lang@feature{Khanty-Vakhi}{KHV}
538 \zf@make@lang@feature{Khowar}{KHW}
539 \zf@make@lang@feature{Kikuyu}{KIK}
540 \zf@make@lang@feature{Kirghiz}{KIR}
541 \zf@make@lang@feature{Kisii}{KIS}
542 \zf@make@lang@feature{Kokni}{KKN}
543 \zf@make@lang@feature{Kalmyk}{KLM}
544 \zf@make@lang@feature{Kamba}{KMB}
545 \zf@make@lang@feature{Kumaoni}{KMN}
546 \zf@make@lang@feature{Komo}{KMO}
547 \zf@make@lang@feature{Komso}{KMS}
548 \zf@make@lang@feature{Kanuri}{KNR}
549 \zf@make@lang@feature{Kodagu}{KOD}
550 \zf@make@lang@feature{Korean Old Hangul}{KOH}
551 \zf@make@lang@feature{Konkani}{KOK}
552 \zf@make@lang@feature{Kikongo}{KON}
553 \zf@make@lang@feature{Komi-Permyak}{KOP}
554 \zf@make@lang@feature{Korean}{KOR}
555 \zf@make@lang@feature{Komi-Zyrian}{KOZ}
556 \zf@make@lang@feature{Kpelle}{KPL}
557 \zf@make@lang@feature{Krio}{KRI}
558 \zf@make@lang@feature{Karakalpak}{KRK}
559 \zf@make@lang@feature{Karelian}{KRL}
560 \zf@make@lang@feature{Karaim}{KRM}
561 \zf@make@lang@feature{Karen}{KRN}
562 \zf@make@lang@feature{Koorete}{KRT}
563 \zf@make@lang@feature{Kashmiri}{KSH}
564 \zf@make@lang@feature{Khasi}{KSI}
565 \zf@make@lang@feature{Kildin Sami}{KSM}
566 \zf@make@lang@feature{Kui}{KUI}
567 \zf@make@lang@feature{Kulvi}{KUL}
568 \zf@make@lang@feature{Kumyk}{KUM}
569 \zf@make@lang@feature{Kurdish}{KUR}
570 \zf@make@lang@feature{Kurukh}{KUU}
571 \zf@make@lang@feature{Kuy}{KUY}
572 \zf@make@lang@feature{Koryak}{KYK}
573 \zf@make@lang@feature{Ladin}{LAD}
574 \zf@make@lang@feature{Lahuli}{LAH}
575 \zf@make@lang@feature{Lak}{LAK}
576 \zf@make@lang@feature{Lambani}{LAM}
577 \zf@make@lang@feature{Lao}{LAO}
578 \zf@make@lang@feature{Latin}{LAT}
579 \zf@make@lang@feature{Laz}{LAZ}
580 \zf@make@lang@feature{L-Cree}{LCR}
581 \zf@make@lang@feature{Ladakhi}{LDK}
582 \zf@make@lang@feature{Lezgi}{LEZ}
583 \zf@make@lang@feature{Lingala}{LIN}
584 \zf@make@lang@feature{Low Mari}{LMA}
585 \zf@make@lang@feature{Limbu}{LMB}
586 \zf@make@lang@feature{Lomwe}{LMW}
587 \zf@make@lang@feature{Lower Sorbian}{LSB}
30
588 \zf@make@lang@feature{Lule Sami}{LSM}
589 \zf@make@lang@feature{Lithuanian}{LTH}
590 \zf@make@lang@feature{Luba}{LUB}
591 \zf@make@lang@feature{Luganda}{LUG}
592 \zf@make@lang@feature{Luhya}{LUH}
593 \zf@make@lang@feature{Luo}{LUO}
594 \zf@make@lang@feature{Latvian}{LVI}
595 \zf@make@lang@feature{Majang}{MAJ}
596 \zf@make@lang@feature{Makua}{MAK}
597 \zf@make@lang@feature{Malayalam Traditional}{MAL}
598 \zf@make@lang@feature{Mansi}{MAN}
599 \zf@make@lang@feature{Marathi}{MAR}
600 \zf@make@lang@feature{Marwari}{MAW}
601 \zf@make@lang@feature{Mbundu}{MBN}
602 \zf@make@lang@feature{Manchu}{MCH}
603 \zf@make@lang@feature{Moose Cree}{MCR}
604 \zf@make@lang@feature{Mende}{MDE}
605 \zf@make@lang@feature{Me'en}{MEN}
606 \zf@make@lang@feature{Mizo}{MIZ}
607 \zf@make@lang@feature{Macedonian}{MKD}
608 \zf@make@lang@feature{Male}{MLE}
609 \zf@make@lang@feature{Malagasy}{MLG}
610 \zf@make@lang@feature{Malinke}{MLN}
611 \zf@make@lang@feature{Malayalam Reformed}{MLR}
612 \zf@make@lang@feature{Malay}{MLY}
613 \zf@make@lang@feature{Mandinka}{MND}
614 \zf@make@lang@feature{Mongolian}{MNG}
615 \zf@make@lang@feature{Manipuri}{MNI}
616 \zf@make@lang@feature{Maninka}{MNK}
617 \zf@make@lang@feature{Manx Gaelic}{MNX}
618 \zf@make@lang@feature{Moksha}{MOK}
619 \zf@make@lang@feature{Moldavian}{MOL}
620 \zf@make@lang@feature{Mon}{MON}
621 \zf@make@lang@feature{Moroccan}{MOR}
622 \zf@make@lang@feature{Maori}{MRI}
623 \zf@make@lang@feature{Maithili}{MTH}
624 \zf@make@lang@feature{Maltese}{MTS}
625 \zf@make@lang@feature{Mundari}{MUN}
626 \zf@make@lang@feature{Naga-Assamese}{NAG}
627 \zf@make@lang@feature{Nanai}{NAN}
628 \zf@make@lang@feature{Naskapi}{NAS}
629 \zf@make@lang@feature{N-Cree}{NCR}
630 \zf@make@lang@feature{Ndebele}{NDB}
631 \zf@make@lang@feature{Ndonga}{NDG}
632 \zf@make@lang@feature{Nepali}{NEP}
633 \zf@make@lang@feature{Newari}{NEW}
634 \zf@make@lang@feature{Nagari}{NGR}
635 \zf@make@lang@feature{Norway House Cree}{NHC}
636 \zf@make@lang@feature{Nisi}{NIS}
637 \zf@make@lang@feature{Niuean}{NIU}
638 \zf@make@lang@feature{Nkole}{NKL}
639 \zf@make@lang@feature{N'ko}{NKO}
31
640 \zf@make@lang@feature{Dutch}{NLD}
641 \zf@make@lang@feature{Nogai}{NOG}
642 \zf@make@lang@feature{Norwegian}{NOR}
643 \zf@make@lang@feature{Northern Sami}{NSM}
644 \zf@make@lang@feature{Northern Tai}{NTA}
645 \zf@make@lang@feature{Esperanto}{NTO}
646 \zf@make@lang@feature{Nynorsk}{NYN}
647 \zf@make@lang@feature{Oji-Cree}{OCR}
648 \zf@make@lang@feature{Ojibway}{OJB}
649 \zf@make@lang@feature{Oriya}{ORI}
650 \zf@make@lang@feature{Oromo}{ORO}
651 \zf@make@lang@feature{Ossetian}{OSS}
652 \zf@make@lang@feature{Palestinian Aramaic}{PAA}
653 \zf@make@lang@feature{Pali}{PAL}
654 \zf@make@lang@feature{Punjabi}{PAN}
655 \zf@make@lang@feature{Palpa}{PAP}
656 \zf@make@lang@feature{Pashto}{PAS}
657 \zf@make@lang@feature{Polytonic Greek}{PGR}
658 \zf@make@lang@feature{Pilipino}{PIL}
659 \zf@make@lang@feature{Palaung}{PLG}
660 \zf@make@lang@feature{Polish}{PLK}
661 \zf@make@lang@feature{Provencal}{PRO}
662 \zf@make@lang@feature{Portuguese}{PTG}
663 \zf@make@lang@feature{Chin}{QIN}
664 \zf@make@lang@feature{Rajasthani}{RAJ}
665 \zf@make@lang@feature{R-Cree}{RCR}
666 \zf@make@lang@feature{Russian Buriat}{RBU}
667 \zf@make@lang@feature{Riang}{RIA}
668 \zf@make@lang@feature{Rhaeto-Romanic}{RMS}
669 \zf@make@lang@feature{Romanian}{ROM}
670 \zf@make@lang@feature{Romany}{ROY}
671 \zf@make@lang@feature{Rusyn}{RSY}
672 \zf@make@lang@feature{Ruanda}{RUA}
673 \zf@make@lang@feature{Russian}{RUS}
674 \zf@make@lang@feature{Sadri}{SAD}
675 \zf@make@lang@feature{Sanskrit}{SAN}
676 \zf@make@lang@feature{Santali}{SAT}
677 \zf@make@lang@feature{Sayisi}{SAY}
678 \zf@make@lang@feature{Sekota}{SEK}
679 \zf@make@lang@feature{Selkup}{SEL}
680 \zf@make@lang@feature{Sango}{SGO}
681 \zf@make@lang@feature{Shan}{SHN}
682 \zf@make@lang@feature{Sibe}{SIB}
683 \zf@make@lang@feature{Sidamo}{SID}
684 \zf@make@lang@feature{Silte Gurage}{SIG}
685 \zf@make@lang@feature{Skolt Sami}{SKS}
686 \zf@make@lang@feature{Slovak}{SKY}
687 \zf@make@lang@feature{Slavey}{SLA}
688 \zf@make@lang@feature{Slovenian}{SLV}
689 \zf@make@lang@feature{Somali}{SML}
690 \zf@make@lang@feature{Samoan}{SMO}
691 \zf@make@lang@feature{Sena}{SNA}
32
692 \zf@make@lang@feature{Sindhi}{SND}
693 \zf@make@lang@feature{Sinhalese}{SNH}
694 \zf@make@lang@feature{Soninke}{SNK}
695 \zf@make@lang@feature{Sodo Gurage}{SOG}
696 \zf@make@lang@feature{Sotho}{SOT}
697 \zf@make@lang@feature{Albanian}{SQI}
698 \zf@make@lang@feature{Serbian}{SRB}
699 \zf@make@lang@feature{Saraiki}{SRK}
700 \zf@make@lang@feature{Serer}{SRR}
701 \zf@make@lang@feature{South Slavey}{SSL}
702 \zf@make@lang@feature{Southern Sami}{SSM}
703 \zf@make@lang@feature{Suri}{SUR}
704 \zf@make@lang@feature{Svan}{SVA}
705 \zf@make@lang@feature{Swedish}{SVE}
706 \zf@make@lang@feature{Swadaya Aramaic}{SWA}
707 \zf@make@lang@feature{Swahili}{SWK}
708 \zf@make@lang@feature{Swazi}{SWZ}
709 \zf@make@lang@feature{Sutu}{SXT}
710 \zf@make@lang@feature{Syriac}{SYR}
711 \zf@make@lang@feature{Tabasaran}{TAB}
712 \zf@make@lang@feature{Tajiki}{TAJ}
713 \zf@make@lang@feature{Tamil}{TAM}
714 \zf@make@lang@feature{Tatar}{TAT}
715 \zf@make@lang@feature{TH-Cree}{TCR}
716 \zf@make@lang@feature{Telugu}{TEL}
717 \zf@make@lang@feature{Tongan}{TGN}
718 \zf@make@lang@feature{Tigre}{TGR}
719 \zf@make@lang@feature{Tigrinya}{TGY}
720 \zf@make@lang@feature{Thai}{THA}
721 \zf@make@lang@feature{Tahitian}{THT}
722 \zf@make@lang@feature{Tibetan}{TIB}
723 \zf@make@lang@feature{Turkmen}{TKM}
724 \zf@make@lang@feature{Temne}{TMN}
725 \zf@make@lang@feature{Tswana}{TNA}
726 \zf@make@lang@feature{Tundra Nenets}{TNE}
727 \zf@make@lang@feature{Tonga}{TNG}
728 \zf@make@lang@feature{Todo}{TOD}
729 \zf@make@lang@feature{Turkish}{TRK}
730 \zf@make@lang@feature{Tsonga}{TSG}
731 \zf@make@lang@feature{Turoyo Aramaic}{TUA}
732 \zf@make@lang@feature{Tulu}{TUL}
733 \zf@make@lang@feature{Tuvin}{TUV}
734 \zf@make@lang@feature{Twi}{TWI}
735 \zf@make@lang@feature{Udmurt}{UDM}
736 \zf@make@lang@feature{Ukrainian}{UKR}
737 \zf@make@lang@feature{Urdu}{URD}
738 \zf@make@lang@feature{Upper Sorbian}{USB}
739 \zf@make@lang@feature{Uyghur}{UYG}
740 \zf@make@lang@feature{Uzbek}{UZB}
741 \zf@make@lang@feature{Venda}{VEN}
742 \zf@make@lang@feature{Vietnamese}{VIT}
743 \zf@make@lang@feature{Wa}{WA}
33
744 \zf@make@lang@feature{Wagdi}{WAG}
745 \zf@make@lang@feature{West-Cree}{WCR}
746 \zf@make@lang@feature{Welsh}{WEL}
747 \zf@make@lang@feature{Wolof}{WLF}
748 \zf@make@lang@feature{Tai Lue}{XBD}
749 \zf@make@lang@feature{Xhosa}{XHS}
750 \zf@make@lang@feature{Yakut}{YAK}
751 \zf@make@lang@feature{Yoruba}{YBA}
752 \zf@make@lang@feature{Y-Cree}{YCR}
753 \zf@make@lang@feature{Yi Classic}{YIC}
754 \zf@make@lang@feature{Yi Modern}{YIM}
755 \zf@make@lang@feature{Chinese Hong Kong}{ZHH}
756 \zf@make@lang@feature{Chinese Phonetic}{ZHP}
757 \zf@make@lang@feature{Chinese Simplified}{ZHS}
758 \zf@make@lang@feature{Chinese Traditional}{ZHT}
759 \zf@make@lang@feature{Zande}{ZND}
760 \zf@make@lang@feature{Zulu}{ZUL}
7.3.5 Ligatures
The call to the nested keyval family must be wrapped in braces to hide the parent
list (this later requires the use of global definitions (\xdef) in \zf@update@...).
Both AAT and OpenType names are offered to chose Rare/Discretionary ligatures.
761 \define@key{zf}{Ligatures}{\bgroup\setkeys{zf@lig}{#1}\egroup}
762 \define@key{zf@lig}{Required}
[true]{\zf@make@feature{1}{0}{+rlig}}
[true]{\zf@make@feature{1}{1}{-rlig}}
764 \define@key{zf@lig}{Common}
[true]{\zf@make@feature{1}{2}{+liga}}
765 \define@key{zf@lig}{NoCommon}
[true]{\zf@make@feature{1}{3}{-liga}}
766 \define@key{zf@lig}{Rare}
[true]{\zf@make@feature{1}{4}{+dlig}}
767 \define@key{zf@lig}{NoRare}
[true]{\zf@make@feature{1}{5}{-dlig}}
768 \define@key{zf@lig}{Discretionary} [true]{\zf@make@feature{1}{4}{+dlig}}
769 \define@key{zf@lig}{NoDiscretionary}[true]{\zf@make@feature{1}{5}{-dlig}}
770 \define@key{zf@lig}{Contextual}
[true]{\zf@make@feature{}{}{+clig}}
771 \define@key{zf@lig}{NoContextual}
[true]{\zf@make@feature{}{}{-clig}}
772 \define@key{zf@lig}{Historical}
[true]{\zf@make@feature{}{}{+hlig}}
773 \define@key{zf@lig}{NoHistorical}
[true]{\zf@make@feature{}{}{-hlig}}
774 \define@key{zf@lig}{Logos}
[true]{\zf@make@feature{1}{6}{}}
775 \define@key{zf@lig}{NoLogos}
[true]{\zf@make@feature{1}{7}{}}
776 \define@key{zf@lig}{Rebus}
[true]{\zf@make@feature{1}{8}{}}
777 \define@key{zf@lig}{NoRebus}
[true]{\zf@make@feature{1}{9}{}}
778 \define@key{zf@lig}{Diphthong}
[true]{\zf@make@feature{1}{10}{}}
779 \define@key{zf@lig}{NoDiphthong}
[true]{\zf@make@feature{1}{11}{}}
780 \define@key{zf@lig}{Squared}
[true]{\zf@make@feature{1}{12}{}}
781 \define@key{zf@lig}{NoSquared}
[true]{\zf@make@feature{1}{13}{}}
782 \define@key{zf@lig}{AbbrevSquared} [true]{\zf@make@feature{1}{14}{}}
783 \define@key{zf@lig}{NoAbbrevSquared}[true]{\zf@make@feature{1}{15}{}}
784 \define@key{zf@lig}{Icelandic}
[true]{\zf@make@feature{1}{32}{}}
785 \define@key{zf@lig}{NoIcelandic}
[true]{\zf@make@feature{1}{33}{}}
763 \define@key{zf@lig}{NoRequired}
7.3.6 Letters
786 \define@key{zf}{Letters}{\bgroup\setkeys{zf@letters}{#1}\egroup}
34
787 \define@key{zf@letters}{Normal}
[true]{\zf@make@feature{3}{0}{}}
[true]{\zf@make@feature{3}{1}{+cpsp}}
789 \define@key{zf@letters}{Lowercase} [true]{\zf@make@feature{3}{2}{}}
790 \define@key{zf@letters}{SmallCaps} [true]{\zf@make@feature{3}{3}{+smcp}}
791 \define@key{zf@letters}{PetiteCaps} [true]{\zf@make@feature{}{}{+pcap}}
792 \define@key{zf@letters}{SMALLCAPS} [true]{\zf@make@feature{}{}{+c2sc}}
793 \define@key{zf@letters}{PETITECAPS} [true]{\zf@make@feature{}{}{+c2pc}}
794 \define@key{zf@letters}{InitialCaps}[true]{\zf@make@feature{3}{4}{}}
795 \define@key{zf@letters}{Unicase}
[true]{\zf@make@feature{}{}{+unic}}
788 \define@key{zf@letters}{Uppercase}
7.3.7 Numbers
These were originally separated into NumberCase and NumberSpacing following
AAT, but it makes more sense to combine them.
Both naming conventions are offered to select the number case.
796 \define@key{zf}{Numbers}{\bgroup\setkeys{zf@num}{#1}\egroup}
797 \define@key{zf@num}{Monospaced}
[true]{\zf@make@feature{6}{0}{+tnum}}
798 \define@key{zf@num}{Proportional} [true]{\zf@make@feature{6}{1}{+pnum}}
799 \define@key{zf@num}{Lowercase}
[true]{\zf@make@feature{21}{0}{+onum}}
[true]{\zf@make@feature{21}{0}{+onum}}
801 \define@key{zf@num}{Uppercase}
[true]{\zf@make@feature{21}{1}{+lnum}}
802 \define@key{zf@num}{Lining}
[true]{\zf@make@feature{21}{1}{+lnum}}
803 \define@key{zf@num}{SlashedZero} [true]{\zf@make@feature{}{}{+zero}}
804 \define@key{zf@num}{NoSlashedZero}[true]{\zf@make@feature{}{}{-zero}}
800 \define@key{zf@num}{OldStyle}
7.3.8 Swashes
805 \define@key{zf}{Swashes}{\bgroup\setkeys{zf@swash}{#1}\egroup}
806 \define@key{zf@swash}{Contextual}
[true]{\zf@make@feature{}{}{+cswh}}
[true]{\zf@make@feature{8}{0}{+init}}
808 \define@key{zf@swash}{NoWordInitial}[true]{\zf@make@feature{8}{1}{-init}}
809 \define@key{zf@swash}{WordFinal}
[true]{\zf@make@feature{8}{2}{+fina}}
810 \define@key{zf@swash}{NoWordFinal} [true]{\zf@make@feature{8}{3}{-fina}}
811 \define@key{zf@swash}{LineInitial} [true]{\zf@make@feature{8}{4}{}}
812 \define@key{zf@swash}{NoLineInitial}[true]{\zf@make@feature{8}{5}{}}
813 \define@key{zf@swash}{LineFinal}
[true]{\zf@make@feature{8}{6}{+falt}}
814 \define@key{zf@swash}{NoLineFinal} [true]{\zf@make@feature{8}{7}{-falt}}
815 \define@key{zf@swash}{Inner}
[true]{\zf@make@feature{8}{8}{}}
816 \define@key{zf@swash}{NoInner}
[true]{\zf@make@feature{8}{9}{}}
807 \define@key{zf@swash}{WordInitial}
7.3.9 Diacritics
817 \define@key{zf}{Diacritics}{\bgroup\setkeys{zf@diacritics}{#1}\egroup}
818 \define@key{zf@diacritics}{Show}
[true]{\zf@make@feature{9}{0}{}}
[true]{\zf@make@feature{9}{1}{}}
820 \define@key{zf@diacritics}{Decompose}[true]{\zf@make@feature{9}{2}{}}
819 \define@key{zf@diacritics}{Hide}
7.3.10 Vertical position
821 \define@key{zf}{VerticalPosition}{\bgroup\setkeys{zf@vertpos}{#1}\egroup}
822 \define@key{zf@vertpos}{Normal}[true]{\zf@make@feature{10}{0}{}}
823 \define@key{zf@vertpos}{Superior}[true]{\zf@make@feature{10}{1}{+sups}}
824 \define@key{zf@vertpos}{Inferior}[true]{\zf@make@feature{10}{2}{+subs}}
825 \define@key{zf@vertpos}{ScientificInferior}[true]{\zf@make@feature{}{}{+sinf}}
826 \define@key{zf@vertpos}{Ordinal}[true]{\zf@make@feature{10}{3}{+ordn}}
35
827 \define@key{zf@vertpos}{Numerator}[true]{\zf@make@feature{}{}{+numr}}
828 \define@key{zf@vertpos}{Denominator}[true]{\zf@make@feature{}{}{+dnom}}
7.3.11 Fractions
829 \define@key{zf}{NoFractions}[true]{\zf@make@feature{11}{0}{-frac}}
830 \define@key{zf}{Fractions}[true]{\zf@make@feature{11}{1}{+frac}}
831 \define@key{zf}{DiagonalFractions}[true]{\zf@make@feature{11}{2}{+frac}}
7.3.12 Alternates and variants
Selected numerically because they don’t have standard names. Very easy to process, very annoying for the user!
832 \define@key{zf}{Alternate}{\zf@make@feature{17}{#1}{\ifnum #1 > 0 +salt\fi}}
833 \define@key{zf}{Variant}{\zf@make@feature{18}{#1}{%
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
\ifnum #1 > 0
\ifnum #1 < 21
\ifnum #1 > 9
+ss#1%
\else
+ss0#1%
\fi
\else
\PackageWarning{fontspec}{OpenType variant range must be
between 1 and 20.}%
\fi
\else
\PackageWarning{fontspec}{OpenType variant range must be between 1
and 20.}%
\fi}}
7.3.13 Style options
849 \define@key{zf}{StyleOptions}{\bgroup\setkeys{zf@style}{#1}\egroup}
850 \define@key{zf@style}{Display}[true]{\zf@make@feature{19}{1}{}}
851 \define@key{zf@style}{Engraved}[true]{\zf@make@feature{19}{2}{}}
852 \define@key{zf@style}{IlluminatedCaps}[true]{\zf@make@feature{19}{3}{}}
853 \define@key{zf@style}{TitlingCaps}[true]{\zf@make@feature{19}{4}{+titl}}
854 \define@key{zf@style}{TallCaps}[true]{\zf@make@feature{19}{5}{}}
7.4 Italic small caps
The following code for utilising italic small caps sensibly is taken pretty much
verbatim from Philip Lehman’s Font Installation Guide. Note that \upshape needs
to be used twice to get from italic small caps to regular upright (it always goes to
small caps, then regular upright).
\sishape
\textsi
First, the commands for actually selecting italic small caps are defined. I use si
as the NFSS shape for italic small caps, but I have seen itsc and slsc also used.
\sidefault may be redefined to one of these if required for compatibility.
855 \providecommand*{\sidefault}{si}
856 \DeclareRobustCommand{\sishape}{%
\not@math@alphabet\sishape\relax
\fontshape\sidefault\selectfont}
859 \DeclareTextFontCommand{\textsi}{\sishape}
857
858
36
\zf@merge@shape
This is the macro which enables the overload on the \..shape commands. It takes
three such arguments. In essence, the macro selects the first argument, unless the
second argument is already selected, in which case it selects the third.
860 \newcommand*{\zf@merge@shape}[3]{%
861
862
863
864
865
866
867
868
869
870
\edef\@tempa{#1}%
\edef\@tempb{#2}%
\ifx\f@shape\@tempb
\expandafter\ifx
\csname\f@encoding/\f@family/\f@series/#3\endcsname
\relax\else
\edef\@tempa{#3}%
\fi
\fi
\fontshape{\@tempa}\selectfont}
\scshape
Here the original \..shape commands are redefined to use the merge shape
macro.
\upshape
871 \DeclareRobustCommand{\itshape}{%
\itshape
\not@math@alphabet\itshape\mathit
\zf@merge@shape\itdefault\scdefault\sidefault}
874 \DeclareRobustCommand{\scshape}{%
875
\not@math@alphabet\scshape\relax
876
\zf@merge@shape\scdefault\itdefault\sidefault}
877 \DeclareRobustCommand{\upshape}{%
878
\not@math@alphabet\upshape\relax
879
\zf@merge@shape\updefault\sidefault\scdefault}
872
873
7.5 Selecting maths fonts
Here, the fonts used in math mode are redefined to correspond to the default
roman, sans serif and typewriter fonts. Unfortunately, you can only define maths
fonts in the preamble, otherwise I’d run this code whenever \defaultromanfont
and friends was run.
\AtBeginDocument
Everything here is performed \AtBeginDocument in order to overwrite euler’s
attempt. This means fontspec must be loaded before euler.
The Computer Modern font family contain uppercase Greek math letters in
its main text font, cmr. Since this is also the font used for the operators, the
default roman font, any redefinition of this will make the uppercase Greek letters
disappear. This is not a problem using any other math font, however, so first we
check to see if that is the case: (TODO: it would be more robust to simply check if
the currently selected maths font is indeed cmmi or whatever.)
880 \newif\ifzf@math@package
881 \AtBeginDocument{%
882
883
884
885
886
887
888
\@ifpackageloaded{euler}{\zf@math@packagetrue}{}
\@ifpackageloaded{lucbmath}{\zf@math@packagetrue}{}
\@ifpackageloaded{lucidabr}{%
\zf@math@packagetrue
\PackageWarningNoLine{fontspec}{
It would be better to use the lucbmath package,\MessageBreak
since the lucidabr package also defines the text\MessageBreak
37
fonts, which are unavailable in XeTeX.}}{}
889
If default maths, redefine the uppercase Greek letters to a different math symbol
font (which is cmr, what it originally was) so that font changes don’t make XETEX
try and look for them in the new Mac OS X font:
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
\ifzf@math@package\else
\DeclareSymbolFont{Greek}{OT1}{cmr}{m}{n}
\SetSymbolFont{Greek}{bold}{OT1}{cmr}{bx}{n}
\DeclareMathSymbol{\Gamma}{\mathalpha}{Greek}{0}
\DeclareMathSymbol{\Delta}{\mathalpha}{Greek}{1}
\DeclareMathSymbol{\Theta}{\mathalpha}{Greek}{2}
\DeclareMathSymbol{\Lambda}{\mathalpha}{Greek}{3}
\DeclareMathSymbol{\Xi}{\mathalpha}{Greek}{4}
\DeclareMathSymbol{\Pi}{\mathalpha}{Greek}{5}
\DeclareMathSymbol{\Sigma}{\mathalpha}{Greek}{6}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{Greek}{7}
\DeclareMathSymbol{\Phi}{\mathalpha}{Greek}{8}
\DeclareMathSymbol{\Psi}{\mathalpha}{Greek}{9}
\DeclareMathSymbol{\Omega}{\mathalpha}{Greek}{10}
\fi
Finally we change the font definitions. I’m not sure if every single declaration
below is necessary, but I thought it would be best to include everything. Some
may be redundant, and others may not be desired since there are only a limited
number of math fonts available for declaration at any one time.
905
906
907
908
909
910
911
912
913
914
915
\DeclareSymbolFont{operators}\zf@enc\rmdefault\mddefault\updefault
\SetSymbolFont{operators}{normal}\zf@enc\rmdefault\mddefault\updefault
\SetMathAlphabet\mathrm{normal}\zf@enc\rmdefault\mddefault\updefault
\SetMathAlphabet\mathit{normal}\zf@enc\rmdefault\mddefault\itdefault
\SetMathAlphabet\mathbf{normal}\zf@enc\rmdefault\bfdefault\updefault
\SetMathAlphabet\mathsf{normal}\zf@enc\sfdefault\mddefault\updefault
\SetMathAlphabet\mathtt{normal}\zf@enc\ttdefault\mddefault\updefault
\SetSymbolFont{operators}{bold}\zf@enc\rmdefault\bfdefault\updefault
\SetMathAlphabet\mathrm{bold}\zf@enc\rmdefault\bfdefault\updefault
\SetMathAlphabet\mathit{bold}\zf@enc\rmdefault\bfdefault\itdefault
\SetMathAlphabet\mathsf{bold}\zf@enc\sfdefault\bfdefault\updefault}
The end! Thanks for coming.
916 !/fontspec"
Index
Numbers written in italic refer to the page where the corresponding entry is
described; numbers underlined refer to the code line of the definition; numbers
in roman refer to the code lines where the entry is used.
\@tempb . . . . . . . . . . . . 255, 256, 862, 863
Symbols
\@firstoftwo . . . . . . . . . . . . . . . . . .
42
\@ifnextchar . . . . . . . . . . . . . . . . . .
30
\@ifpackageloaded
. . . . . . . . . 882–884
\@secondoftwo . . . . . . . . . . . . . . . . .
43
38
A
\addfontfeature . . . . . . . . . . . . . . 5, 45
\addfontfeatures . . . . . . . . . . . . . 5, 37
\AtBeginDocument
. . . . . . . . . . . . . . 880
\newfeaturecode . . . . . . . . . . . . . 14, 53
B
...................
74, 76, 93, 95, 98, 101, 909, 912–915
\bfdefault
\newfontfeature . . . . . . . . . . . . . 12, 46
\newfontinstance
D
\DeclareFontFamily . . . .
\DeclareFontShape . . . .
\DeclareMathSymbol . . . .
\DeclareSymbolFont . . . .
\DeclareTextFontCommand
\defaultfontfeatures . .
.
.
.
.
.
.
.
.
.
..
\define@key . . . . . . . . . . . .
\Delta . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . 68
134, 144
893–903
891, 905
. . . . 859
. . . 4, 35
. . . . 16
. . . . 894
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . . . . . . 4, 29
. . . . . . . . 30, 31
120, 121, 155, 880
. . . . . . . . . . 123
. . . . . 20, 24, 28
857, 872, 875, 878
O
P
\PackageWarning . . . . .
\PackageWarningNoLine
\Phi . . . . . . . . . . . . . . .
\Pi . . . . . . . . . . . . . . . .
\providecommand . . . . .
\Psi . . . . . . . . . . . . . . .
F
. . . . . . . . . . . . . . 865
. . . . . . . . . . . 40, 865
. . . . . . . . . . . . . . 865
. . . . . . . . . . . . . . 863
108, 184, 224, 251, 254
. . . . . . . . . . . . 16, 33
. . . . . . . . . . 252, 255
. . . . . . . . . . 858, 870
. . . . . . . . . . 2, 14, 41
\rmdefault
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
842, 846
. . . 886
. . . 901
. . . 898
. . . 855
. . . 902
R
. . . . . . 19, 905–909, 912–914
S
\scdefault . . . . . . . . . 139, 873, 876, 879
\scshape . . . . . . . . . . . . . . . . . . . . . 871
\setkeys . . . . . . . . . . .
G
16, 173, 296,
374, 761, 786, 796, 805, 817, 821, 849
\SetMathAlphabet . . . . 907–911, 913–915
\setmonofont . . . . . . . . . . . . . . . . . 3, 17
\setromanfont . . . . . . . . . . . . . . . . 3, 17
\setsansfont . . . . . . . . . . . . . . . . . 3, 17
\SetSymbolFont . . . . . . . . . 892, 906, 912
\sfdefault . . . . . . . . . . . . . 23, 910, 915
\sidefault . . 142, 855, 858, 873, 876, 879
\Sigma . . . . . . . . . . . . . . . . . . . . . . . 899
\sishape . . . . . . . . . . . . . . . . . . . . . 855
\stepcounter . . . . . . . . . . . . . . . . . . 48
\Gamma . . . . . . . . . . . . . . . . . . . . . . . 893
\globaldefs . . . . . . . . . . . . . . . . . . . 124
I
. . . . . . . . . . . . . . . 126, 245
\ifEqStr . . . . . . . . . . . . . . . . . . . . . 245
\ifzf@aat . . . 120, 177, 204, 212, 287, 292
\ifzf@firsttime . . . . . . . . 151, 155, 157
\ifzf@math@package . . . . . . . . . 880, 890
\ifzf@opentype 121, 183, 207, 219, 296, 374
\itdefault . . . . . . . . . . . . . . 83, 85,
93, 95, 98, 101, 141, 873, 876, 908, 914
\itshape . . . . . . . . . . . . . . . . . . . . . 871
\ifEqFonts
T
\textsi . . . . . . . . . . . . . . . . . . . . . . 855
L
\thenewff . . . . . . . . . . . . . . . . . . . . 49
\Theta . . . . . . . . . . . . . . . . . . . . . . . 895
\ttdefault . . . . . . . . . . . . . . . . 27, 911
\Lambda . . . . . . . . . . . . . . . . . . . . . . 896
U
. . . . . . . . . . . . . . 69, 74,
76, 138, 879, 905–907, 909–913, 915
\upshape . . . . . . . . . . . . . . . . . . . . . 871
\Upsilon . . . . . . . . . . . . . . . . . . . . . 900
\updefault
M
\mathalpha . . . . . . . . . . . . . . . 893–903
\mddefault . 69, 83, 85, 905–908, 910, 911
\MessageBreak . . . . . . . . . . . . . 887, 888
N
\newcounter . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
\Omega . . . . . . . . . . . . . . . . . . . . . . . 903
E
\encodingdefault . . . . . . . . . . . . . . 12
\f@encoding
\f@family .
\f@series .
\f@shape . .
\font . . . . .
\fontfamily
\fontname .
\fontshape
\fontspec .
..
.
.
.
.
.
\newfontinstance@i
\newif . . . . . . . . . .
\nfss@catcodes . . .
\normalfont . . . . . .
\not@math@alphabet
W
46
\wlog . . . . . . . . . . . . . . . . . . . . . . . .
39
64
\zf@make@aat@feature@string . . . . .
X
\XeTeXcountfeatures . . . . . . . . . . . . 109
\XeTeXfeaturename
.......
\XeTeXisexclusivefeature .
\XeTeXOTcountfeatures . . . .
\XeTeXOTcountscripts . . . . .
\XeTeXOTfeaturetag . . . . . . .
\XeTeXselectorname . . . . . . .
\Xi . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . 225
. . . . 234
. . . . 188
114, 185
. . . . 190
. . . . 229
. . . . 897
\zf@aatfalse . . . . . . . . . . . . . .
106, 117
Z
\zf@aattrue . . . . . . . . . . . . . . . . . . . 111
\zf@bf . . . . . . 73, 76, 91, 98, 159, 257, 264
\zf@bf@options . . . . . . . . . . 72, 162, 271
\zf@bfit . . . . . . . . 90, 101, 161, 261, 268
\zf@bfit@options
. . . . . . . . . . . . . . . . 178, 213, 223
. . . . . . . . 54, 211,
762–785, 787–795, 797–804, 806-816, 818–820, 822–833, 850–854
\zf@make@font@shapes . . . . . . . . 69,
74, 76, 83, 85, 93, 95, 98, 101, 122
\zf@make@lang@feature . . . 375, 379–760
\zf@make@scpt@feature . . . 297, 301–372
\zf@math@packagetrue . . . . 882, 883, 885
\zf@merge@shape . . . . . 860, 873, 876, 879
\zf@opentypefalse . . . . . . . . . 107, 112
\zf@opentypetrue . . . . . . . . . . . . . . 116
\zf@options . . . . . . . . . . . . . . . . 56,
71, 72, 78, 80, 81, 87–89, 103, 168, 170
\zf@options@old . . . . . . . . . . . . . . .
. . . . . 71, 72, 78, 80, 81, 87–89, 103
\zf@process@options . . . . . . . . 172, 174
\zf@scale . . . . . . . . . . 129, 132, 158, 276
\zf@scale@str . . . . . . . 130, 132, 135, 146
\zf@scshape . . . . . . . . . . . . 139, 142, 145
\zf@set@font@type . . . . . . . . . . 59, 105
\zf@smallcaps . . . 137, 146, 176, 180, 192
\zf@smallcaps@string . . . . . . . 179, 180
\zf@tempinst . . . . . . . . . . . . . . . . 33, 34
\zf@test@smallcaps . . . . . . . . . 136, 175
\zf@testfont . . . . . . . . . . . . . . . . . .
. . . 108, 109, 114, 184, 185, 188, 190
\zf@this@featurename . . . . . . . . . . .
. . . . . . . . . . 225, 226, 235, 238, 240
\zf@this@selectionname . . . . . . . . .
. . . . . . . . . . 229, 230, 235, 238, 240
\zf@thisfontfeature . . . . . . . . 214, 216
\zf@thisinfo . . . . . . . . . . . . . 40, 42, 43
\zf@update@family . . . 51, 150, 215,
220, 258, 260, 262, 265, 267, 269,
275, 278, 281, 284, 288, 293, 299, 377
\zf@update@ff . . . . . . . 52, 201, 216,
221, 279, 282, 285, 289, 294, 300, 378
\zf@make@feature
. . . . . . . . 89, 164, 273
\zf@current@options 65, 66, 168, 170, 173
\zf@default@options . . . . . . . . . . . .
. . . . . . . . . . 35, 38, 39, 44, 167, 170
. . . . . . 38, 44
\zf@enc . . . . 10–12, 68, 134, 145, 905–915
\zf@family . . . . . . . . . 16, 19, 23, 27,
33, 58, 63, 67, 68, 134, 145, 152, 153
\zf@family@old . . . . . . . . . . . . 152, 153
\zf@featurecount . . . . 188, 189, 193, 200
\zf@ff . . . . . . 135, 146, 166, 203, 205, 208
\zf@ff@old . . . . . . . . . . . . 203, 205, 208
\zf@firsttimefalse . . . . . . . . . . . . . 62
\zf@firsttimetrue . . . . . . . . . . . . . 60
\zf@fontone . . 224, 225, 229, 234, 251, 252
\zf@fontspec . . . . . . 15, 18, 22, 26, 32, 55
\zf@fonttwo . . . . . . . . . . . . . . . 254, 255
\zf@get@feature@requests . 61, 128, 156
\zf@info . . . . . . . . . . . . . . . . . . . 66, 67
\zf@it . . . . . . 82, 85, 92, 95, 160, 259, 266
\zf@it@options . . . . . . . . . . 81, 163, 272
\zf@macname . . . . . . . . . 57, 127, 184, 224
\zf@default@options@old
40
Download