-
Notifications
You must be signed in to change notification settings - Fork 34
/
fontspec-doc-opentype.tex
1462 lines (1301 loc) · 43.2 KB
/
fontspec-doc-opentype.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%^^A%% fontspec-doc-opentype.tex -- part of FONTSPEC <latex3.github.io/fontspec>
\documentclass[a4paper]{l3doc}
\usepackage{fontspec-doc-style}
\showexamplesfalse
\begin{document}
\part{OpenType}
\label{sec:opentype-features}
\section{Introduction}
\label{sec:opentype-features-intro}
OpenType fonts (and other `smart' font technologies such as AAT and Graphite) can change the appearance of text in many different ways.
These changes are referred to as font features.
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.
However, the use of such features does not affect the underlying text.
In our small caps example, the lowercase letters are still stored in the document; only the appearance has been changed by the OpenType feature.
This makes it possible to search and copy text without difficulty.
If the user selected a different font that does not support small caps, the `plain' lowercase letters would appear instead.
Some OpenType features are required to support particular scripts, and these features are often applied automatically.
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.
Other features can be applied to support a particular language.
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.
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.
There are a large group of OpenType features, designed to support high quality typography a multitude of languages and writing scripts.
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}.
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.
\subsection{How to select font features}
Font features are selected by a series of \meta{feature}=\meta{option}
selections. Features are (usually) grouped logically; for example, all
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}.
Multiple options may be given to
any feature that accepts non-numerical input, although doing so will
not always work. Some options will override others in generally
obvious ways; \Verb|Numbers={OldStyle,Lining}| doesn't make much
sense because the two options are mutually exclusive, and \XeTeX\
will simply use the last option that is specified (in this case
using \opt{Lining} over \opt{OldStyle}).
If a feature or an option is requested that the font does not have,
a warning is given in the console output. As mentioned in \vref{sec:quiet-warnings}
these warnings can be suppressed by selecting the \texttt{[quiet]} package option.
\subsection{How do I know what font features are supported by my fonts?}
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.
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.
Make a copy of this file and place it somewhere convenient.
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:
\begin{framed}
%%% From OpenType-info.tex %%%
\DeleteShortVerb\"
\def\myfontname{[Asana-Math.otf]}
\font\testfont="\myfontname/OT" at 10pt\relax
\rightskip=0pt plus 1fil
\font\titlefont=ec-lmssbx10 at 12pt
\font\tenrm=ec-lmss10 at 9pt \tenrm
\font\tentt=ec-lmtt10 at 9pt
\def\fourcharcode#1{\begingroup
\count0=#1\count1=\count0
\ifnum\count0=0
$\langle$default$\rangle$%
\else
\tentt
'%
\divide\count0 by "1000000
\char\count0
\multiply\count0 by "1000000
\advance\count1 by -\count0
\count0=\count1
\divide\count0 by "10000
\char\count0
\multiply\count0 by "10000
\advance\count1 by -\count0
\count0=\count1
\divide\count0 by "100
\char\count0
\multiply\count0 by "100
\advance\count1 by -\count0
\ifnum\count1=32 \ \else \char\count1 \fi
'%
\fi
\endgroup
}
\newcount\scriptcount
\newcount\scriptindex
\newcount\scripttag
\newcount\langcount
\newcount\langindex
\newcount\langtag
\newcount\featurecount
\newcount\featureindex
\newcount\featuretag
\leftline{\titlefont OpenType Layout features found in `\myfontname'}
\nobreak
\scriptcount=\XeTeXOTcountscripts\testfont
\ifnum\scriptcount=0 \noindent None\par\fi
\loop
\ifnum\scriptindex<\scriptcount
\smallskip
\scripttag=\XeTeXOTscripttag\testfont\scriptindex
\noindent script = \fourcharcode{\scripttag}\endgraf\nobreak
\langcount=\XeTeXOTcountlanguages\testfont\scripttag
\advance\langcount by 1 % one extra to get the default language system
{\loop
\langtag=\XeTeXOTlanguagetag\testfont\scripttag\langindex
\indent language = \fourcharcode{\langtag}\endgraf\nobreak
\featurecount=\XeTeXOTcountfeatures\testfont\scripttag\langtag
{\indent\indent \hangindent=3\parindent \hangafter=1 features = \loop
\featuretag=\XeTeXOTfeaturetag\testfont\scripttag\langtag\featureindex
\fourcharcode{\featuretag}
\advance\featureindex by 1
\ifnum\featureindex<\featurecount \repeat\endgraf}
\advance\langindex by 1
\ifnum\langindex<\langcount \medskip \repeat}
\advance\scriptindex by 1
\repeat
\end{framed}
\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.
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}.
\paragraph{otfinfo}
Alternatively, and more simply, you can use the command line tool |otfinfo|, which is distributed with \TeX{}Live.
Simply type in a Terminal window, say:
\begin{Verbatim}
otfinfo -f `kpsewhich lmromandunh10-oblique.otf`
\end{Verbatim}
which results in:
\begin{Verbatim}[frame=single]
aalt Access All Alternates
cpsp Capital Spacing
dlig Discretionary Ligatures
frac Fractions
kern Kerning
liga Standard Ligatures
lnum Lining Figures
onum Oldstyle Figures
pnum Proportional Figures
size Optical Size
tnum Tabular Figures
zero Slashed Zero
\end{Verbatim}
\section{OpenType scripts and languages}\label{sec:ot}
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.
When multilingual fonts are used, it is important to select which language
they are being used for, and more importantly what script is being used.
The `script' refers to the alphabet in use; for example, both English
and French use the Latin script. Similarly, the Arabic script can be used
to write in both the Arabic and Persian languages.
The
\feat{Script} and \feat{Language} features are used to designate this information. The possible options are
tabulated in \vref{tab:ot-scpt} and \vref{tab:ot-lang},
respectively. When a script or language is requested that is not
supported by the current font, a warning is printed in the console output.
See \vref{sec:newscriptlang} for methods to create new \feat{Script} or \feat{Language}
options if required.
Because these font features can
change which features are able to be selected for the font, the \feat{Script} and \feat{Language}
settings are automatically selected
by \pkg{fontspec} before all others, and, if \XeTeX\ is being used, will
specifically select the \opt{OpenType}
renderer for this font, as described in \vref{sec:renderer-xetex}.
OpenType fonts can make available different font features depending on the Script and
Language chosen.
In addition, these settings can also set up their own font behaviour
and glyph selection (one example is differences in style between some of the letters in the
alphabet used for Bulgarian, Serbian, and Russian).
The \pkg{fontspec} feature \feat{LocalForms} \texttt{=} \opt{Off} will disable some of
these substitutions if desired for some reason.
It is important to note that \feat{LocalForms} \texttt{=} \opt{On} is a default not of \pkg{fontspec}
but of the underlying font shaping engines in both \XeTeX\ and \LuaTeX/\pkg{otfload}.
\subsection{\feat{Script} and \feat{Language} examples}
In the examples shown in \exref{script-lang},
the Code2000 font\note{\url{http://www.code2000.net/}}
is used to typeset various input texts with and without the OpenType Script
applied for various alphabets.
The text is only rendered correctly in the second case;
many examples of incorrect diacritic spacing as
well as a lack of contextual ligatures and rearrangement can be
seen.
Thanks to \name{Jonathan Kew}, \name{Yves Codet} and
\name{Gildas Hamel} for their contributions towards these examples.
\begin{Xexample}[firstline=14,lastline=23]{script-lang}{An example of various Scripts and Languages.}
\def\testfeature#1#2{%^^A
\fontspec{\examplefont}#2 & \fontspec[#1]{\examplefont}#2\\[1ex]}
\def \arabictext{العربي}
\def \devanagaritext{हिन्दी}
\def \bengalitext{লেখ}
\def \gujaratitext{મર્યાદા-સૂચક નિવેદન}
\def \malayalamtext{നമ്മുടെ പാരബര്യ}
\def \gurmukhitext{ਆਦਿ ਸਚੁ ਜੁਗਾਦਿ ਸਚੁ}
\def \tamiltext{தமிழ் தேடி}
\def \hebrewtext{רִדְתָּֽהּ}
\def \vietnamesetext{cấp số mỗi}
\begin{tabular}{r@{\quad}l}
\gdef\examplefont{CODE2000.TTF}
\testfeature{Script=Arabic}{\arabictext}
\testfeature{Script=Devanagari}{\devanagaritext}
\testfeature{Script=Bengali}{\bengalitext}
\testfeature{Script=Gujarati}{\gujaratitext}
\testfeature{Script=Malayalam}{\malayalamtext}
\testfeature{Script=Gurmukhi}{\gurmukhitext}
\testfeature{Script=Tamil}{\tamiltext}
\testfeature{Script=Hebrew}{\hebrewtext}
\def\examplefont{DoulosSILR.ttf}
\testfeature{Language=Vietnamese}{\vietnamesetext}
\end{tabular}
\end{Xexample}
\begin{table}[!hbp]
\caption{Defined \opt{Script}s for OpenType fonts. Aliased names are shown in adjacent positions marked with red pilcrows ({\sffamily\textcolor{red}{\P}}).}
\label{tab:ot-scpt}
\def\dup{\makebox[0pt][r]{\textcolor{red}{\P}}}
\setlength\columnseprule{0pt}
\hrule
\begin{multicols}{4}\setlength\parindent{0pt}
\sffamily\scriptsize
Adlam \par
Ahom \par
Anatolian Hieroglyphs \par
Arabic \par
Armenian \par
Avestan \par
Balinese \par
Bamum \par
Bassa Vah \par
Batak \par
Bengali \par
Bhaiksuki \par
Bopomofo \par
Brahmi \par
Braille \par
Buginese \par
Buhid \par
Byzantine Music \par
Canadian Syllabics \par
Carian \par
Caucasian Albanian \par
Chakma \par
Cham \par
Cherokee \par
\dup CJK \par
\dup CJK Ideographic \par
Coptic \par
Cypriot Syllabary \par
Cyrillic \par
Default \par
Deseret \par
Devanagari \par
Duployan \par
Egyptian Hieroglyphs \par
Elbasan \par
Ethiopic \par
Georgian \par
Glagolitic \par
Gothic \par
Grantha \par
Greek \par
Gujarati \par
Gurmukhi \par
Hangul Jamo \par
Hangul \par
Hanunoo \par
Hatran \par
Hebrew \par
\dup Hiragana and Katakana \par
\dup Kana \par
Imperial Aramaic \par
Inscriptional Pahlavi \par
Inscriptional Parthian \par
Javanese \par
Kaithi \par
Kannada \par
Kayah Li \par
Kharosthi \par
Khmer \par
Khojki \par
Khudawadi \par
Lao \par
Latin \par
Lepcha \par
Limbu \par
Linear A \par
Linear B \par
Lisu \par
Lycian \par
Lydian \par
Mahajani \par
Malayalam \par
Mandaic \par
Manichaean \par
Marchen \par
\dup Math \par
\dup Maths \par
Meitei Mayek \par
Mende Kikakui \par
Meroitic Cursive \par
Meroitic Hieroglyphs \par
Miao \par
Modi \par
Mongolian \par
Mro \par
Multani \par
Musical Symbols \par
Myanmar \par
\dup N'Ko \par
\dup N'ko \par
Nabataean \par
Newa \par
Ogham \par
Ol Chiki \par
Old Italic \par
Old Hungarian \par
Old North Arabian \par
Old Permic \par
Old Persian Cuneiform \par
Old South Arabian \par
Old Turkic \par
\dup Oriya \par
\dup Odia \par
Osage \par
Osmanya \par
Pahawh Hmong \par
Palmyrene \par
Pau Cin Hau \par
Phags-pa \par
Phoenician \par
Psalter Pahlavi \par
Rejang \par
Runic \par
Samaritan \par
Saurashtra \par
Sharada \par
Shavian \par
Siddham \par
Sign Writing \par
Sinhala \par
Sora Sompeng \par
Sumero-Akkadian Cuneiform \par
Sundanese \par
Syloti Nagri \par
Syriac \par
Tagalog \par
Tagbanwa \par
Tai Le \par
Tai Lu \par
Tai Tham \par
Tai Viet \par
Takri \par
Tamil \par
Tangut \par
Telugu \par
Thaana \par
Thai \par
Tibetan \par
Tifinagh \par
Tirhuta \par
Ugaritic Cuneiform \par
Vai \par
Warang Citi \par
Yi
\end{multicols}
\hrule
\end{table}
\begin{table}[p]
\vspace*{-3cm}
\hspace{-3cm}
\def\dup{\makebox[0pt][r]{\textcolor{red}{\P}}}
\begin{minipage}{\linewidth+4cm}
\caption{Defined \opt{Language}s for OpenType fonts. Aliased names are shown in adjacent positions marked with red pilcrows ({\sffamily\textcolor{red}{\P}}).}
\label{tab:ot-lang}
\setlength\columnseprule{0pt}
\hrule
\begin{multicols}{6}
\everypar{\setlength\parindent{0pt}\setlength\hangindent{2em}}
\sffamily\footnotesize\raggedright
Abaza \par
Abkhazian \par
Adyghe \par
Afrikaans \par
Afar \par
Agaw \par
Altai \par
Amharic \par
Arabic \par
Aari \par
Arakanese \par
Assamese \par
Athapaskan \par
Avar \par
Awadhi \par
Aymara \par
Azeri \par
Badaga \par
Baghelkhandi \par
Balkar \par
Baule \par
Berber \par
Bench \par
Bible Cree \par
Belarussian \par
Bemba \par
Bengali \par
Bulgarian \par
Bhili \par
Bhojpuri \par
Bikol \par
Bilen \par
Blackfoot \par
Balochi \par
Balante \par
Balti \par
Bambara \par
Bamileke \par
Breton \par
Brahui \par
Braj Bhasha \par
Burmese \par
Bashkir \par
Beti \par
Catalan \par
Cebuano \par
Chechen \par
Chaha Gurage \par
Chattisgarhi \par
Chichewa \par
Chukchi \par
Chipewyan \par
Cherokee \par
Chuvash \par
Comorian \par
Coptic \par
Cree \par
Carrier \par
Crimean Tatar \par
Church Slavonic \par
Czech \par
Danish \par
Dargwa \par
Woods Cree \par
German \par
Default \par
Dogri \par
Divehi \par
Djerma \par
Dangme \par
Dinka \par
Dungan \par
Dzongkha \par
Ebira \par
Eastern Cree \par
Edo \par
Efik \par
Greek \par
English \par
Erzya \par
Spanish \par
Estonian \par
Basque \par
Evenki \par
Even \par
Ewe \par
French Antillean \par
\dup Farsi \par
\dup Parsi \par
\dup Persian \par
Finnish \par
Fijian \par
Flemish \par
Forest Nenets \par
Fon \par
Faroese \par
French \par
Frisian \par
Friulian \par
Futa \par
Fulani \par
Ga \par
Gaelic \par
Gagauz \par
Galician \par
Garshuni \par
Garhwali \par
Ge'ez \par
Gilyak \par
Gumuz \par
Gondi \par
Greenlandic \par
Garo \par
Guarani \par
Gujarati \par
Haitian \par
Halam \par
Harauti \par
Hausa \par
Hawaiin \par
Hammer-Banna \par
Hiligaynon \par
Hindi \par
High Mari \par
Hindko \par
Ho \par
Harari \par
Croatian \par
Hungarian \par
Armenian \par
Igbo \par
Ijo \par
Ilokano \par
Indonesian \par
Ingush \par
Inuktitut \par
Irish \par
Irish Traditional \par
Icelandic \par
Inari Sami \par
Italian \par
Hebrew \par
Javanese \par
Yiddish \par
Japanese \par
Judezmo \par
Jula \par
Kabardian \par
Kachchi \par
Kalenjin \par
Kannada \par
Karachay \par
Georgian \par
Kazakh \par
Kebena \par
Khutsuri Georgian \par
Khakass \par
Khanty-Kazim \par
Khmer \par
Khanty-Shurishkar \par
Khanty-Vakhi \par
Khowar \par
Kikuyu \par
Kirghiz \par
Kisii \par
Kokni \par
Kalmyk \par
Kamba \par
Kumaoni \par
Komo \par
Komso \par
Kanuri \par
Kodagu \par
Korean Old Hangul \par
Konkani \par
Kikongo \par
Komi-Permyak \par
Korean \par
Komi-Zyrian \par
Kpelle \par
Krio \par
Karakalpak \par
Karelian \par
Karaim \par
Karen \par
Koorete \par
Kashmiri \par
Khasi \par
Kildin Sami \par
Kui \par
Kulvi \par
Kumyk \par
Kurdish \par
Kurukh \par
Kuy \par
Koryak \par
Ladin \par
Lahuli \par
Lak \par
Lambani \par
Lao \par
Latin \par
Laz \par
L-Cree \par
Ladakhi \par
Lezgi \par
Lingala \par
Low Mari \par
Limbu \par
Lomwe \par
Lower Sorbian \par
Lule Sami \par
Lithuanian \par
Luba \par
Luganda \par
Luhya \par
Luo \par
Latvian \par
Majang \par
Makua \par
Malayalam Traditional \par
Mansi \par
Marathi \par
Marwari \par
Mbundu \par
Manchu \par
Moose Cree \par
Mende \par
Me'en \par
Mizo \par
Macedonian \par
Male \par
Malagasy \par
Malinke \par
Malayalam Reformed \par
Malay \par
Mandinka \par
Mongolian \par
Manipuri \par
Maninka \par
Manx Gaelic \par
Moksha \par
Moldavian \par
Mon \par
Moroccan \par
Maori \par
Maithili \par
Maltese \par
Mundari \par
Naga-Assamese \par
Nanai \par
Naskapi \par
N-Cree \par
Ndebele \par
Ndonga \par
Nepali \par
Newari \par
Nagari \par
Norway House Cree \par
Nisi \par
Niuean \par
Nkole \par
N'ko \par
Dutch \par
Nogai \par
Norwegian \par
Northern Sami \par
Northern Tai \par
Esperanto \par
Nynorsk \par
Oji-Cree \par
Ojibway \par
Oriya \par
Oromo \par
Ossetian \par
Palestinian Aramaic \par
Pali \par
Punjabi \par
Palpa \par
Pashto \par
Polytonic Greek \par
Pilipino \par
Palaung \par
Polish \par
Provencal \par
Portuguese \par
Chin \par
Rajasthani \par
R-Cree \par
Russian Buriat \par
Riang \par
Rhaeto-Romanic \par
Romanian \par
Romany \par
Rusyn \par
Ruanda \par
Russian \par
Sadri \par
Sanskrit \par
Santali \par
Sayisi \par
Sekota \par
Selkup \par
Sango \par
Shan \par
Sibe \par
Sidamo \par
Silte Gurage \par
Skolt Sami \par
Slovak \par
Slavey \par
Slovenian \par
Somali \par
Samoan \par
Sena \par
Sindhi \par
Sinhalese \par
Soninke \par
Sodo Gurage \par
Sotho \par
Albanian \par
Serbian \par
Saraiki \par
Serer \par
South Slavey \par
Southern Sami \par
Suri \par
Svan \par
Swedish \par
Swadaya Aramaic \par
Swahili \par
Swazi \par
Sutu \par
Syriac \par
Tabasaran \par
Tajiki \par
Tamil \par
Tatar \par
TH-Cree \par
Telugu \par
Tongan \par
Tigre \par
Tigrinya \par
Thai \par
Tahitian \par
Tibetan \par
Turkmen \par
Temne \par
Tswana \par
Tundra Nenets \par
Tonga \par
Todo \par
Turkish \par
Tsonga \par
Turoyo Aramaic \par
Tulu \par
Tuvin \par
Twi \par
Udmurt \par
Ukrainian \par
Urdu \par
Upper Sorbian \par
Uyghur \par
Uzbek \par
Venda \par
Vietnamese \par
Wa \par
Wagdi \par
West-Cree \par
Welsh \par
Wolof \par
Tai Lue \par
Xhosa \par
Yakut \par
Yoruba \par
Y-Cree \par
Yi Classic \par
Yi Modern \par
Chinese Hong Kong \par
Chinese Phonetic \par
Chinese Simplified \par
Chinese Traditional \par
Zande \par
Zulu
\end{multicols}
\hspace{4pt}
\hrule
\end{minipage}
\end{table}
\section{OpenType font features}
\label{sec:ot-feat}
There are a finite set of OpenType font features, and \pkg{fontspec} provides an
interface to around half of them.
Full documentation will be presented in the following sections, including how to
enable and disable individual features, and how they interact.
A brief reference is provided (\vref{tab:all-ot}) but note that this is an incomplete
listing --- only the `enable' keys are shown, and where alternative interfaces are
provided for convenience only the first is shown.
(E.g., |Numbers=OldStyle| is the same as |Numbers=Lowercase|.)
For completeness, the complete list of OpenType features \emph{not} provided with
a \pkg{fontspec} interface is shown in \vref{tab:none-ot}.
Features omitted are partially by design and partially by oversight;
for example, the |aalt| feature is largely useless in \TeX\ since it is designed
for providing a \textsc{gui} interface for selecting `all alternates' of a glyph.
Others, such as optical bounds for example, simply haven't yet been considered
due to a lack of fonts available for testing.
Suggestions welcome for how/where to add these missing features to the package.
\ExplSyntaxOn
\def\allOTfeat{
\prop_map_inline:Nn \g__fontspec_all_opentype_feature_names_prop
{ \opentypefeature{##1}{##2} }
}
\newcommand\opentypefeature[2]{
\prop_get:NnNT \g__fontspec_OT_features_prop {#1} \tmpa
{
\raggedright
\hangindent=5.2cm
\makebox[1cm][l]{\textsc{#1}}
\makebox[4.2cm][l]{
\int_compare:nT { \tl_count:N \tmpa > 25 } {\ttcondensed} {\ttfamily}
\tmpa
}
\textit{#2}
\par
\vspace{2pt}
}
}
\ExplSyntaxOff
\begin{table}
\caption{Summary of OpenType features in \textsf{fontspec}, alphabetic by feature tag.}
\label{tab:all-ot}
\centerline{%
\begin{minipage}{18cm}
\small
\hrule\smallskip
\begin{multicols}{2}
\parindent =0pt
\allOTfeat
\end{multicols}
\vspace*{-\smallskipamount}
\hrule
\end{minipage}}
\end{table}
\ExplSyntaxOn
\renewcommand\opentypefeature[2]{
\prop_get:NnNF \g__fontspec_OT_features_prop {#1} \tmpa
{
\raggedright
\hangindent=0.9cm
\makebox[0.9cm][l]{\textsc{#1}}%
\textit{#2}
\par
}
}
\ExplSyntaxOff
\begin{table}
\caption{List of \emph{unsupported} OpenType features.}
\label{tab:none-ot}
\bigskip
\centerline{%
\begin{minipage}{15cm}
\hrule\smallskip
\begin{multicols}{3}
\parindent =0pt
\allOTfeat
\end{multicols}
\vspace*{-\smallskipamount}
\hrule
\end{minipage}}
\end{table}
\subsection{Tag-based features}
\subsubsection{Alternates --- \texttt{salt}}
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}.
It uses a numerical selection, starting from zero, that will be different for each font.
Note that the \texttt{Style=Alternate} option is equivalent
to \texttt{Alternate=0} to access the default case.
\begin{Xexample}[firstline=2]{salt}{The \feat{Alternate} feature.}
\huge
\fontspec{LinLibertine_R.otf}
\textsc{a} \& h \\
\addfontfeature{Alternate=0}
\textsc{a} \& h
\end{Xexample}
Note that the indexing starts from zero.
With the \LuaTeX\ engine, |Alternate=Random| selects a random alternate.
See \vref{sec:newfeatures} for a way to assign names to alternates if desired.
\subsubsection{Character Variants --- \texttt{cvNN}}
`Character Variations' are selected
numerically to adjust the output of (usually) a single character for the
particular font. These correspond to the OpenType features |cv01| to |cv99|.
For each character that can be varied, it is possible to select among
possible options for that particular glyph.
For example, in the hypothetical example below, variants are chosen for glyphs `4' and `5',
and the trailing |:|\meta{n} corresponds to which variety to choose.
\begin{Verbatim}
\fontspec{CV Font}[CharacterVariant={4,5:2}] \& violet
\end{Verbatim}
The numbering is entirely font-specific. Glyph `5' might be the character `v', for example.
Character variants are specifically designed not to conflict with each
other, so you can enable them individually per character.
(Unlike stylistic alternates, say.)
Note that the indexing starts from zero.
\subsubsection{Contextuals}
This feature refers to substitutions of glyphs that vary `contextually' by their relative position in a word or string of characters;
features such as contextual swashes are accessed via the options shown in \ref{feat:Contextuals}.
\begin{features}{Contextuals}
\otf*{Swash}{cswh}
\otf*{Alternate}{calt}
\otf*{WordInitial}{init}
\otf*{WordFinal}{fina}
\otf*{LineFinal}{falt}
\otf*{Inner}{medi}
\cmidrule{2-4}
\otf{ResetAll}{}
\end{features}
Historic forms are accessed in OpenType
fonts via the feature \feat{Style=Historic}; this is generally \emph{not}
contextual in OpenType, which is why it is not included in this feature.
\subsubsection{Diacritics}
Specifies how combining diacritics should be placed.
These will usually be controlled automatically
according to the Script setting.
\begin{features}{Diacritics}
\otf*{MarkToBase}{mark}
\otf*{MarkToMark}{mkmk}
\otf*{AboveBase}{abvm}
\otf*{BelowBase}{blwm}
\cmidrule{2-4}
\otf{ResetAll}{}
\end{features}
\subsubsection{Fractions --- \texttt{frac}}
\begin{features}{Fractions}
\otf{On}{+frac}
\otf{Off}{-frac}
\otf{Reset}{}
\cmidrule{2-4}
\otf*{Alternate}{afrc}
\cmidrule{2-4}
\otf{ResetAll}{}
\end{features}
Activates the construction of `vulgar' fractions using precomposed glyphs and/or
subscript and superscript characters from within the font.
Coverage will vary by font; see \exref{ot-frac}.
Some (Asian fonts predominantly) also provide for the \opt{Alternate} option.
\begin{Lexample}{ot-frac}{The \feat{Fractions} feature.}
\setsansfont{IBMPlexSans-Regular.otf}[Fractions=On]
\setmonofont{IBMPlexMono-Regular.otf}[Fractions=On]
\sffamily 1/2 47/11 1/1000 \par
\ttfamily 1/2 47/11
\end{Lexample}
\subsubsection{Kerning --- \texttt{kern}}
\label{sec:kerning}
Specifies how inter-glyph spacing should behave.