Debian Codegraph @

texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex

raw
1 %%^^A%% fontspec-doc-opentype.tex -- part of FONTSPEC <latex3.github.io/fontspec>
2
3
4 \documentclass[a4paper]{l3doc}
5 \usepackage{fontspec-doc-style}
6 \showexamplesfalse
7 \begin{document}
8
9 \part{OpenType}
10 \label{sec:opentype-features}
11
12 \section{Introduction}
13 \label{sec:opentype-features-intro}
14
15 OpenType fonts (and other `smart' font technologies such as AAT and Graphite) can change the appearance of text in many different ways.
16 These changes are referred to as font features.
17 When the user applies a feature~--- for example, small capitals~--- to a run of text, the code inside the font makes appropriate substitutions and small capitals appear in place of lowercase letters.
18 However, the use of such features does not affect the underlying text.
19 In our small caps example, the lowercase letters are still stored in the document; only the appearance has been changed by the OpenType feature.
20 This makes it possible to search and copy text without difficulty.
21 If the user selected a different font that does not support small caps, the `plain' lowercase letters would appear instead.
22
23 Some OpenType features are required to support particular scripts, and these features are often applied automatically.
24 The Indic scripts, for example, often require that characters be reshaped and reordered after they are typed by the user, in order to display them in the traditional ways that readers expect.
25 Other features can be applied to support a particular language.
26 The Junicode font for medievalists uses by default the Old English shape of the letter thorn, while in modern Icelandic thorn has a more rounded shape.
27 If a user tags some text as being in Icelandic, Junicode will automatically change to the Icelandic shape through an OpenType feature that localises the shapes of letters.
28
29 There are a large group of OpenType features, designed to support high quality typography a multitude of languages and writing scripts.
30 Examples of some font features have already been shown in previous sections; the complete set of OpenType font features supported by \pkg{fontspec} is described below in \ref{sec:ot-feat}.
31
32 The OpenType specification provides four-letter codes (e.g., \texttt{smcp} for small capitals) for each feature. The four-letter codes are given below along with the \pkg{fontspec} names for various features, for the benefit of people who are already familiar with OpenType. You can ignore the codes if they don't mean anything to you.
33
34
35 \subsection{How to select font features}
36
37 Font features are selected by a series of \meta{feature}=\meta{option}
38 selections. Features are (usually) grouped logically; for example, all
39 font features relating to ligatures are accessed by writing \verb|Ligatures={...}| with the appropriate argument(s), which could be \texttt{TeX}, \texttt{Rare}, etc., as shown below in \ref{sec:ot-feat-liga}.
40
41 Multiple options may be given to
42 any feature that accepts non-numerical input, although doing so will
43 not always work. Some options will override others in generally
44 obvious ways; \Verb|Numbers={OldStyle,Lining}| doesn't make much
45 sense because the two options are mutually exclusive, and \XeTeX\
46 will simply use the last option that is specified (in this case
47 using \opt{Lining} over \opt{OldStyle}).
48
49 If a feature or an option is requested that the font does not have,
50 a warning is given in the console output. As mentioned in \vref{sec:quiet-warnings}
51 these warnings can be suppressed by selecting the \texttt{[quiet]} package option.
52
53 \subsection{How do I know what font features are supported by my fonts?}
54
55 Although I've long desired to have a feature within \pkg{fontspec} to display the OpenType features within a font, it's never been high on my priority list.
56 One reason for that is the existence of the document |opentype-info.tex|, which is available on \textsc{ctan} or typing |kpsewhich opentype-info.tex| in a Terminal window.
57 Make a copy of this file and place it somewhere convenient.
58 Then open it in your regular \TeX\ editor and change the font name to the font you'd like to query; after running through plain \XeTeX, the output \textsc{pdf} will look something like this:
59
60 \begin{framed}
61
62 %%% From OpenType-info.tex %%%
63 \DeleteShortVerb\"
64 \def\myfontname{[Asana-Math.otf]}
65 \font\testfont="\myfontname/OT" at 10pt\relax
66
67 \rightskip=0pt plus 1fil
68
69 \font\titlefont=ec-lmssbx10 at 12pt
70 \font\tenrm=ec-lmss10 at 9pt \tenrm
71 \font\tentt=ec-lmtt10 at 9pt
72
73 \def\fourcharcode#1{\begingroup
74 \count0=#1\count1=\count0
75 \ifnum\count0=0
76 $\langle$default$\rangle$%
77 \else
78 \tentt
79 '%
80 \divide\count0 by "1000000
81 \char\count0
82 \multiply\count0 by "1000000
83 \advance\count1 by -\count0
84 \count0=\count1
85 \divide\count0 by "10000
86 \char\count0
87 \multiply\count0 by "10000
88 \advance\count1 by -\count0
89 \count0=\count1
90 \divide\count0 by "100
91 \char\count0
92 \multiply\count0 by "100
93 \advance\count1 by -\count0
94 \ifnum\count1=32 \ \else \char\count1 \fi
95 '%
96 \fi
97 \endgroup
98 }
99
100 \newcount\scriptcount
101 \newcount\scriptindex
102 \newcount\scripttag
103 \newcount\langcount
104 \newcount\langindex
105 \newcount\langtag
106 \newcount\featurecount
107 \newcount\featureindex
108 \newcount\featuretag
109
110 \leftline{\titlefont OpenType Layout features found in `\myfontname'}
111 \nobreak
112
113 \scriptcount=\XeTeXOTcountscripts\testfont
114 \ifnum\scriptcount=0 \noindent None\par\fi
115
116 \loop
117 \ifnum\scriptindex<\scriptcount
118 \smallskip
119 \scripttag=\XeTeXOTscripttag\testfont\scriptindex
120 \noindent script = \fourcharcode{\scripttag}\endgraf\nobreak
121 \langcount=\XeTeXOTcountlanguages\testfont\scripttag
122 \advance\langcount by 1 % one extra to get the default language system
123 {\loop
124 \langtag=\XeTeXOTlanguagetag\testfont\scripttag\langindex
125 \indent language = \fourcharcode{\langtag}\endgraf\nobreak
126 \featurecount=\XeTeXOTcountfeatures\testfont\scripttag\langtag
127 {\indent\indent \hangindent=3\parindent \hangafter=1 features = \loop
128 \featuretag=\XeTeXOTfeaturetag\testfont\scripttag\langtag\featureindex
129 \fourcharcode{\featuretag}
130 \advance\featureindex by 1
131 \ifnum\featureindex<\featurecount \repeat\endgraf}
132 \advance\langindex by 1
133 \ifnum\langindex<\langcount \medskip \repeat}
134 \advance\scriptindex by 1
135 \repeat
136 \end{framed}
137
138 \noindent I intentionally picked a font above that by design contains few font features; `regular' text fonts such as Latin Modern Roman contain many more, and I didn't want to clutter up the document too much.
139 After finding the scripts, languages, and features contained within the font, you'll then need to cross-check the OpenType tags with the `logical' names used by \pkg{fontspec}.
140
141 \paragraph{otfinfo}
142 Alternatively, and more simply, you can use the command line tool |otfinfo|, which is distributed with \TeX{}Live.
143 Simply type in a Terminal window, say:
144 \begin{Verbatim}
145 otfinfo -f `kpsewhich lmromandunh10-oblique.otf`
146 \end{Verbatim}
147 which results in:
148 \begin{Verbatim}[frame=single]
149 aalt Access All Alternates
150 cpsp Capital Spacing
151 dlig Discretionary Ligatures
152 frac Fractions
153 kern Kerning
154 liga Standard Ligatures
155 lnum Lining Figures
156 onum Oldstyle Figures
157 pnum Proportional Figures
158 size Optical Size
159 tnum Tabular Figures
160 zero Slashed Zero
161 \end{Verbatim}
162
163
164 \section{OpenType scripts and languages}\label{sec:ot}
165
166 Fonts that include glyphs for various scripts and languages may contain different font features for the different character sets and languages they support, and different font features may behave differently depending on the script or language chosen.
167 When multilingual fonts are used, it is important to select which language
168 they are being used for, and more importantly what script is being used.
169
170 The `script' refers to the alphabet in use; for example, both English
171 and French use the Latin script. Similarly, the Arabic script can be used
172 to write in both the Arabic and Persian languages.
173
174 The
175 \feat{Script} and \feat{Language} features are used to designate this information. The possible options are
176 tabulated in \vref{tab:ot-scpt} and \vref{tab:ot-lang},
177 respectively. When a script or language is requested that is not
178 supported by the current font, a warning is printed in the console output.
179 See \vref{sec:newscriptlang} for methods to create new \feat{Script} or \feat{Language}
180 options if required.
181
182 Because these font features can
183 change which features are able to be selected for the font, the \feat{Script} and \feat{Language}
184 settings are automatically selected
185 by \pkg{fontspec} before all others, and, if \XeTeX\ is being used, will
186 specifically select the \opt{OpenType}
187 renderer for this font, as described in \vref{sec:renderer-xetex}.
188
189 OpenType fonts can make available different font features depending on the Script and
190 Language chosen.
191 In addition, these settings can also set up their own font behaviour
192 and glyph selection (one example is differences in style between some of the letters in the
193 alphabet used for Bulgarian, Serbian, and Russian).
194 The \pkg{fontspec} feature \feat{LocalForms} \texttt{=} \opt{Off} will disable some of
195 these substitutions if desired for some reason.
196 It is important to note that \feat{LocalForms} \texttt{=} \opt{On} is a default not of \pkg{fontspec}
197 but of the underlying font shaping engines in both \XeTeX\ and \LuaTeX/\pkg{otfload}.
198
199
200 \subsection{\feat{Script} and \feat{Language} examples}
201
202 In the examples shown in \exref{script-lang},
203 the Code2000 font\note{\url{http://www.code2000.net/}}
204 is used to typeset various input texts with and without the OpenType Script
205 applied for various alphabets.
206 The text is only rendered correctly in the second case;
207 many examples of incorrect diacritic spacing as
208 well as a lack of contextual ligatures and rearrangement can be
209 seen.
210 Thanks to \name{Jonathan Kew}, \name{Yves Codet} and
211 \name{Gildas Hamel} for their contributions towards these examples.
212
213 \begin{Xexample}[firstline=14,lastline=23]{script-lang}{An example of various Scripts and Languages.}
214 \def\testfeature#1#2{%^^A
215 \fontspec{\examplefont}#2 & \fontspec[#1]{\examplefont}#2\\[1ex]}
216 \def \arabictext{العربي}
217 \def \devanagaritext{हिन्दी}
218 \def \bengalitext{লেখ}
219 \def \gujaratitext{મર્યાદા-સૂચક નિવેદન}
220 \def \malayalamtext{നമ്മുടെ പാരബര്യ}
221 \def \gurmukhitext{ਆਦਿ ਸਚੁ ਜੁਗਾਦਿ ਸਚੁ}
222 \def \tamiltext{தமிழ் தேடி}
223 \def \hebrewtext{רִדְתָּֽהּ}
224 \def \vietnamesetext{cấp số mỗi}
225 \begin{tabular}{r@{\quad}l}
226 \gdef\examplefont{CODE2000.TTF}
227 \testfeature{Script=Arabic}{\arabictext}
228 \testfeature{Script=Devanagari}{\devanagaritext}
229 \testfeature{Script=Bengali}{\bengalitext}
230 \testfeature{Script=Gujarati}{\gujaratitext}
231 \testfeature{Script=Malayalam}{\malayalamtext}
232 \testfeature{Script=Gurmukhi}{\gurmukhitext}
233 \testfeature{Script=Tamil}{\tamiltext}
234 \testfeature{Script=Hebrew}{\hebrewtext}
235 \def\examplefont{DoulosSILR.ttf}
236 \testfeature{Language=Vietnamese}{\vietnamesetext}
237 \end{tabular}
238 \end{Xexample}
239
240
241
242 \begin{table}[!hbp]
243 \caption{Defined \opt{Script}s for OpenType fonts. Aliased names are shown in adjacent positions marked with red pilcrows ({\sffamily\textcolor{red}{\P}}).}
244 \label{tab:ot-scpt}
245 \def\dup{\makebox[0pt][r]{\textcolor{red}{\P}}}
246 \setlength\columnseprule{0pt}
247 \hrule
248 \begin{multicols}{4}\setlength\parindent{0pt}
249 \sffamily\scriptsize
250 Adlam \par
251 Ahom \par
252 Anatolian Hieroglyphs \par
253 Arabic \par
254 Armenian \par
255 Avestan \par
256 Balinese \par
257 Bamum \par
258 Bassa Vah \par
259 Batak \par
260 Bengali \par
261 Bhaiksuki \par
262 Bopomofo \par
263 Brahmi \par
264 Braille \par
265 Buginese \par
266 Buhid \par
267 Byzantine Music \par
268 Canadian Syllabics \par
269 Carian \par
270 Caucasian Albanian \par
271 Chakma \par
272 Cham \par
273 Cherokee \par
274 \dup CJK \par
275 \dup CJK Ideographic \par
276 Coptic \par
277 Cypriot Syllabary \par
278 Cyrillic \par
279 Default \par
280 Deseret \par
281 Devanagari \par
282 Duployan \par
283 Egyptian Hieroglyphs \par
284 Elbasan \par
285 Ethiopic \par
286 Georgian \par
287 Glagolitic \par
288 Gothic \par
289 Grantha \par
290 Greek \par
291 Gujarati \par
292 Gurmukhi \par
293 Hangul Jamo \par
294 Hangul \par
295 Hanunoo \par
296 Hatran \par
297 Hebrew \par
298 \dup Hiragana and Katakana \par
299 \dup Kana \par
300 Imperial Aramaic \par
301 Inscriptional Pahlavi \par
302 Inscriptional Parthian \par
303 Javanese \par
304 Kaithi \par
305 Kannada \par
306 Kayah Li \par
307 Kharosthi \par
308 Khmer \par
309 Khojki \par
310 Khudawadi \par
311 Lao \par
312 Latin \par
313 Lepcha \par
314 Limbu \par
315 Linear A \par
316 Linear B \par
317 Lisu \par
318 Lycian \par
319 Lydian \par
320 Mahajani \par
321 Malayalam \par
322 Mandaic \par
323 Manichaean \par
324 Marchen \par
325 \dup Math \par
326 \dup Maths \par
327 Meitei Mayek \par
328 Mende Kikakui \par
329 Meroitic Cursive \par
330 Meroitic Hieroglyphs \par
331 Miao \par
332 Modi \par
333 Mongolian \par
334 Mro \par
335 Multani \par
336 Musical Symbols \par
337 Myanmar \par
338 \dup N'Ko \par
339 \dup N'ko \par
340 Nabataean \par
341 Newa \par
342 Ogham \par
343 Ol Chiki \par
344 Old Italic \par
345 Old Hungarian \par
346 Old North Arabian \par
347 Old Permic \par
348 Old Persian Cuneiform \par
349 Old South Arabian \par
350 Old Turkic \par
351 \dup Oriya \par
352 \dup Odia \par
353 Osage \par
354 Osmanya \par
355 Pahawh Hmong \par
356 Palmyrene \par
357 Pau Cin Hau \par
358 Phags-pa \par
359 Phoenician \par
360 Psalter Pahlavi \par
361 Rejang \par
362 Runic \par
363 Samaritan \par
364 Saurashtra \par
365 Sharada \par
366 Shavian \par
367 Siddham \par
368 Sign Writing \par
369 Sinhala \par
370 Sora Sompeng \par
371 Sumero-Akkadian Cuneiform \par
372 Sundanese \par
373 Syloti Nagri \par
374 Syriac \par
375 Tagalog \par
376 Tagbanwa \par
377 Tai Le \par
378 Tai Lu \par
379 Tai Tham \par
380 Tai Viet \par
381 Takri \par
382 Tamil \par
383 Tangut \par
384 Telugu \par
385 Thaana \par
386 Thai \par
387 Tibetan \par
388 Tifinagh \par
389 Tirhuta \par
390 Ugaritic Cuneiform \par
391 Vai \par
392 Warang Citi \par
393 Yi
394 \end{multicols}
395 \hrule
396 \end{table}
397
398 \begin{table}[p]
399 \vspace*{-3cm}
400 \hspace{-3cm}
401 \def\dup{\makebox[0pt][r]{\textcolor{red}{\P}}}
402 \begin{minipage}{\linewidth+4cm}
403 \caption{Defined \opt{Language}s for OpenType fonts. Aliased names are shown in adjacent positions marked with red pilcrows ({\sffamily\textcolor{red}{\P}}).}
404 \label{tab:ot-lang}
405 \setlength\columnseprule{0pt}
406 \hrule
407 \begin{multicols}{6}
408 \everypar{\setlength\parindent{0pt}\setlength\hangindent{2em}}
409 \sffamily\footnotesize\raggedright
410 Abaza \par
411 Abkhazian \par
412 Adyghe \par
413 Afrikaans \par
414 Afar \par
415 Agaw \par
416 Altai \par
417 Amharic \par
418 Arabic \par
419 Aari \par
420 Arakanese \par
421 Assamese \par
422 Athapaskan \par
423 Avar \par
424 Awadhi \par
425 Aymara \par
426 Azeri \par
427 Badaga \par
428 Baghelkhandi \par
429 Balkar \par
430 Baule \par
431 Berber \par
432 Bench \par
433 Bible Cree \par
434 Belarussian \par
435 Bemba \par
436 Bengali \par
437 Bulgarian \par
438 Bhili \par
439 Bhojpuri \par
440 Bikol \par
441 Bilen \par
442 Blackfoot \par
443 Balochi \par
444 Balante \par
445 Balti \par
446 Bambara \par
447 Bamileke \par
448 Breton \par
449 Brahui \par
450 Braj Bhasha \par
451 Burmese \par
452 Bashkir \par
453 Beti \par
454 Catalan \par
455 Cebuano \par
456 Chechen \par
457 Chaha Gurage \par
458 Chattisgarhi \par
459 Chichewa \par
460 Chukchi \par
461 Chipewyan \par
462 Cherokee \par
463 Chuvash \par
464 Comorian \par
465 Coptic \par
466 Cree \par
467 Carrier \par
468 Crimean Tatar \par
469 Church Slavonic \par
470 Czech \par
471 Danish \par
472 Dargwa \par
473 Woods Cree \par
474 German \par
475 Default \par
476 Dogri \par
477 Divehi \par
478 Djerma \par
479 Dangme \par
480 Dinka \par
481 Dungan \par
482 Dzongkha \par
483 Ebira \par
484 Eastern Cree \par
485 Edo \par
486 Efik \par
487 Greek \par
488 English \par
489 Erzya \par
490 Spanish \par
491 Estonian \par
492 Basque \par
493 Evenki \par
494 Even \par
495 Ewe \par
496 French Antillean \par
497 \dup Farsi \par
498 \dup Parsi \par
499 \dup Persian \par
500 Finnish \par
501 Fijian \par
502 Flemish \par
503 Forest Nenets \par
504 Fon \par
505 Faroese \par
506 French \par
507 Frisian \par
508 Friulian \par
509 Futa \par
510 Fulani \par
511 Ga \par
512 Gaelic \par
513 Gagauz \par
514 Galician \par
515 Garshuni \par
516 Garhwali \par
517 Ge'ez \par
518 Gilyak \par
519 Gumuz \par
520 Gondi \par
521 Greenlandic \par
522 Garo \par
523 Guarani \par
524 Gujarati \par
525 Haitian \par
526 Halam \par
527 Harauti \par
528 Hausa \par
529 Hawaiin \par
530 Hammer-Banna \par
531 Hiligaynon \par
532 Hindi \par
533 High Mari \par
534 Hindko \par
535 Ho \par
536 Harari \par
537 Croatian \par
538 Hungarian \par
539 Armenian \par
540 Igbo \par
541 Ijo \par
542 Ilokano \par
543 Indonesian \par
544 Ingush \par
545 Inuktitut \par
546 Irish \par
547 Irish Traditional \par
548 Icelandic \par
549 Inari Sami \par
550 Italian \par
551 Hebrew \par
552 Javanese \par
553 Yiddish \par
554 Japanese \par
555 Judezmo \par
556 Jula \par
557 Kabardian \par
558 Kachchi \par
559 Kalenjin \par
560 Kannada \par
561 Karachay \par
562 Georgian \par
563 Kazakh \par
564 Kebena \par
565 Khutsuri Georgian \par
566 Khakass \par
567 Khanty-Kazim \par
568 Khmer \par
569 Khanty-Shurishkar \par
570 Khanty-Vakhi \par
571 Khowar \par
572 Kikuyu \par
573 Kirghiz \par
574 Kisii \par
575 Kokni \par
576 Kalmyk \par
577 Kamba \par
578 Kumaoni \par
579 Komo \par
580 Komso \par
581 Kanuri \par
582 Kodagu \par
583 Korean Old Hangul \par
584 Konkani \par
585 Kikongo \par
586 Komi-Permyak \par
587 Korean \par
588 Komi-Zyrian \par
589 Kpelle \par
590 Krio \par
591 Karakalpak \par
592 Karelian \par
593 Karaim \par
594 Karen \par
595 Koorete \par
596 Kashmiri \par
597 Khasi \par
598 Kildin Sami \par
599 Kui \par
600 Kulvi \par
601 Kumyk \par
602 Kurdish \par
603 Kurukh \par
604 Kuy \par
605 Koryak \par
606 Ladin \par
607 Lahuli \par
608 Lak \par
609 Lambani \par
610 Lao \par
611 Latin \par
612 Laz \par
613 L-Cree \par
614 Ladakhi \par
615 Lezgi \par
616 Lingala \par
617 Low Mari \par
618 Limbu \par
619 Lomwe \par
620 Lower Sorbian \par
621 Lule Sami \par
622 Lithuanian \par
623 Luba \par
624 Luganda \par
625 Luhya \par
626 Luo \par
627 Latvian \par
628 Majang \par
629 Makua \par
630 Malayalam Traditional \par
631 Mansi \par
632 Marathi \par
633 Marwari \par
634 Mbundu \par
635 Manchu \par
636 Moose Cree \par
637 Mende \par
638 Me'en \par
639 Mizo \par
640 Macedonian \par
641 Male \par
642 Malagasy \par
643 Malinke \par
644 Malayalam Reformed \par
645 Malay \par
646 Mandinka \par
647 Mongolian \par
648 Manipuri \par
649 Maninka \par
650 Manx Gaelic \par
651 Moksha \par
652 Moldavian \par
653 Mon \par
654 Moroccan \par
655 Maori \par
656 Maithili \par
657 Maltese \par
658 Mundari \par
659 Naga-Assamese \par
660 Nanai \par
661 Naskapi \par
662 N-Cree \par
663 Ndebele \par
664 Ndonga \par
665 Nepali \par
666 Newari \par
667 Nagari \par
668 Norway House Cree \par
669 Nisi \par
670 Niuean \par
671 Nkole \par
672 N'ko \par
673 Dutch \par
674 Nogai \par
675 Norwegian \par
676 Northern Sami \par
677 Northern Tai \par
678 Esperanto \par
679 Nynorsk \par
680 Oji-Cree \par
681 Ojibway \par
682 Oriya \par
683 Oromo \par
684 Ossetian \par
685 Palestinian Aramaic \par
686 Pali \par
687 Punjabi \par
688 Palpa \par
689 Pashto \par
690 Polytonic Greek \par
691 Pilipino \par
692 Palaung \par
693 Polish \par
694 Provencal \par
695 Portuguese \par
696 Chin \par
697 Rajasthani \par
698 R-Cree \par
699 Russian Buriat \par
700 Riang \par
701 Rhaeto-Romanic \par
702 Romanian \par
703 Romany \par
704 Rusyn \par
705 Ruanda \par
706 Russian \par
707 Sadri \par
708 Sanskrit \par
709 Santali \par
710 Sayisi \par
711 Sekota \par
712 Selkup \par
713 Sango \par
714 Shan \par
715 Sibe \par
716 Sidamo \par
717 Silte Gurage \par
718 Skolt Sami \par
719 Slovak \par
720 Slavey \par
721 Slovenian \par
722 Somali \par
723 Samoan \par
724 Sena \par
725 Sindhi \par
726 Sinhalese \par
727 Soninke \par
728 Sodo Gurage \par
729 Sotho \par
730 Albanian \par
731 Serbian \par
732 Saraiki \par
733 Serer \par
734 South Slavey \par
735 Southern Sami \par
736 Suri \par
737 Svan \par
738 Swedish \par
739 Swadaya Aramaic \par
740 Swahili \par
741 Swazi \par
742 Sutu \par
743 Syriac \par
744 Tabasaran \par
745 Tajiki \par
746 Tamil \par
747 Tatar \par
748 TH-Cree \par
749 Telugu \par
750 Tongan \par
751 Tigre \par
752 Tigrinya \par
753 Thai \par
754 Tahitian \par
755 Tibetan \par
756 Turkmen \par
757 Temne \par
758 Tswana \par
759 Tundra Nenets \par
760 Tonga \par
761 Todo \par
762 Turkish \par
763 Tsonga \par
764 Turoyo Aramaic \par
765 Tulu \par
766 Tuvin \par
767 Twi \par
768 Udmurt \par
769 Ukrainian \par
770 Urdu \par
771 Upper Sorbian \par
772 Uyghur \par
773 Uzbek \par
774 Venda \par
775 Vietnamese \par
776 Wa \par
777 Wagdi \par
778 West-Cree \par
779 Welsh \par
780 Wolof \par
781 Tai Lue \par
782 Xhosa \par
783 Yakut \par
784 Yoruba \par
785 Y-Cree \par
786 Yi Classic \par
787 Yi Modern \par
788 Chinese Hong Kong \par
789 Chinese Phonetic \par
790 Chinese Simplified \par
791 Chinese Traditional \par
792 Zande \par
793 Zulu
794 \end{multicols}
795 \hspace{4pt}
796 \hrule
797 \end{minipage}
798 \end{table}
799
800
801 \section{OpenType font features}
802 \label{sec:ot-feat}
803
804 There are a finite set of OpenType font features, and \pkg{fontspec} provides an
805 interface to around half of them.
806 Full documentation will be presented in the following sections, including how to
807 enable and disable individual features, and how they interact.
808
809 A brief reference is provided (\vref{tab:all-ot}) but note that this is an incomplete
810 listing --- only the `enable' keys are shown, and where alternative interfaces are
811 provided for convenience only the first is shown.
812 (E.g., |Numbers=OldStyle| is the same as |Numbers=Lowercase|.)
813
814 For completeness, the complete list of OpenType features \emph{not} provided with
815 a \pkg{fontspec} interface is shown in \vref{tab:none-ot}.
816 Features omitted are partially by design and partially by oversight;
817 for example, the |aalt| feature is largely useless in \TeX\ since it is designed
818 for providing a \textsc{gui} interface for selecting `all alternates' of a glyph.
819 Others, such as optical bounds for example, simply haven't yet been considered
820 due to a lack of fonts available for testing.
821 Suggestions welcome for how/where to add these missing features to the package.
822
823 \ExplSyntaxOn
824 \def\allOTfeat{
825 \prop_map_inline:Nn \g__fontspec_all_opentype_feature_names_prop
826 { \opentypefeature{##1}{##2} }
827 }
828 \newcommand\opentypefeature[2]{
829 \prop_get:NnNT \g__fontspec_OT_features_prop {#1} \tmpa
830 {
831 \raggedright
832 \hangindent=5.2cm
833 \makebox[1cm][l]{\textsc{#1}}
834 \makebox[4.2cm][l]{
835 \int_compare:nT { \tl_count:N \tmpa > 25 } {\ttcondensed} {\ttfamily}
836 \tmpa
837 }
838 \textit{#2}
839 \par
840 \vspace{2pt}
841 }
842 }
843 \ExplSyntaxOff
844
845 \begin{table}
846 \caption{Summary of OpenType features in \textsf{fontspec}, alphabetic by feature tag.}
847 \label{tab:all-ot}
848 \centerline{%
849 \begin{minipage}{18cm}
850 \small
851 \hrule\smallskip
852 \begin{multicols}{2}
853 \parindent =0pt
854 \allOTfeat
855 \end{multicols}
856 \vspace*{-\smallskipamount}
857 \hrule
858 \end{minipage}}
859 \end{table}
860
861 \ExplSyntaxOn
862 \renewcommand\opentypefeature[2]{
863 \prop_get:NnNF \g__fontspec_OT_features_prop {#1} \tmpa
864 {
865 \raggedright
866 \hangindent=0.9cm
867 \makebox[0.9cm][l]{\textsc{#1}}%
868 \textit{#2}
869 \par
870 }
871 }
872 \ExplSyntaxOff
873
874 \begin{table}
875 \caption{List of \emph{unsupported} OpenType features.}
876 \label{tab:none-ot}
877 \bigskip
878 \centerline{%
879 \begin{minipage}{15cm}
880 \hrule\smallskip
881 \begin{multicols}{3}
882 \parindent =0pt
883 \allOTfeat
884 \end{multicols}
885 \vspace*{-\smallskipamount}
886 \hrule
887 \end{minipage}}
888 \end{table}
889
890 \subsection{Tag-based features}
891
892
893 \subsubsection{Alternates --- \texttt{salt}}
894
895 The \feat{Alternate} feature, alias \feat{StylisticAlternates}, is used to access alternate font glyphs when variations exist in the font, such as in \exref{salt}.
896 It uses a numerical selection, starting from zero, that will be different for each font.
897 Note that the \texttt{Style=Alternate} option is equivalent
898 to \texttt{Alternate=0} to access the default case.
899
900 \begin{Xexample}[firstline=2]{salt}{The \feat{Alternate} feature.}
901 \huge
902 \fontspec{LinLibertine_R.otf}
903 \textsc{a} \& h \\
904 \addfontfeature{Alternate=0}
905 \textsc{a} \& h
906 \end{Xexample}
907
908 Note that the indexing starts from zero.
909 With the \LuaTeX\ engine, |Alternate=Random| selects a random alternate.
910
911 See \vref{sec:newfeatures} for a way to assign names to alternates if desired.
912
913
914 \subsubsection{Character Variants --- \texttt{cvNN}}
915
916 `Character Variations' are selected
917 numerically to adjust the output of (usually) a single character for the
918 particular font. These correspond to the OpenType features |cv01| to |cv99|.
919
920 For each character that can be varied, it is possible to select among
921 possible options for that particular glyph.
922 For example, in the hypothetical example below, variants are chosen for glyphs `4' and `5',
923 and the trailing |:|\meta{n} corresponds to which variety to choose.
924 \begin{Verbatim}
925 \fontspec{CV Font}[CharacterVariant={4,5:2}] \& violet
926 \end{Verbatim}
927 The numbering is entirely font-specific. Glyph `5' might be the character `v', for example.
928 Character variants are specifically designed not to conflict with each
929 other, so you can enable them individually per character.
930 (Unlike stylistic alternates, say.)
931 Note that the indexing starts from zero.
932
933
934 \subsubsection{Contextuals}
935 This feature refers to substitutions of glyphs that vary `contextually' by their relative position in a word or string of characters;
936 features such as contextual swashes are accessed via the options shown in \ref{feat:Contextuals}.
937
938 \begin{features}{Contextuals}
939 \otf*{Swash}{cswh}
940 \otf*{Alternate}{calt}
941 \otf*{WordInitial}{init}
942 \otf*{WordFinal}{fina}
943 \otf*{LineFinal}{falt}
944 \otf*{Inner}{medi}
945 \cmidrule{2-4}
946 \otf{ResetAll}{}
947 \end{features}
948
949 Historic forms are accessed in OpenType
950 fonts via the feature \feat{Style=Historic}; this is generally \emph{not}
951 contextual in OpenType, which is why it is not included in this feature.
952
953
954 \subsubsection{Diacritics}
955
956 Specifies how combining diacritics should be placed.
957 These will usually be controlled automatically
958 according to the Script setting.
959
960 \begin{features}{Diacritics}
961 \otf*{MarkToBase}{mark}
962 \otf*{MarkToMark}{mkmk}
963 \otf*{AboveBase}{abvm}
964 \otf*{BelowBase}{blwm}
965 \cmidrule{2-4}
966 \otf{ResetAll}{}
967 \end{features}
968
969
970 \subsubsection{Fractions --- \texttt{frac}}
971
972 \begin{features}{Fractions}
973 \otf{On}{+frac}
974 \otf{Off}{-frac}
975 \otf{Reset}{}
976 \cmidrule{2-4}
977 \otf*{Alternate}{afrc}
978 \cmidrule{2-4}
979 \otf{ResetAll}{}
980 \end{features}
981
982 Activates the construction of `vulgar' fractions using precomposed glyphs and/or
983 subscript and superscript characters from within the font.
984 Coverage will vary by font; see \exref{ot-frac}.
985 Some (Asian fonts predominantly) also provide for the \opt{Alternate} option.
986
987 \begin{Lexample}{ot-frac}{The \feat{Fractions} feature.}
988 \setsansfont{IBMPlexSans-Regular.otf}[Fractions=On]
989 \setmonofont{IBMPlexMono-Regular.otf}[Fractions=On]
990
991 \sffamily 1/2 47/11 1/1000 \par
992 \ttfamily 1/2 47/11
993 \end{Lexample}
994
995
996
997 \subsubsection{Kerning --- \texttt{kern}}
998 \label{sec:kerning}
999
1000 Specifies how inter-glyph spacing should behave.
1001 Well-made fonts include information for how differing
1002 amounts of space should be inserted between separate character pairs.
1003 This kerning space is inserted automatically but in rare
1004 circumstances you may wish to turn it off.
1005
1006 \begin{features}{Kerning}
1007 \otf{On}{+kern}
1008 \otf{Off}{-kern}
1009 \otf{Reset}{}
1010 \cmidrule{2-4}
1011 \otf*{Uppercase}{cpsp}
1012 \cmidrule{2-4}
1013 \otf{ResetAll}{}
1014 \end{features}
1015
1016 As briefly mentioned previously at the end of \vref{sec:letters},
1017 the \opt{Uppercase} option will add a small amount of tracking between
1018 uppercase letters, seen in \exref{kernup}, which uses the Romande
1019 fonts\note{\url{http://arkandis.tuxfamily.org/adffonts.html}}
1020 (thanks to Clea F. Rees for the suggestion).
1021 The \opt{Uppercase} option acts separately to the regular kerning
1022 controlled by the \opt{On}/\opt{Off} options.
1023
1024 \begin{Xexample}[firstline=2]{kernup}{Adding extra kerning for uppercase letters. (The difference is usually very small.)}
1025 \large
1026 \fontspec{RomandeADFStd-DemiBold.otf}
1027 UPPERCASE EXAMPLE \\
1028 \addfontfeature{Kerning=Uppercase}
1029 UPPERCASE EXAMPLE
1030 \end{Xexample}
1031
1032
1033 \subsubsection{Letters} \label{sec:letters}
1034 The \opt{Letters} feature specifies how the letters in the current font
1035 will look. OpenType fonts may contain the following options:
1036 \opt{SmallCaps}, \opt{PetiteCaps},
1037 \opt{UppercaseSmallCaps}, \opt{UppercasePetiteCaps}, and
1038 \opt{Unicase}.
1039 Additionally \opt{Uppercase} and \opt{Lowercase} are supported for all fonts
1040 in \LuaTeX.
1041 In contrast to earlier version, the \opt{Uppercase} and \opt{Lowercase} options
1042 turn the text into uppercase or lowercase and do not require the text to already
1043 have the right casing. The old behavior of \opt{Uppercase} is available with
1044 \verb|Style=Uppercase|. When the \opt{Uppercase} option is selected,
1045 \verb|Style=Uppercase| and \verb|Kerning=Uppercase| are automatically applied if
1046 supported by the font.
1047
1048
1049 \begin{features}{Letters}
1050 \otf*{SmallCaps}{smcp}
1051 \otf*{PetiteCaps}{pcap}
1052 \otf*{UppercaseSmallCaps}{c2sc}
1053 \otf*{UppercasePetiteCaps}{c2pc}
1054 \otf*{Unicase}{unic}
1055 \otf*{Uppercase}{}
1056 \otf*{Lowercase}{}
1057 \cmidrule{2-4}
1058 \otf{ResetAll}{}
1059 \end{features}
1060
1061 Petite caps are smaller than small caps.
1062 \opt{SmallCaps} and \opt{PetiteCaps}
1063 turn lowercase letters into the smaller caps letters,
1064 whereas the \opt{Uppercase...} options turn the \emph{capital} letters into
1065 the smaller
1066 caps (good, \eg, for applying to already uppercase acronyms like
1067 `NASA').
1068 This difference is shown in \exref{caps}.
1069 `Unicase' is a weird hybrid of upper and lower case letters.
1070
1071 \begin{Lexample}{caps}{Small caps from lowercase or uppercase letters.}
1072 \fontspec{Coelac.otf}[Letters=SmallCaps]
1073 THIS SENTENCE no verb \\
1074 \fontspec{Coelac.otf}[Letters=UppercaseSmallCaps]
1075 THIS SENTENCE no verb \\
1076 \fontspec{Coelac.otf}[Letters=PetiteCaps]
1077 THIS SENTENCE no verb
1078 \end{Lexample}
1079
1080
1081
1082 \subsubsection{Ligatures}
1083 \label{sec:ot-feat-liga}
1084
1085 \feat{Ligatures} refer to the replacement of two separate characters
1086 with a specially drawn glyph for functional or \ae sthetic reasons.
1087 The list of options, of which multiple may be selected at one time,
1088 is shown in \ref{feat:Ligatures}.
1089 A demonstration with the Linux Libertine fonts\note{\url{http://www.linuxlibertine.org/}} is shown in \exref{lig}.
1090
1091 Note the additional features accessed with \verb|Ligatures=TeX|. These are
1092 not actually real OpenType features, but additions provided by \pkg{luaotfload} (i.e., \LuaTeX\ only) to emulate \TeX's behaviour for \textsc{ascii} input of curly quotes and punctuation. In \XeTeX\ this is achieved with the \feat{Mapping} feature (see \vref{sec:mapping}) but for consistency \verb|Ligatures=TeX| will perform the same function as \verb|Mapping=tex-text|.
1093
1094 \begin{features}{Ligatures}
1095 \otf*{Required}{rlig}
1096 \otf*{Common}{liga}
1097 \otf*{Contextual}{clig}
1098 \otf*{Rare/Discretionary}{dlig}
1099 \otf*{Historic}{hlig}
1100 \otf*{TeX}{tlig}
1101 \cmidrule{2-4}
1102 \otf{ResetAll}{}
1103 \end{features}
1104
1105 \begin{Lexample}[firstline=2]{lig}{An example of the \feat{Ligatures} feature.}
1106 \Huge\centering
1107 \def\test#1#2{%
1108 #2 $\to$ {\addfontfeature{#1} #2}\\}
1109 \fontspec{LinLibertine_R.otf}
1110 \test{Ligatures=Historic}{strict}
1111 \test{Ligatures=Rare}{wurtzite}
1112 \test{Ligatures=CommonOff}{firefly}
1113 \end{Lexample}
1114
1115
1116 \subsubsection{Localised Forms --- \texttt{locl}}
1117
1118 \begin{features}{LocalForms}
1119 \otf{On}{+locl}
1120 \otf{Off}{-locl}
1121 \otf{Reset}{}
1122 \end{features}
1123
1124 This feature enables and disables glyph substitutions, etc., that are specific to the
1125 \feat{Language} selected in the font.
1126 This feature is automatically activated by default when present,
1127 so it should not be generally necessary to use \feat{LocalForms} \texttt{=} \opt{On}.
1128 In certain scenarios it may be important to turn it \opt{Off} (although nothing specifically springs to mind).
1129
1130
1131 \subsubsection{Numbers}
1132
1133 The \feat{Numbers} feature defines how numbers will look in the
1134 selected font, accepting options shown in \ref{feat:Numbers}.
1135
1136 \begin{features}{Numbers}
1137 \otf*{Uppercase}{lnum}
1138 \otf*{Lowercase}{onum}
1139 \otf*{Lining}{lnum}
1140 \otf*{OldStyle}{onum}
1141 \otf*{Proportional}{pnum}
1142 \otf*{Monospaced}{tnum}
1143 \otf*{SlashedZero}{zero}
1144 \otf*{Arabic}{anum}
1145 \cmidrule{2-4}
1146 \otf{ResetAll}{}
1147 \end{features}
1148
1149 The synonyms
1150 \opt{Uppercase} and \opt{Lowercase} are equivalent to \opt{Lining} and
1151 \opt{OldStyle}, respectively.
1152 The differences have been shown previously
1153 in \vref{sec:addfontfeatures}.
1154 The \opt{Monospaced} option is useful for tabular material when digits need
1155 to be vertically aligned.
1156
1157 The \opt{SlashedZero} option
1158 replaces the default zero with a slashed version to prevent
1159 confusion with an uppercase `O', shown in \exref{slashzero}.
1160
1161 \begin{Lexample}{slashzero}{The effect of the \opt{SlashedZero} option.}
1162 \fontspec[Numbers=Lining]{texgyrebonum-regular.otf}
1163 0123456789
1164 \fontspec[Numbers=SlashedZero]{texgyrebonum-regular.otf}
1165 0123456789
1166 \end{Lexample}
1167
1168 The \opt{Arabic} option (with tag \verb|anum|) maps regular numerals to their Arabic script or Persian equivalents
1169 based on the current \opt{Language} setting (see \vref{sec:ot}).
1170 This option is based on a \LuaTeX\ feature of the \pkg{luaotfload} package,
1171 not an OpenType feature. (Thus, this feature is unavailable in \XeTeX.)
1172 This feature should be considered deprecated; while there are no plans to remove it from this package,
1173 if its support is dropped from the font loader it could disappear from \pkg{fontspec} with little notice.
1174
1175
1176 \subsubsection{Ornament --- \texttt{ornm}}
1177
1178 Ornaments are selected with the \feat{Ornament} feature (OpenType feature |ornm|),
1179 selected numerically such as for the \feat{Annotation} feature.
1180
1181
1182 \subsubsection{Style}
1183 \label{sec:ot-feat-style}
1184
1185 \begin{features}{Style}
1186 \otf*{Alternate}{salt}
1187 \otf*{Cursive}{curs}
1188 \otf*{Historic}{hist}
1189 \otf*{Italic}{ital}
1190 \otf*{Ruby}{ruby}
1191 \otf*{Swash}{swsh}
1192 \otf*{Titling}{titl}
1193 \otf*{Uppercase}{case}
1194 \otf*{HorizontalKana}{hkna}
1195 \otf*{VerticalKana}{vkna}
1196 \cmidrule{2-4}
1197 \otf{ResetAll}{}
1198 \end{features}
1199
1200 `Ruby' refers to a small optical size, used in
1201 Japanese typography for annotations.
1202 For fonts with multiple |salt| OpenType features,
1203 use the fontspec \feat{Alternate} feature instead.
1204
1205 \Exref{style-alt} shows an example of a font feature that involves glyph substitution
1206 for particular letters within an alphabet.
1207 Other options in these categories operate in similar ways, with the choice of how
1208 particular substitutions are organised with which feature largely up to the font designer.
1209
1210 \begin{Xexample}[firstline=2]{style-alt}{Example of the \opt{Alternate} option of the \feat{Style} feature.}
1211 \Large
1212 \fontspec{Quattrocento-Regular.ttf}
1213 M Q W \\
1214 \addfontfeature{Style=Alternate}
1215 M Q W
1216 \end{Xexample}
1217
1218 The \opt{Uppercase} option is designed to select various
1219 uppercase forms for glyphs such as accents and dashes, such as shown
1220 in \exref{style-uppercase}; note the raised position of the hyphen
1221 to better match the surrounding letters.
1222 It will (probably) not actually map letters to uppercase.
1223 \note{If you want automatic uppercase letters, look to \LaTeX's
1224 \cmd\MakeUppercase\ command or, when using \LuaTeX, to the \feat{Letters} feature.}
1225 This option used to be selected under the \feat{Letters} feature, but moved here
1226 as it generally does not actually affect the letters themselves.
1227 The \feat{Kerning} feature also contains an \opt{Uppercase} option,
1228 which adds a small amount of spacing in between letters (see \vref{sec:kerning}).
1229
1230 \begin{Lexample}{style-uppercase}{An example of the \opt{Uppercase} option of the \feat{Style} feature.}
1231 \fontspec{LinLibertine_R.otf}
1232 UPPER-CASE example \\
1233 \addfontfeature{Style=Uppercase}
1234 UPPER-CASE example
1235 \end{Lexample}
1236
1237
1238 In other features, larger breadths of changes can be seen, covering
1239 the style of an entire alphabet.
1240 For instance, in some Japanese fonts features such as |Style=Italic| or |Style=Ruby|
1241 respectively change the style of all Latin characters to italic or all Hiragana characters to a darker optical shape:
1242 \begin{Verbatim}[firstline=2]
1243 \Large \def\kana{ようこそ ワカヨタレソ}
1244 \fontspec{Hiragino Mincho Pro}
1245 Latin \kana \\
1246 \addfontfeature{Style={Italic, Ruby}}
1247 Latin \kana
1248 \end{Verbatim}
1249
1250
1251 \subsubsection{Stylistic Set variations --- \texttt{ssNN}}
1252 \label{sec:ot-ss}
1253
1254 This feature selects a `Stylistic Set' variation,
1255 which usually corresponds to an alternate glyph style for a range of
1256 characters (usually an alphabet or subset thereof).
1257 This feature is specified numerically. These correspond to OpenType
1258 features |ss01|, |ss02|, etc.
1259
1260 Two demonstrations from the Junicode
1261 font\note{\url{http://junicode.sf.net}}
1262 are shown in \exref{ss} and \exref{ss2}; thanks to Adam
1263 Buchbinder for the suggestion.
1264
1265 \begin{Lexample}{ss}{Insular letterforms, as used in medieval Northern Europe, for the Junicode font accessed with the \feat{StylisticSet} feature.}
1266 \fontspec{Junicode}
1267 Insular forms. \\
1268 \addfontfeature{StylisticSet=2}
1269 Insular forms. \\
1270 \end{Lexample}
1271
1272 \begin{Lexample}{ss2}{Enlarged minuscules (capital letters remain unchanged) for the Junicode font, accessed with the \feat{StylisticSet} feature.}
1273 \fontspec{Junicode}
1274 ENLARGED Minuscules. \\
1275 \addfontfeature{StylisticSet=6}
1276 ENLARGED Minuscules. \\
1277 \end{Lexample}
1278
1279 Multiple stylistic sets may be selected simultaneously by writing, e.g.,
1280 |StylisticSet={1,2,3}|.
1281
1282 The |StylisticSet| feature is a synonym of the \feat{Variant} feature for \AAT\ fonts.
1283 See \vref{sec:newfeatures} for a way to assign names to stylistic sets, which should be done on a per-font basis.
1284
1285
1286 \subsubsection{Vertical Position}
1287
1288 \begin{features}{VerticalPosition}
1289 \otf*{Superior}{sups}
1290 \otf*{Inferior}{subs}
1291 \otf*{Numerator}{numr}
1292 \otf*{Denominator}{dnom}
1293 \otf*{ScientificInferior}{sinf}
1294 \otf*{Ordinal}{ordn}
1295 \cmidrule{2-4}
1296 \otf{ResetAll}{}
1297 \end{features}
1298
1299 The \feat{VerticalPosition} feature is used to access things like
1300 subscript (\opt{Inferior}) and superscript (\opt{Superior}) numbers and
1301 letters (and a small amount of punctuation, sometimes).
1302 The \opt{Ordinal} option will only raise characters that are used
1303 in some languages directly after a number.
1304 The \opt{ScientificInferior} feature will move glyphs
1305 further below the baseline than the \opt{Inferior} feature.
1306 These are shown in \exref{vertpos}
1307
1308 \opt{Numerator} and \opt{Denominator} should only be used for creating
1309 arbitrary fractions (see next section).
1310
1311 \begin{Lexample}{vertpos}{The \feat{VerticalPosition} feature.}
1312 \fontspec{LibreCaslonText-Regular.otf}[VerticalPosition=Superior]
1313 Superior: 1234567890 \\
1314 \fontspec{LibreCaslonText-Regular.otf}[VerticalPosition=Numerator]
1315 Numerator: 12345 \\
1316 \fontspec{LibreCaslonText-Regular.otf}[VerticalPosition=Denominator]
1317 Denominator: 12345 \\
1318 \fontspec{LibreCaslonText-Regular.otf}[VerticalPosition=ScientificInferior]
1319 Scientific Inferior: 12345
1320 \end{Lexample}
1321
1322 The \pkg{realscripts} package
1323 (which is also loaded by \pkg{xltxtra} for \XeTeX)
1324 redefines the \cmd\textsubscript\ and
1325 \cmd\textsuperscript\ commands to use the above font features automatically,
1326 including for use in footnote labels.
1327 If this is the only feature of \pkg{xltxtra} you wish to use, consider
1328 loading \pkg{realscripts} on its own instead.
1329
1330
1331
1332 \subsection{CJK features}
1333
1334 This section summarises the features which are largely intending for Chinese, Korean,
1335 and Japanese typesetting.
1336
1337
1338 \subsubsection{Annotation --- \texttt{nalt} }
1339
1340 Some fonts are equipped with an extensive range of
1341 numbers and numerals in different forms. These are accessed with the
1342 \feat{Annotation} feature (OpenType feature |nalt|), selected numerically.
1343 Note that the indexing starts from zero.
1344 \begin{Verbatim}
1345 \fontspec{Hiragino Maru Gothic Pro}
1346 1 2 3 4 5 6 7 8 9
1347 \def\x#1{\\{\addfontfeature{Annotation=#1}
1348 1 2 3 4 5 6 7 8 9 }}
1349 \x0\x1\x2\x3\x4\x5\x6\x7\x7\x8\x9
1350 \end{Verbatim}
1351
1352
1353 \subsubsection{Character width}\label{sec:CharacterWidth}
1354
1355 Many Asian fonts are equipped with variously spaced characters for
1356 shoe-horning into their generally monospaced text.
1357 These are
1358 accessed through the \feat{CharacterWidth} feature.
1359
1360 \begin{features}{CharacterWidth}
1361 \otf*{Proportional}{pwid}
1362 \otf*{Full} {fwid}
1363 \otf*{Half} {hwid}
1364 \otf*{Third} {twid}
1365 \otf*{Quarter} {qwid}
1366 \otf*{AlternateProportional}{palt}
1367 \otf*{AlternateHalf}{halt}
1368 \cmidrule{2-4}
1369 \otf{ResetAll}{}
1370 \end{features}
1371
1372 Japanese alphabetic glyphs (in Hiragana or Katakana) may be typeset
1373 proportionally, to better fit horizontal measures, or monospaced, to
1374 fit into the rigid grid imposed by ideographic typesetting. In this
1375 latter case, there are also half-width forms for squeezing more kana
1376 glyphs (which are less complex than the kanji they are amongst) into
1377 a given block of space. The same features are given to roman letters
1378 in Japanese fonts, for typesetting foreign words in the same style
1379 as the surrounding text. Example omitted until I find an open source
1380 font which supports these features.
1381 %\begin{Verbatim}
1382 % \def\texta{ようこそ}\def\textb{ワカヨタレソ}
1383 % \def\test{\makebox[2cm][l]{\texta}%
1384 % \makebox[2.5cm][l]{\textb}%
1385 % \makebox[2.5cm][l]{abcdef}}
1386 % \fontspec{Hiragino Mincho Pro}
1387 % {\addfontfeature{CharacterWidth=Proportional}\test}\\
1388 % {\addfontfeature{CharacterWidth=Full}\test}\\
1389 % {\addfontfeature{CharacterWidth=Half}\test}
1390 %\end{Verbatim}
1391
1392
1393
1394
1395 \subsubsection{CJK shape}
1396
1397 \begin{features}{CJKShape}
1398 \otf{Traditional}{trad}
1399 \otf{Simplified} {smpl}
1400 \otf{JIS1978} {jp78}
1401 \otf{JIS1983} {jp83}
1402 \otf{JIS1990} {jp90}
1403 \otf{Expert} {expt}
1404 \otf{NLC} {nlck}
1405 \end{features}
1406
1407 There have been many standards for how CJK ideographic
1408 glyphs are `supposed' to look. Some fonts will contain many alternate
1409 glyphs available in order to be able to display these glyphs
1410 correctly in whichever form is appropriate. Both \AAT\ and OpenType
1411 fonts support the following \feat{CJKShape} options:
1412 \opt{Traditional}, \opt{Simplified}, \opt{JIS1978}, \opt{JIS1983},
1413 \opt{JIS1990}, and \opt{Expert}. OpenType also supports the \opt{NLC} option.
1414
1415 \begin{Xexample}[firstline=2]{ot-cjk-shape}{Different standards for CJK ideograph presentation.}
1416 \LARGE\def\text{\noindent 唖噛躯 妍并訝}
1417 \fontspec{NotoSansJP-Regular.ttf}
1418 {\addfontfeature{CJKShape=Traditional}
1419 \text } \\
1420 {\addfontfeature{CJKShape=NLC}
1421 \text }
1422 \end{Xexample}
1423
1424
1425 \subsubsection{Vertical typesetting}
1426
1427 \begin{features}{Vertical}
1428 \otf*{RotatedGlyphs} {vrt2}
1429 \otf*{AlternatesForRotation} {vrtr}
1430 \otf*{Alternates} {vert}
1431 \otf*{KanaAlternates} {vkna}
1432 \otf*{Kerning} {vkrn}
1433 \otf*{AlternateMetrics} {valt}
1434 \otf*{HalfMetrics} {vhal}
1435 \otf*{ProportionalMetrics} {vpal}
1436 \cmidrule{2-4}
1437 \otf{ResetAll}{}
1438 \end{features}
1439
1440 OpenType provides a plethora of features for accommodating the varieties of possibilities
1441 needed for vertical typesetting (CJK and others).
1442 No capabilities for achieving such vertical typesetting are provided by \pkg{fontspec},
1443 however; please get in touch if there are improvements that could be made.
1444
1445
1446 \end{document}
1447
1448 % /©
1449 % ------------------------------------------------
1450 % The FONTSPEC package <latex3.github.io/fontspec>
1451 % ------------------------------------------------
1452 % Copyright 2022-2025 The LaTeX project, LPPL "maintainer"
1453 % Copyright 2004-2022 Will Robertson
1454 % Copyright 2009-2015 Khaled Hosny
1455 % Copyright 2013 Philipp Gesang
1456 % Copyright 2013-2016 Joseph Wright
1457 % ------------------------------------------------
1458 % This package is free software and may be redistributed and/or modified under
1459 % the conditions of the LaTeX Project Public License, version 1.3c or higher
1460 % (your choice): <http://www.latex-project.org/lppl/>.
1461 % ------------------------------------------------
1462 % ©/