| 1 |
%%^^A%% fontspec-doc-xetex.tex -- part of FONTSPEC <latex3.github.io/fontspec> |
| 2 |
|
| 3 |
\documentclass[a4paper]{l3doc} |
| 4 |
\usepackage{fontspec-doc-style} |
| 5 |
\showexamplesfalse |
| 6 |
\begin{document} |
| 7 |
|
| 8 |
\part{Fonts and features with \XeTeX} |
| 9 |
\label{sec:xetex-features} |
| 10 |
|
| 11 |
\section{\XeTeX-only font features} |
| 12 |
|
| 13 |
The features described here are available for any font |
| 14 |
selected by \pkg{fontspec}. |
| 15 |
|
| 16 |
\subsection{Mapping} |
| 17 |
\label{sec:mapping} |
| 18 |
|
| 19 |
The \feat{Mapping} feature enables a \XeTeX\ text-mapping scheme, with an example shown in \exref{mapping}. |
| 20 |
|
| 21 |
\begin{Xexample}{mapping}{\XeTeX's \feat{Mapping} feature.} |
| 22 |
\fontspec{texgyrepagella-regular.otf}[Mapping=tex-text] |
| 23 |
``!`A small amount of---text!'' |
| 24 |
\end{Xexample} |
| 25 |
|
| 26 |
Only one mapping can be active at a time and a second call to \feat{Mapping} |
| 27 |
will override the first. |
| 28 |
Using the |tex-text| mapping is also equivalent to writing |Ligatures=TeX|. |
| 29 |
The use of the latter syntax is recommended for better compatibility with |
| 30 |
\LuaTeX\ documents. |
| 31 |
|
| 32 |
|
| 33 |
\subsection{Different font technologies: \AAT, OpenType, and Graphite}\label{sec:renderer-xetex} |
| 34 |
|
| 35 |
\textbf{Note that from 2020 it appears that \XeTeX\ can no longer support \AAT\ fonts in \MacOSX.} |
| 36 |
|
| 37 |
\XeTeX\ supports three rendering technologies for typesetting, selected with |
| 38 |
the \feat{Renderer} font feature. The first, \opt{AAT}, is |
| 39 |
that provided only by \MacOSX. |
| 40 |
The second, \opt{OpenType}, is an open source OpenType interpreter. |
| 41 |
It provides greater support for OpenType features, notably contextual arrangement, over \opt{AAT}. |
| 42 |
The third is \opt{Graphite}, which is an alternative to OpenType with particular features for less-common languages and the capability for more powerful font options. |
| 43 |
Features for \opt{OpenType} have already been discussed in \vref{sec:opentype-features}; |
| 44 |
\opt{Graphite} and \opt{AAT} features are discussed later in \vref{sec:graphite-features} and \vref{sec:aat-features}. |
| 45 |
|
| 46 |
Unless you have a particular need, the \feat{Renderer} feature is rarely explicitly required: for OpenType |
| 47 |
fonts, the \opt{OpenType} renderer is used automatically, and for \AAT\ fonts, |
| 48 |
\opt{AAT} is chosen by default. Some fonts, however, will contain font tables |
| 49 |
for multiple rendering technologies, such as the Hiragino Japanese fonts |
| 50 |
distributed with \MacOSX, and in these cases one over the other may be preferred. |
| 51 |
|
| 52 |
Among some other font features only available through a specific renderer, |
| 53 |
\opt{OpenType} provides for the \feat{Script} and \feat{Language} features, which allow |
| 54 |
different font behaviour for different alphabets and languages; see \vref{sec:ot} |
| 55 |
for the description of these features. {\em Because these font features can |
| 56 |
change which features are able to be selected for the font instance, they are selected |
| 57 |
by \pkg{fontspec} before all others and will automatically and without warning |
| 58 |
select the \opt{OpenType} renderer.} |
| 59 |
|
| 60 |
|
| 61 |
\subsection{Vertical typesetting} |
| 62 |
|
| 63 |
\XeTeX\ provides for vertical typesetting simply with the ability to rotate |
| 64 |
the individual glyphs as a font is used for typesetting: |
| 65 |
\begin{Verbatim} |
| 66 |
\def\verttext{共産主義者は} |
| 67 |
\fontspec{Hiragino Mincho Pro} |
| 68 |
\verttext |
| 69 |
|
| 70 |
\fontspec{Hiragino Mincho Pro}[Renderer=AAT,Vertical=RotatedGlyphs] |
| 71 |
\rotatebox{-90}{\verttext}% requires the graphicx package |
| 72 |
\end{Verbatim} |
| 73 |
|
| 74 |
No actual provision is made for typesetting top-to-bottom |
| 75 |
languages; for an example of how to do this, see the vertical Chinese |
| 76 |
example provided in the \XeTeX\ documentation. |
| 77 |
|
| 78 |
|
| 79 |
\section{The Graphite renderer} |
| 80 |
\label{sec:graphite-features} |
| 81 |
|
| 82 |
Since the Graphite renderer is designed for less common scripts and languages, usually with |
| 83 |
specific or unique requirements, Graphite features are not standard across fonts. |
| 84 |
|
| 85 |
Currently \pkg{fontspec} does not support a convenient interface to select Graphite font |
| 86 |
features and all selection must be done via `raw' font feature selection. |
| 87 |
|
| 88 |
Here's an example: |
| 89 |
\begin{Verbatim} |
| 90 |
\fontspec{Charis SIL}[ |
| 91 |
Renderer=Graphite, |
| 92 |
RawFeature={Uppercase Eng alternates=Large eng on baseline}] |
| 93 |
Ŋ |
| 94 |
\end{Verbatim} |
| 95 |
|
| 96 |
Here's another: |
| 97 |
\begin{Verbatim} |
| 98 |
\fontspec{AwamiNastaliq-Regular.ttf}[Renderer=Graphite] ^^^^06b5 |
| 99 |
\addfontfeature{RawFeature={Lam with V=V over bowl}} ^^^^06b5 |
| 100 |
\end{Verbatim} |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
\section{\MacOSX's \AAT\ fonts} |
| 105 |
\label{sec:aat-features} |
| 106 |
|
| 107 |
\begin{quote}\itshape |
| 108 |
\textbf{Warning!} |
| 109 |
\XeTeX's implementation on \MacOSX\ is currently in a state of flux and the information contained below may well be wrong from 2013 onwards. |
| 110 |
There is a good chance that the features described in this section will not be available any more as \XeTeX's completes its transition to a cross-platform--only application. |
| 111 |
All examples in this section have now been removed. |
| 112 |
\end{quote} |
| 113 |
|
| 114 |
\MacOSX's font technology began life before the ubiquitous-OpenType era |
| 115 |
and revolved around the Apple-invented `\AAT' font format. This format |
| 116 |
had some advantages (and other disadvantages) but it never became widely |
| 117 |
popular in the font world. |
| 118 |
|
| 119 |
Nonetheless, this is the font format that was first supported by \XeTeX\ |
| 120 |
(due to its pedigree on \MacOSX\ in the first place) and was the first |
| 121 |
font format supported by \pkg{fontspec}. A number of fonts distributed with |
| 122 |
\MacOSX\ are still in the \AAT\ format, such as `Skia'. |
| 123 |
|
| 124 |
\subsection{Ligatures} |
| 125 |
|
| 126 |
\feat{Ligatures} refer to the replacement of two separate characters |
| 127 |
with a specially drawn glyph for functional or \ae sthetic reasons. |
| 128 |
For \AAT\ fonts, you may choose from any combination of \opt{Required}, |
| 129 |
\opt{Common}, \opt{Rare} (or \opt{Discretionary}), \opt{Logos}, \opt{Rebus}, |
| 130 |
\opt{Diphthong}, \opt{Squared}, \opt{AbbrevSquared}, and \opt{Icelandic}. |
| 131 |
|
| 132 |
Some other Apple \AAT\ fonts have those `Rare' ligatures contained in |
| 133 |
the \opt{Icelandic} feature. Notice also that the old \TeX\ trick of |
| 134 |
splitting up a ligature with an empty brace pair does not work in |
| 135 |
\XeTeX; you must use a 0\,pt kern or \cs{hbox} (\eg, \cs{null}) to |
| 136 |
split the characters up if you do not want a ligature to be performed (the usual examples for when this might be desired are words like `shelf\null full'). |
| 137 |
|
| 138 |
\subsection{Letters} \label{sec:aat-letters} |
| 139 |
The \opt{Letters} feature specifies how the letters in the current font |
| 140 |
will look. For \AAT\ fonts, you may choose from \opt{Normal}, |
| 141 |
\opt{Uppercase}, \opt{Lowercase}, \opt{SmallCaps}, and |
| 142 |
\opt{InitialCaps}. |
| 143 |
|
| 144 |
|
| 145 |
\subsection{Numbers} |
| 146 |
The \feat{Numbers} feature defines how numbers will look in the |
| 147 |
selected font. For \AAT\ fonts, they may be a |
| 148 |
combination of \opt{Lining} or \opt{OldStyle} and \opt{Proportional} or |
| 149 |
\opt{Monospaced} (the latter is good for tabular material). The synonyms |
| 150 |
\opt{Uppercase} and \opt{Lowercase} are equivalent to \opt{Lining} and |
| 151 |
\opt{OldStyle}, respectively. The differences have been shown previously |
| 152 |
in \vref{sec:addfontfeatures}. |
| 153 |
|
| 154 |
\subsection{Contextuals} \label{sec:contextuals} |
| 155 |
This feature refers to glyph substitution that vary by their position; |
| 156 |
things like contextual swashes are implemented here. |
| 157 |
The options for \AAT\ fonts are |
| 158 |
\opt{WordInitial}, \opt{WordFinal}, \opt{LineInitial}, |
| 159 |
\opt{LineFinal}, and \opt{Inner} (sometimes called `non-final'). As |
| 160 |
non-exclusive selectors, like the ligatures, you can turn them off |
| 161 |
by prefixing their name with \opt{No}. |
| 162 |
|
| 163 |
\subsection{Vertical position} |
| 164 |
The \feat{VerticalPosition} feature is used to access things like |
| 165 |
subscript (\opt{Inferior}) and superscript (\opt{Superior}) numbers and |
| 166 |
letters (and a small amount of punctuation, sometimes). |
| 167 |
The \opt{Ordinal} option is (supposed to be) |
| 168 |
contextually sensitive to only raise characters that appear directly |
| 169 |
after a number. |
| 170 |
|
| 171 |
The \pkg{realscripts} package redefines the \cmd\textsubscript\ and |
| 172 |
\cmd\textsuperscript\ commands to use the above font features, |
| 173 |
including for use in footnote labels. |
| 174 |
|
| 175 |
\subsection{Fractions} |
| 176 |
Many fonts come with the capability to typeset various forms of |
| 177 |
fractional material. This is accessed in \pkg{fontspec} with the |
| 178 |
\feat{Fractions} feature, which may be turned \opt{On} or \opt{Off} |
| 179 |
in both \AAT\ and OpenType fonts. |
| 180 |
|
| 181 |
In \AAT\ fonts, the `fraction slash' or solidus character, is |
| 182 |
to be used to create fractions. When \feat{Fractions} are turned |
| 183 |
\opt{On}, then only pre-drawn fractions will be used. |
| 184 |
|
| 185 |
Using the \opt{Diagonal} option (\AAT\ only), the font will attempt |
| 186 |
to create the fraction from superscript and subscript |
| 187 |
characters. |
| 188 |
|
| 189 |
Some (Asian fonts predominantly) also provide for the |
| 190 |
\opt{Alternate} feature. |
| 191 |
|
| 192 |
\subsection{Variants} |
| 193 |
The \feat{Variant} feature takes a single numerical input for |
| 194 |
choosing different alphabetic shapes. |
| 195 |
See \vref{sec:newfeatures} for a way to assign names to variants, |
| 196 |
which should be done on a per-font basis. |
| 197 |
|
| 198 |
\subsection{Alternates} |
| 199 |
Selection of \feat{Alternate}s again must be done numerically. |
| 200 |
See \vref{sec:newfeatures} for a way to assign names to alternates, |
| 201 |
which should be done on a per-font basis. |
| 202 |
|
| 203 |
|
| 204 |
\subsection{Style} |
| 205 |
The options of the \feat{Style} feature |
| 206 |
are defined in \AAT\ as one of the following: \opt{Display}, |
| 207 |
\opt{Engraved}, \opt{IlluminatedCaps}, \opt{Italic}, |
| 208 |
\opt{Ruby},\footnotemark\ \opt{TallCaps}, or \opt{Titling}. |
| 209 |
\footnotetext{`Ruby' refers to a small optical size, used in |
| 210 |
Japanese typography for annotations.} |
| 211 |
|
| 212 |
Typical examples for these features are shown in \ref{sec:ot-feat-style}. |
| 213 |
|
| 214 |
\subsection{CJK shape} |
| 215 |
There have been many standards for how CJK ideographic |
| 216 |
glyphs are `supposed' to look. Some fonts will contain many alternate |
| 217 |
glyphs in order to be able to display these glyphs |
| 218 |
correctly in whichever form is appropriate. Both \AAT\ and OpenType |
| 219 |
fonts support the following \feat{CJKShape} options: |
| 220 |
\opt{Traditional}, \opt{Simplified}, \opt{JIS1978}, \opt{JIS1983}, |
| 221 |
\opt{JIS1990}, and \opt{Expert}. OpenType also supports the \opt{NLC} option. |
| 222 |
|
| 223 |
\subsection{Character width} |
| 224 |
See \vref{sec:CharacterWidth} for relevant examples; the features are |
| 225 |
the same between OpenType and \AAT\ fonts. |
| 226 |
\AAT\ also allows \feat{CharacterWidth}|=|\opt{Default} to return to |
| 227 |
the original font settings. |
| 228 |
|
| 229 |
\subsection{Diacritics} |
| 230 |
Diacritics are marks, such as the acute accent or the tilde, applied to letters; they usually indicate a change in pronunciation. |
| 231 |
In Arabic scripts, diacritics are used to indicate vowels. |
| 232 |
You may either choose |
| 233 |
to \opt{Show}, \opt{Hide} or \opt{Decompose} them in \AAT\ fonts. |
| 234 |
The \opt{Hide} option is for scripts such as Arabic which may be |
| 235 |
displayed either with or without vowel markings. E.g., |
| 236 |
\verb|\fontspec[Diacritics=Hide]{...}| |
| 237 |
|
| 238 |
Some older fonts distributed with \MacOSX\ included `|O/|' \etc\ as shorthand for writing `\O' under the label of the \feat{Diacritics} feature. If you come across such fonts, you'll |
| 239 |
want to turn this feature off (imagine typing |hello/goodbye| and |
| 240 |
getting `hell\o goodbye' instead!) by decomposing the two characters |
| 241 |
in the diacritic into the ones you actually |
| 242 |
want. I recommend using |
| 243 |
the proper \LaTeX\ input conventions for obtaining such characters |
| 244 |
instead. |
| 245 |
|
| 246 |
|
| 247 |
\subsection{Annotation} |
| 248 |
Various Asian fonts are equipped with a more extensive range of |
| 249 |
numbers and numerals in different forms. These are accessed through |
| 250 |
the \feat{Annotation} feature with the following |
| 251 |
options: \opt{Off}, |
| 252 |
\opt{Box}, \opt{RoundedBox}, \opt{Circle}, \opt{BlackCircle}, |
| 253 |
\opt{Parenthesis}, \opt{Period}, \opt{RomanNumerals}, \opt{Diamond}, |
| 254 |
\opt{BlackSquare}, \opt{BlackRoundSquare}, and \opt{DoubleCircle}. |
| 255 |
|
| 256 |
\end{document} |
| 257 |
|
| 258 |
% /© |
| 259 |
% ------------------------------------------------ |
| 260 |
% The FONTSPEC package <latex3.github.io/fontspec> |
| 261 |
% ------------------------------------------------ |
| 262 |
% Copyright 2022-2025 The LaTeX project, LPPL "maintainer" |
| 263 |
% Copyright 2004-2022 Will Robertson |
| 264 |
% Copyright 2009-2015 Khaled Hosny |
| 265 |
% Copyright 2013 Philipp Gesang |
| 266 |
% Copyright 2013-2016 Joseph Wright |
| 267 |
% ------------------------------------------------ |
| 268 |
% This package is free software and may be redistributed and/or modified under |
| 269 |
% the conditions of the LaTeX Project Public License, version 1.3c or higher |
| 270 |
% (your choice): <http://www.latex-project.org/lppl/>. |
| 271 |
% ------------------------------------------------ |
| 272 |
% ©/ |