Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views144 pages

Fontspec Code

Uploaded by

makdoudyoucef023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views144 pages

Fontspec Code

Uploaded by

makdoudyoucef023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 144

The fontspec package

Font selection for XELATEX and LuaLATEX


WILL ROBERTSON
With contributions by Khaled Hosny,
Philipp Gesang, Joseph Wright, and others.
http://latex3.github.io/fontspec/

2024/05/11 v2.9e

Contents

I fontspec.dtx 5
1 Package declaration 5
1.1 Lua header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

II fontspec-code-load.dtx 7
1 The fontspec.sty loading file 7

III fontspec-code-vars.dtx 8
1 Declaration of variables 8

IV fontspec-code-msg.dtx 13
1 Error/warning/info messages 13
1.1 Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.2 Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3 Info messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

V fontspec-code-opening.dtx 18
1 Opening code 18
1.1 Package options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.2 Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

1
1.3 Generic functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.4 expl3 variants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

VI fontspec-code-fontload.dtx 21
1 expl3 interface for primitive font loading 21

VII fontspec-code-interfaces.dtx 23
1 User commands 23

VIII fontspec-code-user.dtx 27
1 User command internals 27
1.1 Font selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
1.2 Font feature selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
1.3 Defining new font features . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.4 High level conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
1.5 \oldstylenums and \liningnums . . . . . . . . . . . . . . . . . . . . . . . 35

IX fontspec-code-api.dtx 36
1 Programmer’s interface 36

2 Overview 36
2.1 Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.2 Conditionals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

3 Implementation 38

X fontspec-code-internal.dtx 44
1 Internals 44
1.1 The main function for setting fonts . . . . . . . . . . . . . . . . . . . . . . . 44
1.2 Setting font shapes in a family . . . . . . . . . . . . . . . . . . . . . . . . . 52
1.3 Initialisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
1.4 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

XI fontspec-code-opentype.dtx 66
1 OpenType definitions code 66
1.1 Adding features when loading fonts . . . . . . . . . . . . . . . . . . . . . . 67
1.2 OpenType feature information . . . . . . . . . . . . . . . . . . . . . . . . . 71

2
XII fontspec-code-graphite.dtx 74
1 Graphite/AAT code 74

XIII fontspec-code-keyval.dtx 76
1 Font loading (keyval) definitions 76
1.1 Pre-pre-parsing stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
1.2 Pre-parsed features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
1.3 Font faces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
1.4 General font-independent features . . . . . . . . . . . . . . . . . . . . . . . 82

XIV fontspec-code-feat-opentype.dtx 93
1 OpenType feature definitions 93

2 Regular key=val / tag definitions 93


2.1 Ligatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
2.2 Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
2.3 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
2.4 Vertical position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
2.5 Contextuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.6 Diacritics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.7 Kerning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
2.8 Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
2.9 Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
2.10 CJK shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.11 Character width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
2.12 Vertical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

3 OpenType features that need numbering 98


3.1 Alternate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.2 Variant / StylisticSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.3 CharacterVariant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
3.4 Annotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
3.5 Ornament . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

4 Script and Language 99


4.1 Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.2 Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

5 Backwards compatibility 102

XV fontspec-code-scripts.dtx 103
1 Font script definitions 103

3
XVI fontspec-code-lang.dtx 107
1 Font language definitions 107

XVII fontspec-code-feat-aat.dtx 115


1 AAT feature definitions 115
1.1 Ligatures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
1.2 Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
1.3 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
1.4 Contextuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
1.5 Diacritics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
1.6 Vertical position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
1.7 Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
1.8 Alternate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
1.9 Variant / StylisticSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
1.10 Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
1.11 CJK shape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
1.12 Character width . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
1.13 Annotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

XVIII fontspec-code-enc.dtx 119


1 Extended font encodings 119

XIX fontspec-code-math.dtx 122


1 Selecting maths fonts 122

XX fontspec-code-closing.dtx 127
1 Closing code 127
1.1 Finishing up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

XXI fontspec-code-xfss.dtx 128


1 Changes/additions to the NFSS 128

2 Implementation 128
2.1 Italic small caps and so on . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
2.2 Strong emphasis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
2.3 Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

Index 131

4
File I
fontspec.dtx
1 Package declaration
List all dtx files for running the ins file and typesetting the code.
1 ⟨∗dtx⟩
2 \gdef\FONTSPECDTX{
3 \DTX{fontspec.dtx}
4 \DTX{fontspec-code-load.dtx}
5 \DTX{fontspec-code-vars.dtx}
6 \DTX{fontspec-code-msg.dtx}
7 \DTX{fontspec-code-opening.dtx}
8 \DTX{fontspec-code-fontload.dtx}
9 \DTX{fontspec-code-interfaces.dtx}
10 \DTX{fontspec-code-user.dtx}
11 \DTX{fontspec-code-api.dtx}
12 \DTX{fontspec-code-internal.dtx}
13 \DTX{fontspec-code-opentype.dtx}
14 \DTX{fontspec-code-graphite.dtx}
15 \DTX{fontspec-code-keyval.dtx}
16 \DTX{fontspec-code-feat-opentype.dtx}
17 \DTX{fontspec-code-scripts.dtx}
18 \DTX{fontspec-code-lang.dtx}
19 \DTX{fontspec-code-feat-aat.dtx}
20 \DTX{fontspec-code-enc.dtx}
21 \DTX{fontspec-code-math.dtx}
22 \DTX{fontspec-code-closing.dtx}
23 \DTX{fontspec-code-xfss.dtx}
24 }
25 ⟨/dtx⟩
Now exit if we’re using plain TEX; this would usually be the case when loading this file
with fontspec.ins.
26 ⟨∗dtx⟩
27 \def\tmpa{plain}
28 \ifx\tmpa\fmtname\expandafter\endinput\fi
29 ⟨/dtx⟩
Metadata for documentation; the official title and authors of the package.
30 ⟨∗dtx⟩
31 \title{
32 The \textsf{fontspec} package\\
33 Font selection for \XeLaTeX\ and \LuaLaTeX
34 }
35 \author{
36 \textsc{Will Robertson}\\
37 With contributions by Khaled Hosny,\\
38 Philipp Gesang, Joseph Wright, and others.\\
39 \url{http://latex3.github.io/fontspec/}

5
40 }
41 ⟨/dtx⟩
Declare the package version and date for each of the .sty files generated. In addition,
declare the version and date for this .dtx file.
42 ⟨fontspec⟩\RequirePackage{xparse}
43 ⟨fontspec & load⟩\ProvidesExplPackage{fontspec}%
44 ⟨fontspec & XE⟩\ProvidesExplPackage{fontspec-xetex}%
45 ⟨fontspec & LU⟩\ProvidesExplPackage{fontspec-luatex}%
46 ⟨∗dtx⟩
47 \RequirePackage{xparse}
48 \ProvidesExplFile{fontspec.dtx}
49 ⟨/dtx⟩
50 ⟨∗fontspec⟩
51 {2024/05/11}{2.9e}{Font selection for XeLaTeX and LuaLaTeX}
52 ⟨/fontspec⟩
Here the version and date are setup for typesetting the documentation.
53 ⟨∗dtx⟩
54 \GetFileInfo{fontspec.dtx}
55 \date{\filedate \qquad \fileversion}
56 ⟨/dtx⟩

1.1 Lua header


57 ⟨lua⟩fontspec = fontspec or {}
58 ⟨lua⟩local fontspec = fontspec
59 ⟨lua⟩fontspec.module = {
60 ⟨lua⟩ name = "fontspec",
61 ⟨lua⟩ version = "2.9e",
62 ⟨lua⟩ date = "2024/05/11",
63 ⟨lua⟩ description = "Font selection for XeLaTeX and LuaLaTeX",
64 ⟨lua⟩ author = "Khaled Hosny, Philipp Gesang, Will Robertson",
65 ⟨lua⟩ copyright = "Khaled Hosny, Philipp Gesang, Will Robertson",
66 ⟨lua⟩ license = "LPPL v1.3c"
67 ⟨lua⟩}

6
File II
fontspec-code-load.dtx
1 The fontspec.sty loading file
Before we begin, for the rest of the package we use the @@ expl3 module syntax with module
name ‘fontspec’.
1 ⟨@@=fontspec⟩
The fontspec.sty file is simply set up to load the appropriate fontspec-xetex.sty or
fontspec-luatex.sty file. This is performed by the following code.
2 ⟨∗load⟩

LuaLATEX
3 \sys_if_engine_luatex:T
4 {
5 \RequirePackage{luaotfload}
6 \lua_now:e{require("fontspec")}
7 \RequirePackage{fontspec-luatex}
8 \endinput
9 }

XELATEX
10 \sys_if_engine_xetex:T
11 {
12 \RequirePackage{fontspec-xetex}
13 \endinput
14 }

Other If not one of the above, error and exit.


15 \msg_new:nnn {fontspec} {cannot-use-pdftex}
16 {
17 The~ fontspec~ package~ requires~ either~ XeTeX~ or~ LuaTeX.\\\\
18 You~ must~ change~ your~ typesetting~ engine~ to,~ e.g.,~
19 "xelatex"~ or~ "lualatex"~ instead~ of~ "latex"~ or~ "pdflatex".
20 }
21 \msg_fatal:nn {fontspec} {cannot-use-pdftex}

Closing That’s the end of the fontspec.sty file.


22 \endinput
23 ⟨/load⟩

7
File III
fontspec-code-vars.dtx
1 Declaration of variables
This file consists solely of declaration of variables used by fontspec. In some cases these vari-
ables are also initialised with default values. In time I would like to move these initialisations

Booleans
\l_@@_firsttime_bool As \keys_set:nn is run multiple times, some of its information storing only occurs once
while we decide if the font family has been defined or not. When the later processing is occur-
ing per-shape this no longer needs to happen; this is indicated by the ‘firsttime’ conditional.
1 \bool_new:N \l_@@_firsttime_bool
(End of definition for \l_@@_firsttime_bool. This function is documented on page ??.)

2 \bool_new:N \l_@@_nobf_bool
3 \bool_new:N \l_@@_noit_bool
4 \bool_new:N \l_@@_nosc_bool
5 \bool_new:N \l_@@_check_bool
6 \bool_new:N \l_@@_tfm_bool
7 \bool_new:N \l_@@_atsui_bool
8 \bool_new:N \l_@@_ot_bool
9 \bool_new:N \l_@@_mm_bool
10 \bool_new:N \l_@@_harfbuzz_bool
11 \bool_new:N \l_@@_graphite_bool
12 \bool_new:N \l_@@_fontcfg_bool
13 \bool_set_true:N \l_@@_fontcfg_bool
For dealing with legacy maths:
14 \bool_new:N \g_@@_math_euler_bool
15 \bool_new:N \g_@@_math_lucida_bool
16 \bool_new:N \g_@@_pkg_euler_loaded_bool
For package options:
17 ⟨/fontspec⟩
18 ⟨∗options⟩
19 \bool_new:N \g_@@_cfg_bool
20 \bool_new:N \g_@@_math_bool
21 ⟨/options⟩
22 ⟨∗fontspec⟩
23 \bool_new:N \l_@@_tmpa_bool
24 \bool_new:N \l_@@_disable_defaults_bool
25 \bool_new:N \l_@@_alias_bool
26 \bool_new:N \l_@@_external_bool
27 \bool_new:N \l_@@_defining_encoding_bool
28 \bool_new:N \l_@@_scriptlang_exist_bool
29 \bool_new:N \g_@@_em_normalise_slant_bool
30 \bool_new:N \l_@@_external_kpse_bool

8
\l_@@_never_check_bool It is used to disable checking opentype script, language, and tags when running checking code
that has a user-defined return path we want to allow the higher-level code to dictate the logic.
TODO: tidy this up!
31 \bool_new:N \l_@@_never_check_bool

(End of definition for \l_@@_never_check_bool. This function is documented on page ??.)

Counters
32 \int_new:N \l_@@_script_int
33 \int_new:N \l_@@_language_int
34 \int_new:N \l_@@_strnum_int
35 \int_new:N \l_@@_tmp_int
36 \int_new:N \l_@@_tmpa_int
37 \int_new:N \l_@@_tmpb_int
38 \int_new:N \l_@@_tmpc_int
39 \int_new:N \l_@@_em_int
40 \int_new:N \l_@@_emdef_int
41 \int_new:N \l_@@_strong_int
42 \int_new:N \l_@@_strongdef_int

Floats
43 \fp_new:N \l_@@_tmpa_fp
44 \fp_new:N \l_@@_tmpb_fp

Dimensions
45 \dim_new:N \l_@@_tmpa_dim
46 \dim_new:N \l_@@_tmpb_dim
47 \dim_new:N \l_@@_tmpc_dim

Sequences
48 \seq_new:N \l_@@_bf_series_seq

Comma-lists
49 \clist_new:N \g_@@_default_fontopts_clist
50 \clist_new:N \g_@@_all_keyval_modules_clist
51 \clist_new:N \l_@@_sizefeat_clist
52 \clist_set:Nn \l_@@_sizefeat_clist {Size={-}}
53 \clist_new:N \l_@@_extensions_clist
54 \clist_new:N \l_@@_fontopts_clist
55 \clist_new:N \l_@@_family_fontopts_clist
56 \clist_new:N \l_@@_all_features_clist
57 \clist_new:N \l_@@_leftover_clist
58 \clist_new:N \l_@@_keys_leftover_clist
59 \clist_new:N \l_@@_sizing_leftover_clist
60 \clist_new:N \l_@@_fontfeat_clist
61 \clist_new:N \l_@@_fontfeat_curr_clist
62 \clist_new:N \l_@@_arg_clist
63 \clist_new:N \l_@@_this_feat_clist

9
64 \clist_new:N \l_@@_fontfeat_up_clist
65 \clist_new:N \l_@@_fontfeat_bf_clist
66 \clist_new:N \l_@@_fontfeat_it_clist
67 \clist_new:N \l_@@_fontfeat_bfit_clist
68 \clist_new:N \l_@@_fontfeat_sl_clist
69 \clist_new:N \l_@@_fontfeat_bfsl_clist
70 \clist_new:N \l_@@_fontfeat_sw_clist
71 \clist_new:N \l_@@_fontfeat_bfsw_clist
72 \clist_new:N \l_@@_fontfeat_sc_clist

Property lists
73 \prop_new:N \g_@@_fontopts_prop
74 \prop_new:N \l_@@_nfss_prop
75 \prop_new:N \l_@@_nfssfont_prop
76 \prop_new:N \g_@@_OT_features_prop
77 \prop_new:N \g_@@_all_opentype_feature_names_prop
78 \prop_new:N \g_@@_em_prop
79 \prop_new:N \g_@@_strong_prop
80 \prop_new:N \g_@@_fontid_family_prop
81 \prop_new:N \g_@@_family_int_prop
82 \prop_new:N \g_@@_rawvariations_prop

Token lists

Visible (perhaps?)
83 \tl_new:N \l_fontspec_family_tl
84 \tl_new:N \g_fontspec_encoding_tl
85 \tl_new:N \l_fontspec_fontname_tl

2e interactions
86 \tl_clear_new:N \UTFencname
87 \tl_clear_new:N \cyrillicencoding
88 \tl_clear_new:N \latinencoding

Renderer/shaper
89 \tl_new:N \l_@@_renderer_tl
90 \tl_new:N \l_@@_mode_tl
91 \tl_new:N \l_@@_shaper_tl
92 \tl_new:N \g_@@_defined_shapes_tl
93 \tl_new:N \g_@@_single_feat_tl
94 \tl_new:N \l_@@_basename_tl
95 \tl_new:N \g_@@_curr_series_tl
96 \tl_new:N \l_@@_curr_fontname_tl
97 \tl_new:N \l_@@_curr_bfname_tl
98 \tl_new:N \l_@@_ext_filename_tl
99 \tl_new:N \l_@@_extension_tl
100 \tl_new:N \l_@@_font_path_tl
101 \tl_new:N \l_@@_fontid_tl

10
102 \tl_new:N \l_@@_fontname_tl
103 \tl_new:N \l_@@_options_tl
104 \tl_new:N \l_@@_saved_fontname_tl
105 \tl_new:N \l_@@_prev_unicode_name_tl
106 \tl_new:N \g_@@_nfss_enc_tl
107 \tl_new:N \g_@@_nfss_family_tl
108 \tl_new:N \l_@@_nfss_sc_tl
109 \tl_new:N \l_@@_nfss_tl
110 \tl_new:N \l_@@_nfss_fam_tl
111 \tl_new:N \l_@@_size_tl
112 \tl_new:N \l_@@_sizedfont_tl
113 \tl_new:N \l_@@_this_font_tl
114 \tl_new:N \l_@@_ttc_index_tl
115 \tl_new:N \l_@@_smcp_shape_tl

EM and STRONG
116 \tl_new:N \l_@@_emshape_query_tl
117 \tl_new:N \l_@@_em_switch_tl
118 \tl_new:N \l_@@_strong_switch_tl

Scratch variables
119 \tl_new:N \l_@@_tmp_tl
120 \tl_new:N \l_@@_tmpa_tl
121 \tl_new:N \l_@@_tmpb_tl
122 \tl_new:N \l_@@_em_tmp_tl
123 \tl_new:N \l_@@_strong_tmp_tl

Maths fonts
124 \tl_new:N \g_@@_mathrm_tl
125 \tl_new:N \g_@@_bfmathrm_tl
126 \tl_new:N \g_@@_mathsf_tl
127 \tl_new:N \g_@@_mathtt_tl
Defaults: (these are set elsewhere; TODO: check if redundant)
128 \tl_gset:Nn \g_@@_mathrm_tl {\rmdefault}
129 \tl_gset:Nn \g_@@_mathsf_tl {\sfdefault}
130 \tl_gset:Nn \g_@@_mathtt_tl {\ttdefault}
131 \tl_new:N \l_@@_family_label_tl
132 \tl_new:N \l_@@_fake_slant_tl
133 \tl_new:N \l_@@_fake_embolden_tl

Internal font names


134 \tl_new:N \l_@@_fontname_up_tl
135 \tl_new:N \l_@@_fontname_bf_tl
136 \tl_new:N \l_@@_fontname_it_tl
137 \tl_new:N \l_@@_fontname_bfit_tl
138 \tl_new:N \l_@@_fontname_sl_tl
139 \tl_new:N \l_@@_fontname_bfsl_tl

11
140 \tl_new:N \l_@@_fontname_sw_tl
141 \tl_new:N \l_@@_fontname_bfsw_tl
142 \tl_new:N \l_@@_fontname_sc_tl

Script and Language


143 \tl_new:N \l_@@_script_tl
144 \tl_new:N \l_@@_script_name_tl
145 \tl_set:Nn \l_@@_script_name_tl {CustomDefault}
146 \tl_new:N \l_@@_lang_tl
147 \tl_new:N \l_@@_lang_name_tl
148 \tl_set:Nn \l_@@_lang_name_tl {Default}

Generic font features


149 \tl_new:N \l_@@_scale_tl
150 \tl_new:N \l_@@_hyphenchar_tl
151 \tl_new:N \l_@@_hexcol_tl
152 \tl_new:N \l_@@_opacity_tl
153 \tl_new:N \l_@@_optical_size_tl
154 \tl_new:N \l_@@_mapping_tl
155 \tl_new:N \l_@@_punctspace_adjust_tl
156 \tl_new:N \l_@@_wordspace_adjust_tl
157 \tl_new:N \l_@@_postadjust_tl
158 \tl_new:N \g_@@_instance_tl
159 \tl_const:Nn \c_@@_hexcol_tl {000000}
160 ⟨XE⟩ \tl_const:Nn \c_@@_opacity_tl {FF~}
161 ⟨LU⟩ \tl_const:Nn \c_@@_opacity_tl {}
162 \tl_const:Nn \c_@@_postadjust_tl { \l_@@_wordspace_adjust_tl \l_@@_punctspace_adjust_tl }

Semi-colon-lists Not a real data structure but sensible to name accordingly.


163 \tl_new:N \g_@@_rawfeatures_sclist
164 \tl_new:N \l_@@_pre_feat_sclist

Font families
165 \tl_new:N \l_@@_rmfamily_family_tl
166 \tl_new:N \l_@@_sffamily_family_tl
167 \tl_new:N \l_@@_ttfamily_family_tl
168 \tl_new:N \l_@@_rmfamily_encoding_tl
169 \tl_new:N \l_@@_sffamily_encoding_tl
170 \tl_new:N \l_@@_ttfamily_encoding_tl

12
File IV
fontspec-code-msg.dtx
1 Error/warning/info messages
Shorthands for messages:
1 \cs_new:Npn \@@_error:n { \msg_error:nn {fontspec} }
2 \cs_new:Npn \@@_error:nn { \msg_error:nnn {fontspec} }
3 \cs_new:Npn \@@_error:nx { \msg_error:nnx {fontspec} }
4 \cs_new:Npn \@@_error:nxx { \msg_error:nnxx {fontspec} }
5 \cs_new:Npn \@@_warning:n { \msg_warning:nn {fontspec} }
6 \cs_new:Npn \@@_warning:nx { \msg_warning:nnx {fontspec} }
7 \cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx {fontspec} }
8 \cs_new:Npn \@@_info:n { \msg_info:nn {fontspec} }
9 \cs_new:Npn \@@_info:nx { \msg_info:nnx {fontspec} }
10 \cs_new:Npn \@@_info:nxx { \msg_info:nnxx {fontspec} }
11 \cs_new:Npn \@@_trace:n { \msg_trace:nn {fontspec} }
Allow messages to be written with spaces acting as normal:
12 \cs_generate_variant:Nn \msg_new:nnn {nnx}
13 \cs_generate_variant:Nn \msg_new:nnnn {nnxx}
14 \cs_new:Nn \@@_msg_new:nn
15 { \msg_new:nnx {fontspec} {#1} { ^^J \tl_trim_spaces:n {#2} } }
16 \cs_new:Nn \@@_msg_new:nnn
17 { \msg_new:nnxx {fontspec} {#1} { ^^J \tl_trim_spaces:n {#2} } { \tl_trim_spaces:n {#3} } }
18 \char_set_catcode_space:n {32}

1.1 Errors
19 \@@_msg_new:nn {only-inside-encdef}
20 {
21 \exp_not:N #1 can only be used in the second argument
22 to \string\DeclareUnicodeEncoding.
23 }
24 \@@_msg_new:nn {no-size-info}
25 {
26 Size information must be supplied.\\
27 For example, SizeFeatures={Size={8-12},...}.
28 }
29 \@@_msg_new:nnn {font-not-found}
30 {
31 The font "#1" cannot be found; this may be but usually is not
32 a fontspec bug. Either there is a typo in the font name/file,
33 the font is not installed (correctly), or there is a bug
34 in the underlying font loading engine (XeTeX/luaotfload).
35 }
36 {
37 A font might not be found for many reasons.\\
38 Check the spelling, where the font is installed etc. etc.\\\\

13
39 When in doubt, ask someone for help!
40 }
41 \@@_msg_new:nnn {rename-feature-not-exist}
42 {
43 The feature #1 doesn't appear to be defined.
44 }
45 {
46 It looks like you're trying to rename a feature that doesn't exist.
47 }
48 \@@_msg_new:nn {no-glyph}
49 {
50 '#1' does not contain glyph #2.
51 }
52 \@@_msg_new:nnn {euler-too-late}
53 {
54 The euler package must be loaded BEFORE fontspec.
55 }
56 {
57 fontspec only overwrites euler's attempt to
58 define the maths text fonts if fontspec is
59 loaded after euler. Type <return> to proceed
60 with incorrect \string\mathit, \string\mathbf, etc.
61 }
62 \@@_msg_new:nnn {no-xcolor}
63 {
64 Cannot load named colours without the xcolor package.
65 }
66 {
67 Sorry, I can't do anything to help. Instead of loading
68 the color package, use xcolor instead.
69 }
70 \@@_msg_new:nnn {unknown-color-model}
71 {
72 Error loading colour `#1'; unknown colour model.
73 }
74 {
75 Sorry, I can't do anything to help. Please report this error
76 to my developer with a minimal example that causes the problem.
77 }
78 \@@_msg_new:nnn {not-in-addfontfeatures}
79 {
80 The "#1" font feature cannot be used in \string\addfontfeatures.
81 }
82 {
83 This is due to how TeX loads fonts; such settings
84 are global so adding them mid-document within a group causes
85 confusion. You'll need to define multiple font families to achieve
86 what you want.
87 }

1.2 Warnings

14
88 \@@_msg_new:nn {tu-clash}
89 {
90 I have found the tuenc.def encoding definition file but the TU encoding is not
91 defined by the LaTeX2e kernel; attempting to correct but you really should update
92 to the latest version of LaTeX2e.
93 }
94 \@@_msg_new:nn {tu-missing}
95 {
96 The TU encoding seems to be missing; please update to the latest version of LaTeX2e.
97 }
98 \@@_msg_new:nn {addfontfeatures-ignored}
99 {
100 \string\addfontfeature (s) ignored \msg_line_context:;
101 it cannot be used with a font that wasn't selected by a fontspec command.\\
102 \\
103 The current font is "\use:c{font@name}".\\
104 \int_compare:nTF { \clist_count:n {#1} = 1 }
105 { The requested feature is "#1". }
106 { The requested features are "#1". }
107 }
108 \@@_msg_new:nn {feature-option-overwrite}
109 {
110 Option '#2' of font feature '#1' overwritten.
111 }
112 \@@_msg_new:nn {ot-tag-too-long}
113 {
114 OpenType tag '#1' is too long; script, language, and feature tags must be four characters or
115 }
116 \@@_msg_new:nn {aat-feature-not-exist}
117 {
118 '\l_keys_key_tl=\l_keys_value_tl' feature not supported
119 for AAT font '\l_fontspec_fontname_tl'.
120 }
121 \@@_msg_new:nn {aat-feature-not-exist-in-font}
122 {
123 AAT feature '\l_keys_key_tl=\l_keys_value_tl' (#1) not available
124 in font '\l_fontspec_fontname_tl'.
125 }
126 \@@_msg_new:nn {no-opticals}
127 {
128 '#1' doesn't appear to have an Optical Size axis.
129 }
130 \@@_msg_new:nn {script-not-exist}
131 {
132 Script '#2' not explicitly supported within font '#1'.
133 Check the typeset output, and if it is okay then ignore this warning.
134 Otherwise a different font should be chosen.
135 }
136 \@@_msg_new:nn {language-not-exist}
137 {
138 Language '#1' not explicitly supported

15
139 within font '\l_fontspec_fontname_tl'
140 with script '\l_@@_script_name_tl'.
141 Check the typeset output, and if it is okay then ignore this warning.
142 Otherwise a different font should be chosen.
143 }
144 \@@_msg_new:nn {only-xetex-feature}
145 {
146 Ignored XeTeX-only feature: '#1'.
147 }
148 \@@_msg_new:nn {only-luatex-feature}
149 {
150 Ignored LuaTeX-only feature: '#1'.
151 }
152 \@@_msg_new:nn {unknown-renderer}
153 {
154 Renderer '#1' unknown. Assuming Harfbuzz with 'shaper=#1'.
155 Please raise a fontspec issue to add this shaper to the interface.
156 }
157 \@@_msg_new:nn {no-mapping}
158 {
159 Input mapping not supported in LuaTeX.
160 }
161 \@@_msg_new:nn {no-mapping-ligtex}
162 {
163 Input mapping not supported in LuaTeX.\\
164 Use "Ligatures=TeX" instead of "Mapping=tex-text".
165 }
message for package options must be loaded earlier
166 ⟨/fontspec⟩
167 ⟨∗options⟩
168 \msg_new:nnn {fontspec} {cm-default-obsolete}
169 {
170 The~"cm-default"~package~option~is~obsolete.
171 }
172 \msg_new:nnn {fontspec} {enc-obsolete}
173 {
174 The~"#1"~package~option~is~obsolete.~TU~is~the~default~encoding.
175 }
176 ⟨/options⟩
177 ⟨∗fontspec⟩
178 \@@_msg_new:nn {font-index-needs-ttc}
179 {
180 The "FontIndex" feature is only supported by TTC (TrueType Collection) fonts.\\
181 Feature ignored.
182 }
183 \@@_msg_new:nn {feat-cannot-remove}
184 {
185 The "#1" feature cannot be deactivated. Request ignored.
186 }
1.3 Info messages

16
187 \@@_msg_new:nn {defining-font}
188 {
189 Font family '\g_@@_nfss_family_tl' created for font '#2'
190 with options [\l_@@_all_features_clist].\\
191 \\
192 This font family consists of the following NFSS series/shapes:\\
193 \g_@@_defined_shapes_tl
194 }
195 \@@_msg_new:nn {no-font-shape}
196 {
197 Could not resolve font "#1" (it probably doesn't exist).
198 }
199 \@@_msg_new:nn {set-scale}
200 {
201 \l_fontspec_fontname_tl\space scale = \l_@@_scale_tl.
202 }
203 \@@_msg_new:nn {setup-math}
204 {
205 Adjusting the maths setup (use [no-math] to avoid this).
206 }
207 \@@_msg_new:nn {opa-twice}
208 {
209 Opacity set twice, in both Colour and Opacity.\\
210 Using specification "Opacity=#1".
211 }
212 \@@_msg_new:nn {opa-twice-col}
213 {
214 Opacity set twice, in both Opacity and Colour.\\
215 Using an opacity specification in hex of "#1/FF".
216 }
217 \@@_msg_new:nn {bad-colour}
218 {
219 Bad colour declaration "#1".
220 Colour must be one of:\\
221 * a named xcolor colour\\
222 * a six-digit hex colour RRGGBB\\
223 * an eight-digit hex colour RRGGBBTT with opacity
224 }
Reset ‘space’ behaviour:
225 \char_set_catcode_ignore:n {32}

17
File V
fontspec-code-opening.dtx
1 Opening code
1.1 Package options
1 \DeclareKeys
2 {
3 cm-default .code:n = { \msg_warning:nn {fontspec} {cm-default-obsolete} }
4 ,math .bool_gset:N = \g_@@_math_bool
5 ,math .usage:n = preamble
6 ,math / unknown .code:n = { } % \msg_warning:nnn {fontspec} {math-opt-unknown} {#1}
7 ,no-math .bool_gset_inverse:N = \g_@@_math_bool
8 ,no-math .usage:n = preamble
9 ,config .bool_gset:N = \g_@@_cfg_bool
10 ,config .usage:n = load
11 ,no-config .bool_gset_inverse:N = \g_@@_cfg_bool
12 ,no-config .usage:n = load
13 ,euenc .code:n = { \msg_warning:nnn {fontspec} {enc-obsolete}{euenc} }
14 ,tuenc .code:n = { \msg_warning:nnn {fontspec} {enc-obsolete}{tuenc} }
15 ,quiet .code:n =
16 {
17 \msg_redirect_module:nnn { fontspec } { warning } { info }
18 \msg_redirect_module:nnn { fontspec } { info } { none }
19 }
20 ,silent .code:n =
21 {
22 \msg_redirect_module:nnn { fontspec } { warning } { none }
23 \msg_redirect_module:nnn { fontspec } { info } { none }
24 }
25 ,verbose .code:n =
26 {
27 \msg_redirect_module:nnn { fontspec } { warning } { warning }
28 \msg_redirect_module:nnn { fontspec } { info } { info }
29 }
30 }
31 \msg_new:nnn {fontspec} {math-opt-unknown}
32 {
33 The~ global~ option~ 'math=#1'~ is~ not~ recognised.~ It~ will~ be~ ignored.
34 }
35

36 \SetKeys{config,math}
37 \ProcessKeyOptions

1.2 Encodings
Now the default, with a just-in-case check:
38 \cs_if_exist:cF {T@TU}

18
39 {
40 \@@_warning:n {tu-clash}
41 \DeclareFontEncoding{TU}{}{}
42 \DeclareFontSubstitution{TU}{lmr}{m}{n}
43 }
44 \tl_gset:Nn \g_fontspec_encoding_tl { TU }
45 \tl_set:Nn \rmdefault {lmr}
46 \tl_set:Nn \sfdefault {lmss}
47 \tl_set:Nn \ttdefault {lmtt}
48 \RequirePackage[\g_fontspec_encoding_tl]{fontenc}
49 \tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode if needed
To overcome the encoding changing the current font size, but only if a class has been loaded
first:
50 \tl_if_in:NnT \@filelist {.cls} { \normalsize }
Dealing with a couple of the problems introduced by babel:
51 \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl
52 \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
53 \AtBeginDocument
54 {
55 \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl
56 \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
57 }
That latin encoding definition is repeated to suppress font warnings. Something to do with
\select@language ending up in the .aux file which is read at the beginning of the document.

1.3 Generic functions


\FontspecSetCheckBoolTrue These strange set functions are to simplify returning code from LuaTeX:
\FontspecSetCheckBoolFalse 58 \cs_new:Npn \FontspecSetCheckBoolTrue { \bool_set_true:N \l_@@_check_bool }
59 \cs_new:Npn \FontspecSetCheckBoolFalse { \bool_set_false:N \l_@@_check_bool }

(End of definition for \FontspecSetCheckBoolTrue and \FontspecSetCheckBoolFalse. These functions are docu-
mented on page ??.)

\@@_keys_set_known:nnN
60 \cs_new:Nn \@@_keys_set_known:nnN
61 {
62 ⟨debug⟩ \typeout{:::: Keys~set:~{#1}~{#2} }
63 \keys_set_known:nnN {#1} {#2} #3
64 ⟨debug⟩ \typeout{:::: Leftover:~{#3} }
65 }
66 \cs_generate_variant:Nn \@@_keys_set_known:nnN {nx}

(End of definition for \@@_keys_set_known:nnN. This function is documented on page ??.)

\@@_int_mult_truncate:Nn Missing in expl3, IMO.


67 \cs_new:Nn \@@_int_mult_truncate:Nn
68 {
69 \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: }
70 }

19
(End of definition for \@@_int_mult_truncate:Nn. This function is documented on page ??.)

\@@_lua_function:ne
\@@_lua_function:nee 71 ⟨∗LU⟩
\@@_lua_function:neee 72 \cs_set:Npn \@@_lua_function:ne #1#2 { \lua_now:e { fontspec.#1 ("#2")
\@@_lua_function:neeee 73 \cs_set:Npn \@@_lua_function:nee #1#2#3 { \lua_now:e { fontspec.#1 ("#2","#3")
74 \cs_set:Npn \@@_lua_function:neee #1#2#3#4 { \lua_now:e { fontspec.#1 ("#2","#3","#4")
75 \cs_set:Npn \@@_lua_function:neeee #1#2#3#4#5 { \lua_now:e { fontspec.#1 ("#2","#3","#4","#5")
76 ⟨/LU⟩

(End of definition for \@@_lua_function:ne and others. These functions are documented on page ??.)

1.4 expl3 variants


77 \cs_generate_variant:Nn \int_set:Nn {Nv}
78 \cs_generate_variant:Nn \prop_gput_if_not_in:Nnn {NeV}
79 \cs_generate_variant:Nn \prop_gput:Nnn {Nxn} % needed by unicode-math
80 \cs_generate_variant:Nn \tl_if_empty:nF {f}
81 \cs_generate_variant:Nn \tl_if_eq:nnT {oe}

20
File VI
fontspec-code-fontload.dtx
1 expl3 interface for primitive font loading
\@@_primitive_font_set:Nnn
\@@_primitive_font_gset:Nnn 1 \cs_set:Npn \@@_primitive_font_set:Nnn #1#2#3
2 {
3 \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop:
4 }
5 \cs_set:Npn \@@_primitive_font_gset:Nnn #1#2#3
6 {
7 \global \font #1 = #2 ~at~ \dim_eval:n {#3} \scan_stop:
8 }

(End of definition for \@@_primitive_font_set:Nnn and \@@_primitive_font_gset:Nnn. These functions are doc-
umented on page ??.)

\@@_font_suppress_not_found_error:
9 \cs_set:Npn \@@_font_suppress_not_found_error:
10 {
11 \int_set:Nn \suppressfontnotfounderror {1}
12 }

(End of definition for \@@_font_suppress_not_found_error:. This function is documented on page ??.)

\@@_primitive_font_if_null_p:N
@@_primitive_font_if_null:NTF 13 \prg_new_conditional:Nnn \@@_primitive_font_if_null:N {p,TF,T,F}
14 {
15 \ifx #1 \nullfont
16 \prg_return_true:
17 \else
18 \prg_return_false:
19 \fi
20 }

(End of definition for \@@_primitive_font_if_null:NTF. This function is documented on page ??.)

\@@_primitive_font_set_p:NnnTF
@@_primitive_font_set:NnnTFTF 21 \prg_new_conditional:Nnn \@@_primitive_font_set:Nnn {TF,T,F}
\@@_primitive_font_gset_p:NnnTF 22 {
\@@_primitive_font_gset:NnnTFTF 23 \@@_primitive_font_set:Nnn #1 {#2} {#3}
24 \@@_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:}
25 }
26 \prg_new_conditional:Nnn \@@_primitive_font_gset:Nnn {TF,T,F}
27 {
28 \@@_primitive_font_gset:Nnn #1 {#2} {#3}
29 \@@_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:}
30 }
31 \cs_set:Npn \@@_primitive_font_set:Onn { \exp_last_unbraced:No \@@_primitive_font_set:Nnn }

21
32 \cs_set:Npn \@@_primitive_font_set:OnnF { \exp_last_unbraced:No \@@_primitive_font_set:NnnF }
33 \cs_set:Npn \@@_primitive_font_gset:Onn { \exp_last_unbraced:No \@@_primitive_font_gset:Nnn }
34 \cs_set:Npn \@@_primitive_font_gset:OnnF { \exp_last_unbraced:No \@@_primitive_font_gset:NnnF

(End of definition for \@@_primitive_font_set:NnnTFTF and \@@_primitive_font_gset:NnnTFTF. These func-


tions are documented on page ??.)

\@@_primitive_font_if_exist:nTF
35 \prg_new_conditional:Nnn \@@_primitive_font_if_exist:n {TF,T,F}
36 {
37 \group_begin:
38 \@@_font_suppress_not_found_error:
39 \@@_primitive_font_set:Nnn \l_@@_primitive_font {#1} { \f@size pt - 1sp }
40 \@@_primitive_font_if_null:NTF \l_@@_primitive_font
41 { \group_end: \prg_return_false: }
42 { \group_end: \prg_return_true: }
43 }

(End of definition for \@@_primitive_font_if_exist:nTF. This function is documented on page ??.)

\@@_primitive_font_glyph_if_exist:NnTF
44 \prg_new_conditional:Nnn \@@_primitive_font_glyph_if_exist:Nn {p,TF,T,F}
45 {
46 \tex_iffontchar:D #1 #2 \scan_stop:
47 \prg_return_true:
48 \else:
49 \prg_return_false:
50 \fi:
51 }

(End of definition for \@@_primitive_font_glyph_if_exist:NnTF. This function is documented on page ??.)

\@@_primitive_font_set_hyphenchar:Nn
52 \cs_new:Nn \@@_primitive_font_set_hyphenchar:Nn
53 {
54 \tex_hyphenchar:D #1 = #2 \scan_stop:
55 }

(End of definition for \@@_primitive_font_set_hyphenchar:Nn. This function is documented on page ??.)

\@@_primitive_font_get_name:N
\@@_primitive_font_current_name: 56 \cs_new_eq:NN \@@_primitive_font_get_name:N \fontname
57 \cs_new:Npn \@@_primitive_font_current_name:
58 {
59 \@@_primitive_font_get_name:N \tex_font:D
60 }

(End of definition for \@@_primitive_font_get_name:N and \@@_primitive_font_current_name:. These func-


tions are documented on page ??.)

22
File VII
fontspec-code-interfaces.dtx
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 1 on page 27.
1 \NewDocumentCommand \fontspec { O{} m O{} }
2 {
3 \@@_main_fontspec:nn {#1,#3} {#2}
4 \ignorespaces
5 }
6 \NewDocumentCommand \setmainfont { O{} m O{} }
7 {
8 \@@_main_setmainfont:nn {#1,#3} {#2}
9 \ignorespaces
10 }
11 \NewDocumentCommand \setsansfont { O{} m O{} }
12 {
13 \@@_main_setsansfont:nn {#1,#3} {#2}
14 \ignorespaces
15 }
16 \NewDocumentCommand \setmonofont { O{} m O{} }
17 {
18 \@@_main_setmonofont:nn {#1,#3} {#2}
19 \ignorespaces
20 }
21 \NewDocumentCommand \setmathrm { O{} m O{} }
22 {
23 \@@_main_setmathrm:nn {#1,#3} {#2}
24 }
25 \NewDocumentCommand \setboldmathrm { O{} m O{} }
26 {
27 \@@_main_setboldmathrm:nn {#1,#3} {#2}
28 }
29 \NewDocumentCommand \setmathsf { O{} m O{} }
30 {
31 \@@_main_setmathsf:nn {#1,#3} {#2}
32 }
33 \NewDocumentCommand \setmathtt { O{} m O{} }
34 {
35 \@@_main_setmathtt:nn {#1,#3} {#2}
36 }

23
\setromanfont This is the old name for \setmainfont, retained ad infinitum for backwards compatibility. It
was deprecated in 2010.
37 \NewDocumentCommand \setromanfont { O{} m O{} }
38 {
39 \@@_main_setmainfont:nn {#1,#3} {#2}
40 }

(End of definition for \setromanfont. This function is documented on page ??.)

41 \NewDocumentCommand \newfontfamily { m O{} m O{} }


42 {
43 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
44 }
45 \NewDocumentCommand \renewfontfamily { m O{} m O{} }
46 {
47 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
48 }
49 \NewDocumentCommand \setfontfamily { m O{} m O{} }
50 {
51 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
52 }
53 \NewDocumentCommand \providefontfamily { m O{} m O{} }
54 {
55 \@@_main_newfontfamily:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
56 }
57 \NewDocumentCommand \newfontface { m O{} m O{} }
58 {
59 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \NewDocumentCommand
60 }
61 \NewDocumentCommand \renewfontface { m O{} m O{} }
62 {
63 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \RenewDocumentCommand
64 }
65 \NewDocumentCommand \setfontface { m O{} m O{} }
66 {
67 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \DeclareDocumentCommand
68 }
69 \NewDocumentCommand \providefontface { m O{} m O{} }
70 {
71 \@@_main_newfontface:NnnN #1 {#2,#4} {#3} \ProvideDocumentCommand
72 }

\defaultfontfeatures This macro takes one argument that consists of all of feature options that will be applied by
default to all subsequent \fontspec commands.
73 \NewDocumentCommand \defaultfontfeatures { t+ o m }
74 {
75 \IfNoValueTF {#2}
76 { \@@_set_default_features:nn {#1} {#3} }
77 { \@@_set_font_default_features:nnn {#1} {#2} {#3} }

24
78 \ignorespaces
79 }

(End of definition for \defaultfontfeatures. This function is documented on page ??.)

80 \NewDocumentCommand \addfontfeatures {m}


81 {
82 \@@_main_addfontfeatures:n {#1}
83 }
84 \NewDocumentCommand \addfontfeature {m}
85 {
86 \@@_main_addfontfeatures:n {#1}
87 }
88 \NewDocumentCommand \newfontfeature {mm}
89 {
90 \@@_main_newfontfeature:nn {#1} {#2}
91 }
92 \NewDocumentCommand \newAATfeature {mmmm}
93 {
94 \@@_main_newAATfeature:nnnn {#1} {#2} {#3} {#4}
95 }
96 \NewDocumentCommand \newopentypefeature {mmm}
97 {
98 \@@_main_newopentypefeature:nnn {#1} {#2} {#3}
99 }

\newICUfeature Deprecated.
100 \NewDocumentCommand \newICUfeature {mmm}
101 {
102 \@@_main_newopentypefeature:nnn {#1} {#2} {#3}
103 }

(End of definition for \newICUfeature. This function is documented on page ??.)

104 \NewDocumentCommand \aliasfontfeature {mm}


105 {
106 \@@_main_aliasfontfeature:nn {#1} {#2}
107 }
108 \NewDocumentCommand \aliasfontfeatureoption {mmm}
109 {
110 \@@_main_aliasfontfeatureoption:nnn {#1} {#2} {#3}
111 }

\newfontscript Mostly used internally, but also possibly useful for users, to define new OpenType ‘scripts’,
mapping logical names to OpenType script tags.
112 \NewDocumentCommand \newfontscript {mm}
113 {
114 \fontspec_new_script:nn {#1} {#2}
115 }

(End of definition for \newfontscript. This function is documented on page ??.)

25
\newfontlanguage Mostly used internally, but also possibly useful for users, to define new OpenType ‘languages’,
mapping logical names to OpenType language tags.
116 \NewDocumentCommand \newfontlanguage {mm}
117 {
118 \fontspec_new_lang:nn {#1} {#2}
119 }

(End of definition for \newfontlanguage. This function is documented on page ??.)

120 \NewDocumentCommand \DeclareFontExtensions {m}


121 {
122 \@@_main_DeclareFontExtensions:n {#1}
123 }
124 \NewDocumentCommand \IfFontFeatureActiveTF {mmm}
125 {
126 \@@_main_IfFontFeatureActiveTF:nnn {#1} {#2} {#3}
127 }

\oldstylenums This is performed only after the preamble to overwrite any redefinition by textcomp:
128 \AtBeginDocument
129 {
130 \RenewDocumentCommand \oldstylenums {m}
131 {
132 \@@_main_oldstylenums:n {#1}
133 }
134 }

(End of definition for \oldstylenums. This function is documented on page ??.)

\liningnums
135 \NewDocumentCommand \liningnums {m}
136 {
137 \@@_main_liningnums:n {#1}
138 }

(End of definition for \liningnums. This function is documented on page ??.)

26
File VIII
fontspec-code-user.dtx
1 User command internals
1.1 Font selection
\@@_main_fontspec:nn This is the main command of the package that selects fonts with various features. It takes two
arguments: the font name and the optional requested features of that font.
1 \cs_new:Nn \@@_main_fontspec:nn
2 {
3 \fontspec_set_family:Nnn \f@family {#1} {#2}
4 \fontencoding { \g_@@_nfss_enc_tl }
5 \selectfont
6 }

(End of definition for \@@_main_fontspec:nn. This function is documented on page ??.)

\rmfamily Add an encoding switch to the three family commands.


\sffamily 7 \cs_if_exist:NTF \@rmfamilyhook
\ttfamily 8 {
9 \tl_put_right:Nn \@rmfamilyhook {\fontencoding \l_@@_rmfamily_encoding_tl}
10 \tl_put_right:Nn \@sffamilyhook {\fontencoding \l_@@_sffamily_encoding_tl}
11 \tl_put_right:Nn \@ttfamilyhook {\fontencoding \l_@@_ttfamily_encoding_tl}
12 }
13 {
14 \tl_replace_all:cnn { rmfamily~ } { \fontfamily }
15 { \fontencoding \l_@@_rmfamily_encoding_tl \fontfamily }
16 \tl_replace_all:cnn { sffamily~ } { \fontfamily }
17 { \fontencoding \l_@@_sffamily_encoding_tl \fontfamily }
18 \tl_replace_all:cnn { ttfamily~ } { \fontfamily }
19 { \fontencoding \l_@@_ttfamily_encoding_tl \fontfamily }
20 }
21 \tl_set:Nn \l_@@_rmfamily_encoding_tl { \encodingdefault }
22 \tl_set:Nn \l_@@_sffamily_encoding_tl { \encodingdefault }
23 \tl_set:Nn \l_@@_ttfamily_encoding_tl { \encodingdefault }

(End of definition for \rmfamily , \sffamily , and \ttfamily. These functions are documented on page ??.)

\setmainfont The following three macros perform equivalent operations setting the default font for a par-
ticular family: ‘roman’, sans serif, or typewriter (monospaced).
They end with \normalfont so that if they’re used in the document, the change registers
immediately.
24 \cs_new:Nn \@@_main_setmainfont:nn
25 {
26 ⟨debug⟩\typeout{::~_main_setmainfont:nn}
27 \ifdefined\DeclareFontSeriesDefault
28 \DeclareFontSeriesDefault[rm]{bf}{\bfdefault}
29 \fi
30 \fontspec_set_family:Nnn \l_@@_rmfamily_family_tl {#1} {#2}

27
31 \tl_set_eq:NN \rmdefault \l_@@_rmfamily_family_tl
32 \tl_set_eq:NN \l_@@_rmfamily_encoding_tl \g_@@_nfss_enc_tl
33 \str_if_eq:eeT {\familydefault} {\rmdefault}
34 { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl }
35 \@@_setmainfont_hook:nn {#1} {#2} % for unicode-math only
36 \normalfont
37 }

(End of definition for \setmainfont. This function is documented on page ??.)

\setsansfont Same as above.


38 \cs_new:Nn \@@_main_setsansfont:nn
39 {
40 \ifdefined\DeclareFontSeriesDefault
41 \DeclareFontSeriesDefault[sf]{bf}{\bfdefault}
42 \fi
43 \fontspec_set_family:Nnn \l_@@_sffamily_family_tl {#1} {#2}
44 \tl_set_eq:NN \sfdefault \l_@@_sffamily_family_tl
45 \tl_set_eq:NN \l_@@_sffamily_encoding_tl \g_@@_nfss_enc_tl
46 \str_if_eq:eeT {\familydefault} {\sfdefault}
47 { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl }
48 \@@_setsansfont_hook:nn {#1} {#2} % for unicode-math only
49 \normalfont
50 }
(End of definition for \setsansfont. This function is documented on page ??.)

\setmonofont Same as above.


51 \cs_new:Nn \@@_main_setmonofont:nn
52 {
53 \ifdefined\DeclareFontSeriesDefault
54 \DeclareFontSeriesDefault[tt]{bf}{\bfdefault}
55 \fi
56 \fontspec_set_family:Nnn \l_@@_ttfamily_family_tl {#1} {#2}
57 \tl_set_eq:NN \ttdefault \l_@@_ttfamily_family_tl
58 \tl_set_eq:NN \l_@@_ttfamily_encoding_tl \g_@@_nfss_enc_tl
59 \str_if_eq:eeT {\familydefault} {\ttdefault}
60 { \tl_set_eq:NN \encodingdefault \g_@@_nfss_enc_tl }
61 \@@_setmonofont_hook:nn {#1} {#2} % for unicode-math only
62 \normalfont
63 }
(End of definition for \setmonofont. This function is documented on page ??.)

\setmathrm These commands are analogous to \setmainfont and others, but for selecting the font used
for \mathrm, etc. They can only be used in the preamble of the document. \setboldmathrm
is used for specifying which fonts should be used in \boldmath.
64 \cs_new:Nn \@@_main_setmathrm:nn
65 {
66 ⟨XE⟩ \fontspec_gset_family:Nnn \g_@@_mathrm_tl {#1} {#2}
67 ⟨LU⟩ \fontspec_gset_family:Nnn \g_@@_mathrm_tl {Renderer=Basic,#1} {#2}
68 \@@_setmathrm_hook:nn {#1} {#2} % for unicode-math only
69 }

28
(End of definition for \setmathrm. This function is documented on page ??.)

\setboldmathrm
70 \cs_new:Nn \@@_main_setboldmathrm:nn
71 {
72 ⟨XE⟩ \fontspec_gset_family:Nnn \g_@@_bfmathrm_tl {#1} {#2}
73 ⟨LU⟩ \fontspec_gset_family:Nnn \g_@@_bfmathrm_tl {Renderer=Basic,#1} {#2}
74 \@@_setboldmathrm_hook:nn {#1} {#2} % for unicode-math only
75 }

(End of definition for \setboldmathrm. This function is documented on page ??.)

\setmathsf
76 \cs_new:Nn \@@_main_setmathsf:nn
77 {
78 ⟨XE⟩ \fontspec_gset_family:Nnn \g_@@_mathsf_tl {#1} {#2}
79 ⟨LU⟩ \fontspec_gset_family:Nnn \g_@@_mathsf_tl {Renderer=Basic,#1} {#2}
80 \@@_setmathsf_hook:nn {#1} {#2} % for unicode-math only
81 }

(End of definition for \setmathsf. This function is documented on page ??.)

\setmathtt
82 \cs_new:Nn \@@_main_setmathtt:nn
83 {
84 ⟨XE⟩ \fontspec_gset_family:Nnn \g_@@_mathtt_tl {#1} {#2}
85 ⟨LU⟩ \fontspec_gset_family:Nnn \g_@@_mathtt_tl {Renderer=Basic,#1} {#2}
86 \@@_setmathtt_hook:nn {#1} {#2} % for unicode-math only
87 }

(End of definition for \setmathtt. This function is documented on page ??.)


Hooks:
88 \cs_set_eq:NN \@@_setmainfont_hook:nn \use_none:nn
89 \cs_set_eq:NN \@@_setsansfont_hook:nn \use_none:nn
90 \cs_set_eq:NN \@@_setmonofont_hook:nn \use_none:nn
91 \cs_set_eq:NN \@@_setmathrm_hook:nn \use_none:nn
92 \cs_set_eq:NN \@@_setmathsf_hook:nn \use_none:nn
93 \cs_set_eq:NN \@@_setmathtt_hook:nn \use_none:nn
94 \cs_set_eq:NN \@@_setboldmathrm_hook:nn \use_none:nn
Hmm, this isn’t necessary with unicode-math; oh well:
95 \@onlypreamble\setmathrm
96 \@onlypreamble\setboldmathrm
97 \@onlypreamble\setmathsf
98 \@onlypreamble\setmathtt
If the commands above are not executed, then \rmdefault (etc.) will be used.
99 \tl_gset:Nn \g_@@_mathrm_tl {\rmdefault}
100 \tl_gset:Nn \g_@@_mathsf_tl {\sfdefault}
101 \tl_gset:Nn \g_@@_mathtt_tl {\ttdefault}

29
\@@_main_newfontfamily:NnnN The inner fontspec workings define a font family, which is then used in a typical NFSS
\fontfamily declaration, saved in the macro name specified. The fourth argument deter-
mines which xparse function to set the macro with (new/renew/etc).
102 \cs_new:Nn \@@_main_newfontfamily:NnnN
103 {
104 \fontspec_set_family:cnn { l_@@_ \cs_to_str:N #1 _family_tl } {#2} {#3}
105 \use:x
106 {
107 \exp_not:N #4 \exp_not:N #1 {}
108 {
109 \exp_not:N \fontfamily { \use:c { l_@@_ \cs_to_str:N #1 _family_tl } }
110 \exp_not:N \fontencoding { \g_@@_nfss_enc_tl }
111 \exp_not:N \selectfont
112 }
113 }
114 }

(End of definition for \@@_main_newfontfamily:NnnN. This function is documented on page ??.)

\@@_main_newfontface:NnnN \newfontface uses the fact that if the argument to BoldFont, etc., is empty (i.e., BoldFont={}),
then no bold font is searched for.
115 \cs_new:Nn \@@_main_newfontface:NnnN
116 {
117 \@@_main_newfontfamily:NnnN #1 { BoldFont={},ItalicFont={},SmallCapsFont={},#2 } {#3} #4
118 }

(End of definition for \@@_main_newfontface:NnnN. This function is documented on page ??.)

1.2 Font feature selection


\@@_set_default_features:nn
119 \cs_new:Nn \@@_set_default_features:nn
120 {
121 \IfBooleanTF {#1} \clist_gput_right:Nn \clist_gset:Nn
122 \g_@@_default_fontopts_clist {#2}
123 }

(End of definition for \@@_set_default_features:nn. This function is documented on page ??.)

\@@_set_font_default_features:nnn The optional argument #2 specifies font identifier(s). Branch for either (a) single token input
such as \rmdefault, or (b) otherwise assume its a fontname. In that case, strip spaces and
file extensions and lower-case to ensure consistency.
124 \cs_new:Nn \@@_set_font_default_features:nnn
125 {
126 ⟨debug⟩ \typeout{\unexpanded{_set_font_default_features:nnn:{#1}{#2}{#3}}}
127 \clist_map_inline:nn {#2}
128 {
129 \tl_if_single:nTF {##1}
130 { \tl_set:No \l_@@_tmp_tl { \cs:w l_@@_ \cs_to_str:N ##1 _family_tl\cs_end: } }
131 { \@@_sanitise_fontname:Nn \l_@@_tmp_tl {##1} }
132

30
133 \IfBooleanTF {#1}
134 {
135 \prop_get:NVNF \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_tmpb_tl
136 { \tl_clear:N \l_@@_tmpb_tl }
137 \tl_put_right:Nn \l_@@_tmpb_tl {#3,}
138 \prop_gput:NVV \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_tmpb_tl
139 }
140 {
141 \tl_if_empty:nTF {#3}
142 { \prop_gremove:NV \g_@@_fontopts_prop \l_@@_tmp_tl }
143 { \prop_gput:NVn \g_@@_fontopts_prop \l_@@_tmp_tl {#3,} }
144 }
145 }
146 }

(End of definition for \@@_set_font_default_features:nnn. This function is documented on page ??.)

\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
created, 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 \g_fontspec_default_fontopts_-
tl is emptied inside the group; this is allowed as \l_fontspec_family_tl is globally defined
in \@@_select_font_family:nn), 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.
147 \cs_new:Nn \@@_main_addfontfeatures:n
148 {
149 ⟨debug⟩ \typeout{^^J::::::::::::::::::::::::::::::::::^^J: addfontfeatures}
150 \fontspec_if_fontspec_font:TF
151 {
152 \group_begin:
153 \keys_set_known:nnN {fontspec-addfeatures} {#1} \l_@@_tmp_tl
154 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {options} \l_@@_options_tl
155 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {fontname} \l_@@_fontname_tl
156 \bool_set_true:N \l_@@_disable_defaults_bool
157 ⟨debug⟩ \typeout{ \@@_select_font_family:nn { \l_@@_options_tl , #1 } {\l_@@_fontname_tl} }
158 \use:x
159 {
160 \@@_select_font_family:nn
161 { \l_@@_options_tl , #1 } {\l_@@_fontname_tl}
162 }
163 \group_end:
164 \fontfamily \g_@@_nfss_family_tl \selectfont
165 }
166 {
167 \@@_warning:nx {addfontfeatures-ignored} {#1}
168 }

31
169 \ignorespaces
170 }

(End of definition for \addfontfeatures. This function is documented on page ??.)

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.
171 \cs_new:Nn \@@_main_newfontfeature:nn
172 {
173 \keys_define:nn { fontspec }
174 {
175 #1 .code:n = { \@@_update_featstr:n {#2} }
176 }
177 }

(End of definition for \newfontfeature. This function is documented on page ??.)

\newAATfeature This command assigns a new AAT feature by its code (#2,#3) to a new name (#1). Better than
\newfontfeature because it checks if the feature exists in the font it’s being used for.
178 \cs_new:Nn \@@_main_newAATfeature:nnnn
179 {
180 \keys_if_exist:nnF { fontspec } {#1}
181 { \@@_define_aat_feature_group:n {#1} }
182

183 \keys_if_choice_exist:nnnT {fontspec} {#1} {#2}


184 { \@@_warning:nxx {feature-option-overwrite} {#1} {#2} }
185

186 \@@_define_aat_feature:nnnn {#1}{#2}{#3}{#4}


187 }

(End of definition for \newAATfeature. This function is documented on page ??.)

\newopentypefeature This command assigns a new OpenType feature by its abbreviation (#2) to a new name (#1).
Better than \newfontfeature because it checks if the feature exists in the font it’s being used
for.
188 \cs_new:Nn \@@_main_newopentypefeature:nnn
189 {
190 \keys_if_exist:nnF { fontspec / options } {#1}
191 { \@@_define_opentype_feature_group:n {#1} }
192

193 \keys_if_choice_exist:nnnT {fontspec} {#1} {#2}


194 { \@@_warning:nxx {feature-option-overwrite} {#1} {#2} }
195

196 \exp_args:Nnnx \@@_define_opentype_feature:nnnnn


197 {#1} {#2} { \@@_strip_plus_minus:n {#3} } {#3} {}
198 }

32
199 \cs_new:Nn \@@_strip_plus_minus:n { \@@_strip_plus_minus_aux:Nq #1 \q_nil }
200 \cs_new:Npn \@@_strip_plus_minus_aux:Nq #1#2 \q_nil
201 {
202 \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2}
203 }

(End of definition for \newopentypefeature. This function is documented on page ??.)

\aliasfontfeature User commands for renaming font features and font feature options.
204 \cs_new:Nn \@@_main_aliasfontfeature:nn
205 {
206 ⟨debug⟩ \typeout{::::::::::::::::::::^^J:: aliasfontfeature{#1}{#2}}
207 \bool_set_false:N \l_@@_alias_bool
208

209 \clist_map_inline:Nn \g_@@_all_keyval_modules_clist


210 {
211 \keys_if_exist:nnT {##1} {#1}
212 {
213 ⟨debug⟩ \typeout{:::: Key~exists~##1~/~#1}
214 \bool_set_true:N \l_@@_alias_bool
215 \keys_define:nn {##1}
216 { #2 .code:n = { \keys_set:nn {##1} { #1 = {####1} } } }
217 }
218 }
219

220 \bool_if:NF \l_@@_alias_bool


221 { \@@_warning:nx {rename-feature-not-exist} {#1} }
222 }

(End of definition for \aliasfontfeature. This function is documented on page ??.)

\aliasfontfeatureoption
223 \cs_new:Nn \@@_main_aliasfontfeatureoption:nnn
224 {
225 \bool_set_false:N \l_@@_alias_bool
226

227 \clist_map_inline:Nn \g_@@_all_keyval_modules_clist


228 {
229 \keys_if_exist:nnT { ##1 / #1 } {#2}
230 {
231 ⟨debug⟩ \typeout{:::: Keyval~exists~##1~/~#1~=~#2}
232 \bool_set_true:N \l_@@_alias_bool
233 \keys_define:nn { ##1 / #1 }
234 { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } }
235 }
236

237 \keys_if_exist:nnT { ##1 / #1 } {#2Reset}


238 {
239 ⟨debug⟩ \typeout{:::: Keyval~exists~##1~/~#1~=~#2Reset}
240 \keys_define:nn { ##1 / #1 }
241 { #3Reset .code:n = { \keys_set:nn {##1} { #1 = {#2Reset} } } }
242 }

33
243

244 \keys_if_exist:nnT { ##1 / #1 } {#2Off}


245 {
246 ⟨debug⟩ \typeout{:::: Keyval~exists~##1~/~#1~=~#2Off}
247 \keys_define:nn { ##1 / #1 }
248 { #3Off .code:n = { \keys_set:nn {##1} { #1 = {#2Off} } } }
249 }
250 }
251

252 \bool_if:NF \l_@@_alias_bool


253 { \@@_warning:nx {rename-feature-not-exist} {#1/#2} }
254 }

(End of definition for \aliasfontfeatureoption. This function is documented on page ??.)

\@@_main_DeclareFontExtensions:n
255 \cs_new:Nn \@@_main_DeclareFontExtensions:n
256 {
257 \clist_set:Nn \l_@@_extensions_clist { #1 }
258 }
Defaults:
259 \@@_main_DeclareFontExtensions:n {.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont}

(End of definition for \@@_main_DeclareFontExtensions:n. This function is documented on page ??.)

1.4 High level conditionals


\IfFontFeatureActiveTF
260 \cs_new:Nn \@@_main_IfFontFeatureActiveTF:nnn
261 {
262 ⟨debug⟩ \typeout{^^J:::::::::::::::::::::::::::::::::::::::::::::::}
263 ⟨debug⟩ \typeout{:IfFontFeatureActiveTF \exp_not:n{{#1}{#2}{#3}}}
264 \@@_if_font_feature:nTF {#1} {#2} {#3}
265 }
266 \prg_new_conditional:Nnn \@@_if_font_feature:n {TF}
267 {
268 \tl_gclear:N \g_@@_single_feat_tl
269 \group_begin:
270 \@@_font_suppress_not_found_error:
271 \@@_init:
272 \bool_set_true:N \l_@@_ot_bool
273 \bool_set_true:N \l_@@_never_check_bool
274 \bool_set_false:N \l_@@_firsttime_bool
275 \clist_clear:N \l_@@_fontfeat_clist
276 \@@_get_features:n {#1}
277 \group_end:
278

279 ⟨debug⟩ \typeout{:::> \exp_not:N\g_@@_rawfeatures_sclist->~{\g_@@_rawfeatures_sclist}}


280 ⟨debug⟩ \typeout{:::> \exp_not:N\g_@@_single_feat_tl->~{\g_@@_single_feat_tl}}
281

282 \tl_if_empty:NTF \g_@@_single_feat_tl { \prg_return_false: }

34
283 {
284 \exp_args:NV \fontspec_if_current_feature:nTF \g_@@_single_feat_tl
285 { \prg_return_true: } { \prg_return_false: }
286 }
287 }

(End of definition for \IfFontFeatureActiveTF. This function is documented on page ??.)

1.5 \oldstylenums and \liningnums


\oldstylenums This command needs a redefinition. And we may as well provide the reverse command.
\liningnums 288 \cs_new_protected:Nn \@@_main_oldstylenums:n
289 {
290 \group_begin:
291 \addfontfeature{Numbers=OldStyle}
292 #1
293 \group_end:
294 }
295 \cs_new_protected:Nn \@@_main_liningnums:n
296 {
297 \group_begin:
298 \addfontfeature{Numbers=Lining}
299 #1
300 \group_end:
301 }

(End of definition for \oldstylenums and \liningnums. These functions are documented on page ??.)

35
File IX
fontspec-code-api.dtx
1 Programmer’s interface
These functions are not used directly by fontspec when defining fonts; they are designed to
be used by other packages who wish to do font-related things on top of fontspec itself.
Because I haven’t fully explored how these functions will behave in practise, I am not
giving them user-level names. As it becomes more clear which of these should be accessible
by document writers, I’ll open them up a little more.
All functions are defined assuming that the font to be queried is currently selected as a
fontspec font. (I.e., via \fontspec or from a \newfontfamily macro or from \setmainfont
and so on.)

2 Overview
2.1 Commands

\fontspec_gset_family:Nnn \fontspec_set_family:Nnn ⟨family⟩ {⟨features⟩} {⟨font name⟩}


\fontspec_set_family:Nnn
Defines a new NFSS font family from given ⟨features⟩ and ⟨font⟩, and stores the name in
the token list variable ⟨family⟩. See the standard fontspec user commands for applications
of this function.

\fontspec_gset_fontface:NNnn \fontspec_set_fontface:NNnn ⟨face⟩ ⟨family⟩ {⟨features⟩} {⟨font name⟩}


\fontspec_set_fontface:NNnn

As for \fontspec_set_family:Nnn but with a single font face only. (E.g., no bold, italic
shapes, etc.) The control sequence ⟨face⟩ is a primitive TEX font command.

2.2 Conditionals

\fontspec_font_if_exist:nTF \fontspec_font_if_exist:nTF {⟨font name⟩} Argtrue code {⟨false code⟩}

Does this font exist? The font name can refer to the ‘logical’ name or to a filename with known
font extension.

\fontspec_if_fontspec_font:TF \fontspec_if_fontspec_font:TF {⟨true code⟩} {⟨false code⟩}

\fontspec_if_aat_feature:nnTF \fontspec_if_aat_feature:nnTF {⟨true code⟩} {⟨false code⟩}

\fontspec_if_opentype:TF \fontspec_if_opentype:TF {⟨true code⟩} {⟨false code⟩}

36
\fontspec_if_feature:nTF \fontspec_if_feature:nTF {⟨feat tag⟩} {⟨true code⟩} {⟨false code⟩}
Check if the raw OpenType ⟨feature tag⟩ is available in the current font with script and
language settings as set up when the font was loaded.

\fontspec_if_feature:nnnTF \fontspec_if_feature:nnnTF {⟨script tag⟩} {⟨lang tag⟩} {⟨feat tag⟩} {⟨true code⟩}
{⟨false code⟩}
\fontspec_if_feature:nTF {latn} {ROM} {pnum} {True} {False}
Test whether the currently selected font with raw OpenType ⟨script tag⟩ and raw OpenType
⟨language tag⟩ contains the raw OpenType ⟨feature tag⟩. Returns false if the font is not
loaded by fontspec or is not an OpenType font.

\fontspec_if_script:nTF \fontspec_if_script:nTF {⟨script tag⟩} {⟨true code⟩} {⟨false code⟩}


\fontspec_if_script:nTF {latn} {True} {False}
Test whether the currently selected font contains the raw OpenType ⟨script tag⟩.
Returns false if the font is not loaded by fontspec or is not an OpenType font.

\fontspec_if_language:nTF \fontspec_if_language:nTF {⟨lang tag⟩} {⟨true code⟩} {⟨false code⟩}


\fontspec_if_language:nTF {ROM} {True} {False}
Check if the raw OpenType ⟨language tag⟩ is available in the current font with script settings
as set up when the font was loaded.

\fontspec_if_language:nnTF \fontspec_if_language:nnTF {⟨script tag⟩} {⟨lang tag⟩} {⟨true code⟩} {⟨false code⟩}
\fontspec_if_language:nnTF {cyrl} {SRB} {True} {False}
Test whether the currently selected font contains the raw OpenType ⟨language tag⟩ in
⟨script tag⟩.
Returns false if the font is not loaded by fontspec or is not an OpenType font.

\fontspec_if_current_script:nTF \fontspec_if_current_script:nTF {⟨script tag⟩} {⟨true code⟩} {⟨false


code⟩}
Test whether the currently loaded font has been loaded with the specified raw OpenType
⟨script tag⟩.

\fontspec_if_current_language:nTF \fontspec_if_current_language:nTF {⟨lang tag⟩} {⟨true code⟩} {⟨false


code⟩}
Test whether the currently loaded font has been loaded with the specified raw OpenType
⟨language tag⟩.

\fontspec_if_current_feature:nTF \fontspec_if_current_feature:nTF {⟨feat tag⟩} {⟨true code⟩} {⟨false


code⟩}
Test whether the currently loaded font is using the specified raw OpenType ⟨feature tag⟩.

\fontspec_if_small_caps:TF \fontspec_if_small_caps:TF {⟨true code⟩} {⟨false code⟩}


Test whether the current font has small caps available.

37
3 Implementation
\fontspec_if_fontspec_font:TF
1 \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F}
2 {
3 \cs_if_exist:cTF {g_@@_fontinfo_ \f@family _prop} \prg_return_true: \prg_return_false:
4 }

(End of definition for \fontspec_if_fontspec_font:TF. This function is documented on page 36.)

\fontspec_if_aat_feature:nnTF Conditional to test if the currently selected font contains the AAT feature (#1,#2).
5 \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F}
6 {
7 \fontspec_if_fontspec_font:TF
8 {
9 \@@_set_font_type:N \font
10 \bool_if:NTF \l_@@_atsui_bool
11 {
12 \@@_make_AAT_feature_string:NnnTF \font {#1} {#2}
13 \prg_return_true: \prg_return_false:
14 }
15 {
16 \prg_return_false:
17 }
18 }
19 {
20 \prg_return_false:
21 }
22 }

(End of definition for \fontspec_if_aat_feature:nnTF. This function is documented on page 36.)

\fontspec_if_opentype:TF Test whether the currently selected font is an OpenType font. Always true for LuaTeX fonts.
23 \prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F}
24 {
25 \fontspec_if_fontspec_font:TF
26 {
27 \@@_set_font_type:N \font
28 \bool_if:NTF \l_@@_ot_bool \prg_return_true: \prg_return_false:
29 }
30 {
31 \prg_return_false:
32 }
33 }

(End of definition for \fontspec_if_opentype:TF. This function is documented on page 36.)

\fontspec_if_feature:nTF Test whether the currently selected font contains the raw OpenType feature #1. E.g.: \fontspec_if_feature:n
Returns false if the font is not loaded by fontspec or is not an OpenType font.
34 \prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F}
35 {
36 \fontspec_if_fontspec_font:TF

38
37 {
38 \@@_set_font_type:N \font
39 \bool_if:NTF \l_@@_ot_bool
40 {
41 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-num} \l_@@_tmp_tl
42 \int_set:Nn \l_@@_script_int {\l_@@_tmp_tl}
43

44 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-num} \l_@@_tmp_tl


45 \int_set:Nn \l_@@_language_int {\l_@@_tmp_tl}
46

47 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_script_tl


48 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-tag} \l_@@_lang_tl
49

50 \@@_check_ot_feat:NnnnTF \font {#1} {\l_@@_lang_tl} {\l_@@_script_tl} {\prg_return


51 }
52 {
53 \prg_return_false:
54 }
55 }
56 {
57 \prg_return_false:
58 }
59 }

(End of definition for \fontspec_if_feature:nTF. This function is documented on page 37.)

\fontspec_if_feature:nnnTF #1 : script tag


#2 : language tag
#3 : feature tag
60 \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F}
61 {
62 \fontspec_if_fontspec_font:TF
63 {
64 \@@_set_font_type:N \font
65 \bool_if:NTF \l_@@_ot_bool
66 {
67 \@@_check_ot_feat:NnnnTF \font {#3} {#2} {#1} \prg_return_true: \prg_return_false:
68 }
69 { \prg_return_false: }
70 }
71 { \prg_return_false: }
72 }

(End of definition for \fontspec_if_feature:nnnTF. This function is documented on page 37.)

\fontspec_if_script:nTF #1 : script tag


73 \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F}
74 {
75 \fontspec_if_fontspec_font:TF
76 {
77 \@@_set_font_type:N \font
78 \bool_if:NTF \l_@@_ot_bool

39
79 {
80 \@@_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false:
81 }
82 { \prg_return_false: }
83 }
84 { \prg_return_false: }
85 }

(End of definition for \fontspec_if_script:nTF. This function is documented on page 37.)

\fontspec_if_language:nTF #1 : lang tag


86 \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F}
87 {
88 \fontspec_if_fontspec_font:TF
89 {
90 \@@_set_font_type:N \font
91 \bool_if:NTF \l_@@_ot_bool
92 {
93 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-num} \l_@@_tmp_tl
94 \int_set:Nn \l_@@_script_int {\l_@@_tmp_tl}
95 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_script_tl
96

97 \@@_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false:


98 }
99 { \prg_return_false: }
100 }
101 { \prg_return_false: }
102 }

(End of definition for \fontspec_if_language:nTF. This function is documented on page 37.)

\fontspec_if_language:nnTF #1 : script tag


#2 : lang tag
103 \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F}
104 {
105 \fontspec_if_fontspec_font:TF
106 {
107 \@@_set_font_type:N \font
108 \bool_if:NTF \l_@@_ot_bool
109 {
110 \@@_check_lang:NnnTF \font {#2} {#1} \prg_return_true: \prg_return_false:
111 }
112 { \prg_return_false: }
113 }
114 { \prg_return_false: }
115 }

(End of definition for \fontspec_if_language:nnTF. This function is documented on page 37.)

\fontspec_if_current_script:nTF #1 : script tag


116 \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F}
117 {

40
118 \fontspec_if_fontspec_font:TF
119 {
120 \@@_set_font_type:N \font
121 \bool_if:NTF \l_@@_ot_bool
122 {
123 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_tmp_tl
124 \str_if_eq:nVTF {#1} \l_@@_tmp_tl
125 {\prg_return_true:} {\prg_return_false:}
126 }
127 { \prg_return_false: }
128 }
129 { \prg_return_false: }
130 }

(End of definition for \fontspec_if_current_script:nTF. This function is documented on page 37.)

\fontspec_if_current_language:nTF #1 : lang tag


131 \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F}
132 {
133 \fontspec_if_fontspec_font:TF
134 {
135 \@@_set_font_type:N \font
136 \bool_if:NTF \l_@@_ot_bool
137 {
138 \prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-tag} \l_@@_tmp_tl
139 \str_if_eq:nVTF {#1} \l_@@_tmp_tl
140 {\prg_return_true:} {\prg_return_false:}
141 }
142 { \prg_return_false: }
143 }
144 { \prg_return_false: }
145 }

(End of definition for \fontspec_if_current_language:nTF. This function is documented on page 37.)

\fontspec_gset_family:Nnn #1 : family
\fontspec_set_family:Nnn #2 : fontspec features
#3 : font
146 \cs_new:Nn \@@_tl_new_if_free:N { \tl_if_exist:NF #1 { \tl_new:N #1 } }
147 \cs_new:Nn \@@_set_family:NnnN
148 {
149 ⟨debug⟩\typeout{::::::~fontspec_set_family:Nnn}
150 \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset
151 \tl_set:Nn \l_@@_family_label_tl {#1}
152 \@@_select_font_family:nn {#2} {#3}
153 \@@_tl_new_if_free:N #1
154 #4 #1 \l_fontspec_family_tl
155 \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset
156 ⟨debug⟩\typeout{::::::~END~fontspec_set_family:Nnn}
157 }
158 \cs_new:Nn \fontspec_gset_family:Nnn { \@@_set_family:NnnN #1 {#2} {#3} \tl_gset_eq:NN }
159 \cs_new:Nn \fontspec_set_family:Nnn { \@@_set_family:NnnN #1 {#2} {#3} \tl_set_eq:NN }

41
160 \cs_generate_variant:Nn \fontspec_set_family:Nnn {c}

(End of definition for \fontspec_gset_family:Nnn and \fontspec_set_family:Nnn. These functions are docu-
mented on page 36.)

\fontspec_gset_fontface:NNnn TODO: the round-about approach of using \fontname means that settings such as fontdi-
\fontspec_set_fontface:NNnn mens will be lost. (Discovered in unicode-math.) Investigate!
161 \tl_new:N \l_@@_fontface_cs_tl
162 \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font}
163 \cs_new:Nn \@@_set_fontface:NNnnN
164 {
165 \tl_set:Nn \l_@@_fontface_cs_tl {#1}
166 \tl_set:Nn \l_@@_family_label_tl {#2}
167 \@@_select_font_family:nn {#3} {#4}
168 #5 #2 \l_fontspec_family_tl
169 \tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset
170 }
171 \cs_new:Nn \fontspec_gset_fontface:NNnn { \@@_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_gset_eq:N
172 \cs_new:Nn \fontspec_set_fontface:NNnn { \@@_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_set_eq:NN

(End of definition for \fontspec_gset_fontface:NNnn and \fontspec_set_fontface:NNnn. These functions are


documented on page 36.)

\fontspec_font_if_exist:nTF
173 \prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F}
174 {
175 \group_begin:
176 \@@_init:
177 \@@_if_detect_external:nT {#1} { \@@_font_is_file: }
178 \@@_primitive_font_if_exist:nTF { \@@_construct_font_call:nn {#1} {} }
179 { \group_end: \prg_return_true: }
180 { \group_end: \prg_return_false: }
181 }
182 \cs_set_eq:NN \IfFontExistsTF \fontspec_font_if_exist:nTF

(End of definition for \fontspec_font_if_exist:nTF. This function is documented on page 36.)

\fontspec_if_current_feature:nTF #1 : feat tag


183 \prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F}
184 {
185 ⟨debug⟩\typeout{::~fontspec_if_current_feature:n~{#1}}
186 ⟨debug⟩\typeout{::::~primitive_font_current_name:~=~\@@_primitive_font_current_name:}
187 \exp_args:Nxx \tl_if_in:nnTF
188 { \@@_primitive_font_current_name: } { \tl_to_str:n {#1} }
189 { \prg_return_true: } { \prg_return_false: }
190 }

(End of definition for \fontspec_if_current_feature:nTF. This function is documented on page 37.)

42
\fontspec_if_small_caps:TF
191 \prg_new_conditional:Nnn \fontspec_if_small_caps: {TF,T,F}
192 {
193 \@@_if_merge_shape:nTF {sc}
194 {
195 \tl_set_eq:Nc \l_@@_smcp_shape_tl { \@@_shape_merge:nn {\f@shape} {sc} }
196 }
197 {
198 \tl_set:Nn \l_@@_smcp_shape_tl {sc}
199 }
200

201 \cs_if_exist:cTF { \f@encoding/\f@family/\f@series/\l_@@_smcp_shape_tl }


202 {
203 \tl_if_eq:ccTF
204 { \f@encoding/\f@family/\f@series/\l_@@_smcp_shape_tl }
205 { \f@encoding/\f@family/\f@series/\shapedefault }
206 { \prg_return_false: }
207 { \prg_return_true: }
208 }
209 { \prg_return_false: }
210 }

(End of definition for \fontspec_if_small_caps:TF. This function is documented on page 37.)

43
File X
fontspec-code-internal.dtx
1 Internals
1.1 The main function for setting fonts
\@@_select_font_family:nn This is the command that defines font families for use, the underlying procedure of all
\fontspec-like commands. Given a list of font features (#1) for a requested font (#2), it will
define an NFSS family for that font and put the family name (globally) into \l_fontspec_-
family_tl. The TEX ‘\font’ command is (globally) stored in \l_fontspec_font.
This macro does its processing inside a group to attempt to restrict the scope of its internal
processing. This works to some degree to insulate the internal commands from having to be
manually cleared.
Some often-used variables to know about:
• \l_fontspec_fontname_tl is used as the generic name of the font being defined.

• \l_@@_fontid_tl is the unique identifier of the font with all its features.

• \l_@@_fontname_up_tl is the font specifically to be used as the upright font.

• \l_@@_basename_tl is the (immutable) original argument used for *-replacing.

• \l_fontspec_font is the plain TEX font of the upright font requested.


1 \cs_new_protected:Nn \@@_select_font_family:nn
2 {
3 ⟨debug⟩\typeout{^^J^^J::::::::::::::::::::::::::::::^^J:: fontspec_select:nn~ {#1}~ {#2} }
4 \group_begin:
5 \@@_font_suppress_not_found_error:
6 \@@_init:
7

8 \@@_sanitise_fontname:Nn \l_fontspec_fontname_tl {#2}


9 \tl_set_eq:NN \l_@@_fontname_up_tl \l_fontspec_fontname_tl
10 \tl_set_eq:NN \l_@@_basename_tl \l_fontspec_fontname_tl
11

12 ⟨debug⟩\typeout{^^J::::::::::::::: l_fontspec_fontname_tl~ =~ \l_fontspec_fontname_tl }


13

14 \@@_if_detect_external:nT {#2}
15 { \keys_set:nn {fontspec-preparse-external} {Path} }
16

17 \keys_set_known:nn {fontspec-preparse-cfg} {#1}


18

19 \@@_init_ttc:n {#2}
20 \@@_load_external_fontoptions:N \l_fontspec_fontname_tl
21

22 \@@_extract_all_features:n {#1}
23 \tl_set:Nx \l_@@_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l_@@_all
24

25 ⟨debug⟩\typeout{fontid: \l_@@_fontid_tl}

44
26

27 \@@_preparse_features:
28

29 ⟨debug⟩\typeout{^^J::::::::::::::: l_fontspec_fontname_tl~ =~ \l_fontspec_fontname_tl }


30 ⟨debug⟩\typeout{::::::::::::::: _fontname_up_tl~ =~ \l_@@_fontname_up_tl }
31 ⟨debug⟩\typeout{::::::::::::::: l_@@_extension_tl~ =~ \l_@@_extension_tl }
32

33 \@@_load_font:
34 \@@_set_scriptlang:
35 \@@_get_features:n {}
36 \bool_set_false:N \l_@@_firsttime_bool
37

38 \@@_save_family_needed:nTF {#2}
39 {
40 \@@_save_family:nn {#1} {#2}
41 ⟨debug⟩\@@_warning:nxx {defining-font} {#1} {#2}
42 }
43 {
44 ⟨debug⟩\typeout{Font~ family~ already~ defined.}
45 }
46 \group_end:
47

48 \tl_set_eq:NN \l_fontspec_family_tl \g_@@_nfss_family_tl


49 ⟨debug⟩\typeout{::::::::::::::::::::::::::::::}
50 }

(End of definition for \@@_select_font_family:nn. This function is documented on page ??.)

\fontspec_select:nn This old name has been used by 3rd party packages so for compatibility:
51 \cs_set_eq:NN \fontspec_select:nn \@@_select_font_family:nn %% deprecated, for compatibility o

(End of definition for \fontspec_select:nn. This function is documented on page ??.)

\@@_sanitise_fontname:Nn Assigns font name #2 to token list variable #1 and strips extension(s) from it in the case of an
external font.
52 \cs_new:Nn \@@_sanitise_fontname:Nn
53 {
54 \tl_set:Nx #1 {#2}
55 \tl_trim_spaces:N #1
56 \@@_process_ext:N #1
57 }
58

59 \cs_new:Nn \@@_process_ext:N
60 {
61 \clist_map_inline:Nn \l_@@_extensions_clist
62 {
63 \tl_if_in:NnT #1 {##1}
64 {
65 ⟨debug⟩ \typeout{::@@_process_ext:N~ --~ Removing~ EXT:~ ##1}
66 \tl_remove_once:Nn #1 {##1}
67 \tl_set:Nn \l_@@_extension_tl {##1}
68 \@@_font_is_file:

45
69 \clist_map_break:
70 }
71 }
72 }

(End of definition for \@@_sanitise_fontname:Nn. This function is documented on page ??.)

\@@_if_detect_external:nT Check if either the fontname ends with a known font extension.
73 \prg_new_conditional:Nnn \@@_if_detect_external:n {T}
74 {
75 ⟨debug⟩ \typeout{:: @@_if_detect_external:n { \exp_not:n {#1} } }
76 \clist_map_inline:Nn \l_@@_extensions_clist
77 {
78 \bool_set_false:N \l_@@_tmpa_bool
79 \exp_args:Nx % <- this should be handled earlier
80 \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string}
81 { \bool_set_true:N \l_@@_tmpa_bool \clist_map_break: }
82 }
83 \bool_if:NTF \l_@@_tmpa_bool \prg_return_true: \prg_return_false:
84 }

(End of definition for \@@_if_detect_external:nT. This function is documented on page ??.)

\@@_init_ttc:n For TTC fonts we assume they will be loading the italic/bold fonts from the same file, so
prepopulate the fontnames to avoid needing to do it manually.
85 \cs_new:Nn \@@_init_ttc:n
86 {
87 \str_if_eq:eeT { \str_lowercase:f {\l_@@_extension_tl} } {.ttc}
88 {
89 \tl_set_eq:NN \l_@@_fontname_it_tl \l_fontspec_fontname_tl
90 \tl_set_eq:NN \l_@@_fontname_bf_tl \l_fontspec_fontname_tl
91 \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl
92 }
93 }

(End of definition for \@@_init_ttc:n. This function is documented on page ??.)

\@@_load_external_fontoptions:N Load a possible .fontspec font configuration file. This file could set font-specific options
for the font about to be loaded. The parameter should be a token list containing a sanitised
fontname. In the past this used a space-stripped version of the name, so we check for the file
both with and without spaces to load it.
94 \cs_new:Nn \@@_load_external_fontoptions:N
95 {
96 \bool_if:NT \l_@@_fontcfg_bool
97 {
98 ⟨debug⟩ \typeout{:: @@_load_external_fontoptions:N \exp_not:N #1 }
99 \tl_set:Nx \l_@@_ext_filename_tl {#1.fontspec}
100 \tl_remove_all:Nn \l_@@_ext_filename_tl {~}
101 \prop_if_in:NVF \g_@@_fontopts_prop #1
102 {
103 \exp_args:No \file_if_exist:nTF { \l_@@_ext_filename_tl }
104 {

46
105 \file_input:n { \l_@@_ext_filename_tl }
106 }
107 {
108 \tl_remove_all:Nn \l_@@_ext_filename_tl {~}
109 \exp_args:No \file_if_exist:nT { \l_@@_ext_filename_tl }
110 { \file_input:n { \l_@@_ext_filename_tl } }
111 }
112 }
113 }
114 }

(End of definition for \@@_load_external_fontoptions:N. This function is documented on page ??.)

\@@_extract_all_features:
115 \cs_new:Nn \@@_extract_all_features:n
116 {
117 ⟨debug⟩ \typeout{:: @@_extract_all_features:n { \unexpanded {#1} } }
118 \bool_if:NTF \l_@@_disable_defaults_bool
119 {
120 \clist_set:Nx \l_@@_all_features_clist {#1}
121 }
122 {
123 \prop_get:NVNF \g_@@_fontopts_prop \l_fontspec_fontname_tl \l_@@_fontopts_clist
124 { \clist_clear:N \l_@@_fontopts_clist }
125

126 \prop_get:NVNF \g_@@_fontopts_prop \l_@@_family_label_tl \l_@@_family_fontopts_clist


127 { \clist_clear:N \l_@@_family_fontopts_clist }
128 \tl_clear:N \l_@@_family_label_tl
129

130 \clist_set:Nx \l_@@_all_features_clist


131 {
132 \g_@@_default_fontopts_clist,
133 \l_@@_family_fontopts_clist,
134 \l_@@_fontopts_clist,
135 #1
136 }
137 }
138 }

(End of definition for \@@_extract_all_features:. This function is documented on page ??.)

\@@_preparse_features: #1 : feature options


#2 : font name
Perform the (multi-step) feature parsing process.
Convert the requested features to font definition strings. First the features are parsed for
information about font loading (whether it’s a named font or external font, etc.), and then
information is extracted for the names of the other shape fonts.
139 \cs_new:Nn \@@_preparse_features:
140 {
141 ⟨debug⟩ \typeout{:: @@_preparse_features:}

47
Detect if external fonts are to be used, possibly automatically, and parse fontspec features for
bold/italic fonts and their features.
142

143 \@@_keys_set_known:nxN {fontspec-preparse-external}


144 { \l_@@_all_features_clist }
145 \l_@@_keys_leftover_clist
146

When \l_fontspec_fontname_tl is augmented with a prefix or whatever to create the name


of the upright font (\l_@@_fontname_up_tl), this latter is the new ‘general font name’ to use.
147 \tl_set_eq:NN \l_fontspec_fontname_tl \l_@@_fontname_up_tl
148 \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_keys_leftover_clist}
149 \l_@@_keys_leftover_clist
150 \@@_keys_set_known:nxN {fontspec-preparse} {\l_@@_keys_leftover_clist}
151 \l_@@_fontfeat_clist
152 }

(End of definition for \@@_preparse_features:. This function is documented on page ??.)

\@@_load_font:
153 \cs_new:Nn \@@_load_font:
154 {
155 ⟨debug⟩\typeout{:: @@_load_font}
156

157 \@@_sanitise_fontname:Nn \l_@@_fontname_up_tl { \l_@@_fontname_up_tl }


158 ⟨debug⟩\typeout{Set~ base~ font~ for~ preliminary~ analysis:~ "\l_@@_fontname_up_tl"~ with~ fea
159 \@@_primitive_font_set:NnnF \l_@@_test_font
160 { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } { \l_@@_pre_feat_sclist } }
161 { \f@size pt - 2sp }
162 { \@@_error:nx {font-not-found} {\l_@@_fontname_up_tl} }
163

164 ⟨debug⟩\typeout{Set~ base~ font~ properly: \@@_construct_font_call:nn { \l_@@_fontname_up_tl }


165 \@@_set_font_type:N \l_@@_test_font
166 \@@_primitive_font_gset:Onn \l_@@_fontface_cs_tl
167 { \@@_construct_font_call:nn { \l_@@_fontname_up_tl } { \l_@@_pre_feat_sclist } }
168 { \f@size pt + 2sp }
169

170 \l_@@_fontface_cs_tl % this is necessary for LuaLaTeX to check the scripts properly
171

172 }

(End of definition for \@@_load_font:. This function is documented on page ??.)

\@@_construct_font_call:nn Constructs the complete font invocation. #1 : Base name


#2 : Extension
#3 : TTC Index
#4 : Renderer
#5 : Optical size
#6 : Font features
We check if ⟨Font features⟩ are empty and if so don’t add in the separator colon.
173 \cs_new:Nn \@@_construct_font_call:nnnnnn
174 {

48
175 ⟨XE⟩ " \@@_fontname_wrap:n { #1 #2 #3 }
176 ⟨LU⟩ " \@@_fontname_wrap:n { #1 #2 } #3
177 #4 #5
178 \str_if_eq:eeF {#6}{} {:#6} "
179 }
In practice, we don’t use the six-argument version, since most arguments are constructed on-
the-fly:
180 \cs_new:Nn \@@_construct_font_call:nn
181 {
182 \@@_construct_font_call:nnnnnn
183 {#1}
184 \l_@@_extension_tl
185 \l_@@_ttc_index_tl
186 \l_@@_renderer_tl
187 \l_@@_optical_size_tl
188 {#2}
189 }

(End of definition for \@@_construct_font_call:nn. This function is documented on page ??.)

\@@_font_is_file: The \@@_fontname_wrap:n command takes the font name and either passes it through un-
\@@_font_is_name: changed or wraps it in the syntax for loading a font ‘by filename’. For LuaTEX there are two
kinds kinds of filename based loading supported: Regular filename lookups which include
system fonts and lookups restricted to kpse.
190 \cs_new:Nn \@@_font_is_name:
191 {
192 ⟨XE⟩ \cs_set_eq:NN \@@_fontname_wrap:n \use:n
193 ⟨LU⟩ \cs_set:Npn \@@_fontname_wrap:n ##1 { name: ##1 }
194 }
195 \cs_new:Nn \@@_font_is_file:
196 {
197 ⟨debug⟩ \typeout{:: _font_is_file:}
198 \bool_set_true:N \l_@@_external_bool
199 \bool_lazy_and:nnTF { \l_@@_external_kpse_bool } { \tl_if_empty_p:N \l_@@_font_path_tl }
200 {
201 \cs_set:Npn \@@_fontname_wrap:n ##1 { kpse: ##1 }
202 }
203 {
204 \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] }
205 }
206 }

(End of definition for \@@_font_is_file: and \@@_font_is_name:. These functions are documented on page ??.)

\@@_set_scriptlang: Only necessary for OpenType fonts. First check if the font supports scripts, then apply defaults
if none are explicitly requested. Similarly with the language settings.
207 \cs_new:Nn \@@_set_scriptlang:
208 {
209 ⟨debug⟩ \typeout{:: _set_scriptlang:}
210 \bool_if:NT \l_@@_firsttime_bool
211 {

49
212 \tl_if_empty:NF \l_@@_script_name_tl
213 {
214 ⟨debug⟩ \typeout{:::: Script=\l_@@_script_name_tl, Language=\l_@@_lang_name_tl}
215 \keys_set:ne {fontspec-opentype} {Script=\l_@@_script_name_tl}
216 \keys_set:ne {fontspec-opentype} {Language=\l_@@_lang_name_tl}
217 }
218 }
219 }

(End of definition for \@@_set_scriptlang:. This function is documented on page ??.)

\@@_get_features:Nn This macro is a wrapper for \keys_set:nn 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. Its argument is any additional features to prepend to the default.
Do not set the colour if not explicitly spec’d else \color (using specials) will not work.
220 \cs_new:Nn \@@_get_features:n
221 {
222 ⟨debug⟩ \typeout{:: @@_get_features:Nn { \exp_not:n {#1} } }
223 \@@_init_fontface:
224 \@@_keys_set_known:nxN {fontspec-renderer} {\l_@@_fontfeat_clist,#1}
225 \l_@@_keys_leftover_clist
226 \@@_keys_set_known:nxN {fontspec} {\l_@@_keys_leftover_clist} \l_@@_keys_leftover_clist
227 ⟨∗XE⟩
228 \bool_if:NTF \l_@@_ot_bool
229 {
230 ⟨debug⟩ \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"
231 \keys_set_known:nV {fontspec-opentype} \l_@@_keys_leftover_clist
232 }
233 {
234 ⟨debug⟩ \typeout{::: Setting~ keys~ for~ AAT/Graphite~ font~ features:~"\l_@@_keys_leftover_cl
235 \bool_if:nT { \l_@@_atsui_bool || \l_@@_graphite_bool }
236 { \keys_set_known:nV {fontspec-aat} \l_@@_keys_leftover_clist }
237 }
238 ⟨/XE⟩
239 ⟨∗LU⟩
240 ⟨debug⟩ \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"
241 \keys_set_known:nV {fontspec-opentype} \l_@@_keys_leftover_clist
242 ⟨/LU⟩
243

244 \tl_if_empty:NF \l_@@_mapping_tl


245 { \@@_update_featstr:n { mapping = \l_@@_mapping_tl } }
246

247 \str_if_eq:eeF { \l_@@_hexcol_tl \l_@@_opacity_tl }


248 { \c_@@_hexcol_tl \c_@@_opacity_tl }
249 ⟨XE⟩ { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } }
250 ⟨LU⟩ { \@@_update_featstr:n { color = {\l_@@_hexcol_tl\l_@@_opacity_tl} } }
251 }

(End of definition for \@@_get_features:Nn. This function is documented on page ??.)

\@@_save_family_needed:nTF Check if the family is unique and, if so, save its information. (\addfontfeature and other
macros use this data.) Then the font family and its shapes are defined in the NFSS.

50
Now we have a unique (in fact, too unique!) string that contains the family name and
every option in abbreviated form. This is used with a counter to create a simple NFSS family
name for the font we’re selecting.
252 \prg_new_conditional:Nnn \@@_save_family_needed:n { TF }
253 {
254

255 ⟨debug⟩ \typeout{save~ family:~ #1}


256 ⟨debug⟩ \typeout{== fontid_tl: "\l_@@_fontid_tl".}
257

258 \tl_if_empty:NTF \l_@@_nfss_fam_tl


259 {
260 \prop_get:NVNTF \g_@@_fontid_family_prop \l_@@_fontid_tl \l_@@_tmp_tl
261 {
262 \tl_gset_eq:NN \g_@@_nfss_family_tl \l_@@_tmp_tl
263 \prg_return_false:
264 }
265 {
266 \tl_set:Nx \l_@@_tmp_tl {#1}
267 \tl_remove_all:Nn \l_@@_tmp_tl { ~ }
268 \@@_save_fontid_family:VV \l_@@_fontid_tl \l_@@_tmp_tl
269 \prg_return_true:
270 }
271 }
272 {
273 \tl_gset_eq:NN \g_@@_nfss_family_tl \l_@@_nfss_fam_tl
274 \cs_undefine:c { g_@@_fontinfo_ \g_@@_nfss_family_tl _prop }
275 \prg_return_true:
276 }
277 }
278 \cs_new:Nn \@@_save_fontid_family:nn
279 {
280 \prop_get:NnNTF \g_@@_family_int_prop {#2} \l_@@_tmp_tl
281 {
282 \tl_set:Nx \l_@@_tmp_tl
283 { \int_eval:n { \l_@@_tmp_tl + 1 } }
284 }
285 { \tl_set:Nn \l_@@_tmp_tl { 0 } }
286 \prop_gput:NnV \g_@@_family_int_prop {#2} \l_@@_tmp_tl
287 \tl_gset:Nx \g_@@_nfss_family_tl { #2 ( \l_@@_tmp_tl ) }
288 \prop_gput:NnV \g_@@_fontid_family_prop {#1} \g_@@_nfss_family_tl
289 }
290 \cs_generate_variant:Nn \@@_save_fontid_family:nn { VV }

(End of definition for \@@_save_family_needed:nTF. This function is documented on page ??.)

\@@_save_family:nn Saves the relevant font information for future processing.


291 \cs_new:Nn \@@_save_family:nn
292 {
293 \@@_save_fontinfo:n {#2}
294 \@@_find_autofonts:
295 \DeclareFontFamily{\g_@@_nfss_enc_tl}{\g_@@_nfss_family_tl}{}

51
296 \@@_set_faces:
297 \@@_info:nxx {defining-font} {#1} {#2}
298 }

(End of definition for \@@_save_family:nn. This function is documented on page ??.)

\@@_save_fontinfo:n Saves the relevant font information for future processing.


299 \cs_new:Nn \@@_save_fontinfo:n
300 {
301 \prop_new:c {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop}
302 \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontname} { #1 }
303 \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {options} { \l_@@_all_features
304 \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontdef}
305 {
306 \@@_construct_font_call:nn {\l_fontspec_fontname_tl}
307 { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist \@@_get_variations: }
308 }
309 \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-num} \l_@@_script_int
310 \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-num} \l_@@_language_int
311 \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-tag} \l_@@_script_tl
312 \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-tag} \l_@@_lang_tl
313 }

(End of definition for \@@_save_fontinfo:n. This function is documented on page ??.)

1.2 Setting font shapes in a family


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 combination shapes are searched first because they use information that may be
redefined in the single cases. E.g., if no bold font is specified then set_autofont will attempt
to set it. This has subtle/small ramifications on the logic of choosing the bold italic font.

\@@_find_autofonts:
314 \cs_new:Nn \@@_find_autofonts:
315 {
316 \bool_if:nF {\l_@@_noit_bool || \l_@@_nobf_bool}
317 {
318 \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_@@_fontname_it_tl} {/B}
319 \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_@@_fontname_bf_tl} {/I}
320 \@@_set_autofont:Nnn \l_@@_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI}
321 }
322

323 \bool_if:NF \l_@@_nobf_bool


324 {
325 \@@_set_autofont:Nnn \l_@@_fontname_bf_tl {\l_fontspec_fontname_tl} {/B}
326 }
327

328 \bool_if:NF \l_@@_noit_bool


329 {

52
330 \@@_set_autofont:Nnn \l_@@_fontname_it_tl {\l_fontspec_fontname_tl} {/I}
331 }
332

333 \@@_set_autofont:Nnn \l_@@_fontname_bfsl_tl {\l_@@_fontname_sl_tl} {/B}


334 }

(End of definition for \@@_find_autofonts:. This function is documented on page ??.)

\@@_set_faces:
335 \cs_new:Nn \@@_set_faces:
336 {
337 \@@_add_nfssfont:nnnn \mddefault \shapedefault \l_fontspec_fontname_tl \l_@@_fontfeat_up_c
338 \@@_add_nfssfont:nnnn \bfdefault \shapedefault \l_@@_fontname_bf_tl \l_@@_fontfeat_bf_c
339 \@@_add_nfssfont:nnnn \mddefault \itdefault \l_@@_fontname_it_tl \l_@@_fontfeat_it_c
340 \@@_add_nfssfont:nnnn \mddefault \sldefault \l_@@_fontname_sl_tl \l_@@_fontfeat_sl_c
341 \@@_add_nfssfont:nnnn \mddefault \swdefault \l_@@_fontname_sw_tl \l_@@_fontfeat_sw_c
342 \@@_add_nfssfont:nnnn \bfdefault \itdefault \l_@@_fontname_bfit_tl \l_@@_fontfeat_bfit
343 \@@_add_nfssfont:nnnn \bfdefault \sldefault \l_@@_fontname_bfsl_tl \l_@@_fontfeat_bfsl
344 \@@_add_nfssfont:nnnn \bfdefault \swdefault \l_@@_fontname_bfsw_tl \l_@@_fontfeat_bfsw
345 \prop_map_inline:Nn \l_@@_nfssfont_prop { \@@_set_faces_aux:nnnnn ##2 }
346 }
347 \cs_new:Nn \@@_set_faces_aux:nnnnn
348 {
349 ⟨debug⟩ \typeout{:: @@_set_faces_aux:nnnnn \exp_not:n { {#1} {#2} {#3} {#4} {#5} } }
350 \fontspec_complete_fontname:Nn \l_@@_curr_fontname_tl {#3}
351 \@@_make_font_shapes:Nnnnn \l_@@_curr_fontname_tl {#1} {#2} {#4} {#5}
352 }

(End of definition for \@@_set_faces:. This function is documented on page ??.)

\fontspec_complete_fontname:Nn This macro defines #1 as the input with any * tokens of its input replaced by the font name.
This lets us define supplementary fonts in full (“Baskerville Semibold”) or in abbreviation
(“* Semibold”).
353 \cs_new:Nn \fontspec_complete_fontname:Nn
354 {
355 \tl_set:Nx #1 {#2}
356 \tl_if_in:NnF \l_fontspec_fontname_tl {*}
357 {
358 \tl_replace_all:Nne #1 {*} {\l_@@_basename_tl}
359 }
360 }

(End of definition for \fontspec_complete_fontname:Nn. This function is documented on page ??.)

\@@_add_nfssfont:nnnn #1 : series
#2 : shape
#3 : fontname
#4 : fontspec features
361 \cs_new:Nn \@@_add_nfssfont:nnnn
362 {
363 \tl_set:Nx \l_@@_this_font_tl {#3}

53
364

365 \tl_if_empty:eTF {#4}


366 { \clist_set:Nn \l_@@_sizefeat_clist {Size={-}} }
367 { \@@_keys_set_known:nxN {fontspec-preparse-nested} {#4} \l_@@_tmp_tl }
368

369 \tl_if_empty:NF \l_@@_this_font_tl


370 {
371 \prop_put:Nee \l_@@_nfssfont_prop {#1/#2}
372 { {#1}{#2}{\l_@@_this_font_tl}{#4}{\l_@@_sizefeat_clist} }
373 }
374 }

(End of definition for \@@_add_nfssfont:nnnn. This function is documented on page ??.)

1.2.1 Fonts
\@@_set_font_type:N Now check if the font is to be rendered with ATSUI or Harfbuzz. This will either be automatic
(based on the font type), or specified by the user via a font feature.
This macro sets booleans accordingly depending if the font in \l_fontspec_test_font is
an AAT font or an OpenType font or a font with feature axes (either AAT or Multiple Master),
respectively.
375 \cs_new:Nn \@@_set_font_type:N
376 {
377 ⟨debug⟩ \typeout{:: @@_set_font_type:}
378 ⟨∗XE⟩
379 \bool_set_false:N \l_@@_tfm_bool
380 \bool_set_false:N \l_@@_atsui_bool
381 \bool_set_false:N \l_@@_ot_bool
382 \bool_set_false:N \l_@@_mm_bool
383 \bool_set_false:N \l_@@_graphite_bool
384 \ifcase\XeTeXfonttype #1
385 ⟨debug⟩ \typeout{:::: TFM}
386 \bool_set_true:N \l_@@_tfm_bool
387 \or
388 ⟨debug⟩ \typeout{:::: AAT}
389 \bool_set_true:N \l_@@_atsui_bool
390 \tl_if_empty:NT \l_@@_renderer_tl { \tl_set:Nn \l_@@_renderer_tl {/AAT} }
391 \ifnum\XeTeXcountvariations #1 > 0\relax
392 ⟨debug⟩ \typeout{:::: MM}
393 \bool_set_true:N \l_@@_mm_bool
394 \fi
395 \or
396 ⟨debug⟩ \typeout{:::: OpenType}
397 \bool_set_true:N \l_@@_ot_bool
398 \tl_if_empty:NT \l_@@_renderer_tl { \tl_set:Nn \l_@@_renderer_tl {/OT} }
399 \or
400 ⟨debug⟩ \typeout{:::: Graphite}
401 \bool_set_true:N \l_@@_graphite_bool
402 \tl_if_empty:NT \l_@@_renderer_tl { \tl_set:Nn \l_@@_renderer_tl {/GR} }
403 \fi
404 ⟨/XE⟩

54
If automatic, the \l_@@_renderer_tl token list will still be empty (other suffices that could
be added will be later in the feature processing), and if it is indeed still empty, assign it a value
so that the other weights of the font are specifically loaded with the same renderer.
LuaTeX only supports one:
405 ⟨∗LU⟩
406 \bool_set_true:N \l_@@_ot_bool
407 ⟨/LU⟩
408 }

(End of definition for \@@_set_font_type:N. This function is documented on page ??.)

\@@_set_autofont:Nnn #1 : Font name tl


#2 : Base font name
#3 : Font name modifier
This function looks for font with ⟨name⟩ and ⟨modifier⟩ #2#3, and if found (i.e., different
to font with name #2) stores it in tl #1. A modifier is something like /B to look for a bold font,
for example.
We can’t match external fonts in this way (in XETEX anyway; todo: test with LuaTeX). If
⟨font name tl⟩ is not empty, then it’s already been specified by the user so abort. If ⟨Base
font name⟩ is not given, we also abort for obvious reasons.
If ⟨font name tl⟩ is empty, then proceed. If not found, ⟨font name tl⟩ remains empty.
Otherwise, we have a match.
409 \cs_new:Nn \@@_set_autofont:Nnn
410 {
411 \bool_if:NF \l_@@_external_bool
412 {
413 \tl_if_empty:eF {#2}
414 {
415 \tl_if_empty:NT #1
416 {
417 \@@_if_autofont:nnTF {#2} {#3}
418 { \tl_set:Nx #1 {#2#3} }
419 { \@@_info:nx {no-font-shape} {#2#3} }
420 }
421 }
422 }
423 }
424 \prg_new_conditional:Nnn \@@_if_autofont:nn {T,TF}
425 {
426 \group_begin:
427 \@@_primitive_font_set:Nnn \l_@@_tmpa_font { \@@_construct_font_call:nn {#1} { \l_@@_pre
428 \@@_primitive_font_set:Nnn \l_@@_tmpb_font { \@@_construct_font_call:nn {#1#2} { \l_@@_pre
429 \cs_if_eq:NNTF \l_@@_tmpa_font \l_@@_tmpb_font
430 { \group_end: \prg_return_false: }
431 { \group_end: \prg_return_true: }
432 }

(End of definition for \@@_set_autofont:Nnn. This function is documented on page ??.)

55
\@@_make_font_shapes:Nnnnn #1 : Font name
#2 : Font series
#3 : Font shape
#4 : Font features
#5 : Size features
This macro eventually uses \DeclareFontShape to define the font shape in question.
433 \cs_new:Nn \@@_make_font_shapes:Nnnnn
434 {
435 \group_begin:
436 \@@_keys_set_known:nxN {fontspec-preparse-external} { #4 } \l_@@_leftover_clist
437 \@@_load_fontname:Nn \l_fontspec_fontname_tl {#1}
438 \@@_declare_shape:nnxx {#2} {#3} { \l_@@_fontopts_clist, \l_@@_leftover_clist } {#5}
439 \group_end:
440 }
441 \cs_new:Nn \@@_load_fontname:Nn
442 {
443 ⟨debug⟩ \typeout{:: @@_load_fontname:Nn \exp_not:N #1 (#1) {#2} }
444 \@@_sanitise_fontname:Nn #1 {#2}
445 \@@_load_external_fontoptions:N #1
446 \prop_get:NVNF \g_@@_fontopts_prop #1 \l_@@_fontopts_clist
447 { \clist_clear:N \l_@@_fontopts_clist }
448 \keys_set_groups:nnV {fontspec/fontname} {getfontname} \l_@@_fontopts_clist
449 \@@_primitive_font_set:OnnF \l_@@_fontface_cs_tl
450 { \@@_construct_font_call:nn {#1} { \l_@@_pre_feat_sclist } } { \f@size pt + 2sp }
451 { \@@_error:nx {font-not-found} {#2} }
452 }
453 \keys_define:nn {fontspec/fontname}
454 {
455 Font .tl_set:N = \l_fontspec_fontname_tl ,
456 Font .groups:n = {getfontname} ,
457 }

(End of definition for \@@_make_font_shapes:Nnnnn. This function is documented on page ??.)

\@@_declare_shape:nnnn #1 : Font series


#2 : Font shape
#3 : Font features
#4 : Size features
Wrapper for \DeclareFontShape. And finally the actual font shape declaration using
\l_@@_nfss_tl defined above. \l_@@_postadjust_tl is defined in various places to deal
with things like the hyphenation character and interword spacing.
The main part is to loop through SizeFeatures arguments, which are of the form
SizeFeatures={{<one>},{<two>},{<three>}}.
458 \cs_new:Nn \@@_declare_shape:nnnn
459 {
460 ⟨debug⟩\typeout{=~ declare_shape:~{\l_fontspec_fontname_tl}~{#1}~{#2}}
461 \tl_build_begin:N \l_@@_nfss_tl
462 \tl_build_begin:N \l_@@_nfss_sc_tl
463 \tl_set_eq:NN \l_@@_saved_fontname_tl \l_fontspec_fontname_tl

56
464

465 \exp_args:Nx \clist_map_inline:nn {#4} { \@@_setup_single_size:nn {#3} {##1} }


466

467 \tl_build_end:N \l_@@_nfss_tl


468 \tl_build_end:N \l_@@_nfss_sc_tl
469

470 \@@_declare_shapes_normal:nn {#1} {#2}


471 \@@_declare_shapes_smcaps:nn {#1} {#2}
472 \@@_declare_shape_slanted:nn {#1} {#2}
473 \@@_declare_shapes_bx:nn {#1} {#2}
474 \@@_declare_shape_loginfo:nn {#1} {#2}
475 }
476 \cs_generate_variant:Nn \@@_declare_shape:nnnn {nnxx}

(End of definition for \@@_declare_shape:nnnn. This function is documented on page ??.)

\@@_setup_single_size:nn
477 \cs_new:Nn \@@_setup_single_size:nn
478 {
479 \tl_clear:N \l_@@_size_tl
480 \tl_set_eq:NN \l_@@_sizedfont_tl \l_@@_saved_fontname_tl % in case not spec'ed
481

482 \keys_set_known:neN {fontspec-sizing} { \exp_after:wN \use:n #2 }


483 \l_@@_sizing_leftover_clist
484 \tl_if_empty:NT \l_@@_size_tl { \@@_error:n {no-size-info} }
485 ⟨debug⟩\typeout{==~ size:~\l_@@_size_tl}
486

487 % "normal"
488 \@@_load_fontname:Nn \l_fontspec_fontname_tl {\l_@@_sizedfont_tl}
489 \@@_setup_nfss:Nn \l_@@_nfss_tl { #1 , \l_@@_sizing_leftover_clist }
490 ⟨debug⟩ \typeout{===~ sized~ font:~ \l_@@_sizedfont_tl}
491

492 % small caps


493 \clist_set_eq:NN \l_@@_fontfeat_curr_clist \l_@@_fontfeat_sc_clist
494

495 \bool_if:NF \l_@@_nosc_bool


496 {
497 \tl_if_empty:NTF \l_@@_fontname_sc_tl
498 {
499 \@@_make_smallcaps:TF
500 {
501 ⟨debug⟩\typeout{====~Small~ caps~ found.}
502 \clist_put_left:Nn \l_@@_fontfeat_curr_clist {Letters=SmallCaps}
503 }
504 {
505 ⟨debug⟩\typeout{====~Small~ caps~ not~ found.}
506 \bool_set_true:N \l_@@_nosc_bool
507 }
508 }
509 { \@@_load_fontname:Nn \l_fontspec_fontname_tl {\l_@@_fontname_sc_tl} }% local for e
510 }

57
511

512 \bool_if:NF \l_@@_nosc_bool


513 {
514 \@@_setup_nfss:Nn \l_@@_nfss_sc_tl
515 {#1 , \l_@@_sizing_leftover_clist , \l_@@_fontfeat_curr_clist}
516 }
517 }

(End of definition for \@@_setup_single_size:nn. This function is documented on page ??.)

\@@_setup_nfss:Nn
518 \cs_new:Nn \@@_setup_nfss:Nn
519 {
520 ⟨debug⟩\typeout{====~Setup~NFSS~shape:~<\l_@@_size_tl>~\l_fontspec_fontname_tl}
521 ⟨debug⟩\typeout{====~Requested~features:~#2}
522

523 \@@_get_features:n { #2 }
524

525 ⟨debug⟩\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist \@@_get_variations:}


526

527 \tl_if_empty:NF \l_@@_scale_tl


528 {
529 \tl_set:Nx \l_@@_scale_tl { s*[\l_@@_scale_tl] }
530 }
531

532 \tl_build_put_right:Nx #1
533 {
534 <\l_@@_size_tl> \l_@@_scale_tl
535 \@@_construct_font_call:nn { \l_fontspec_fontname_tl }
536 { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist \@@_get_variations: }
537 }
538 }

(End of definition for \@@_setup_nfss:Nn. This function is documented on page ??.)

\@@_declare_shapes_normal:nn
539 \cs_new:Nn \@@_declare_shapes_normal:nn
540 {
541 \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl}
542 {#1} {#2} {\l_@@_nfss_tl}{\l_@@_postadjust_tl}
543 }

(End of definition for \@@_declare_shapes_normal:nn. This function is documented on page ??.)

\@@_declare_shapes_smcaps:nn
544 \cs_new:Nn \@@_declare_shapes_smcaps:nn
545 {
546 \tl_if_empty:NF \l_@@_nfss_sc_tl
547 {
548 \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl} {#1}
549 { \@@_combo_sc_shape:n {#2} } {\l_@@_nfss_sc_tl} {\l_@@_postadjust_tl}
550 }
551 }

58
552 \cs_new:Nn \@@_combo_sc_shape:n
553 {
554 \tl_if_exist:cTF { \@@_shape_merge:nn {#1} {\scdefault} }
555 { \tl_use:c { \@@_shape_merge:nn {#1} {\scdefault} } }
556 { \scdefault#1 }
557 }

(End of definition for \@@_declare_shapes_smcaps:nn. This function is documented on page ??.)

\@@_DeclareFontShape:nnnnnn
558 \cs_new:Nn \@@_DeclareFontShape:nnnnnn
559 {
560 ⟨debug⟩\typeout{DeclareFontShape:~{#1}{#2}{#3}{#4}...}
561 \group_begin:
562 \normalsize
563 \cs_undefine:c {#1/#2/#3/#4/\f@size}
564 \group_end:
565 \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6}
566 }
567 \cs_generate_variant:Nn \@@_DeclareFontShape:nnnnnn {xxxxxx}

This extra stuff for the slanted shape substitution is a little bit awkward. We define the slanted
\@@_declare_shape_slanted:nn shape to be a synonym for it when (a) we’re defining an italic font, but also (b) when the
default slanted shape isn’t ‘it’. (Presumably this turned up once in a test and I realised it caused
problems. I doubt this would happen much.)
We should test when a slanted font has been specified and not run this code if so, but the
\@@_set_slanted: code will overwrite this anyway if necessary.
568 \cs_new:Nn \@@_declare_shape_slanted:nn
569 {
570 \bool_if:nT
571 {
572 \str_if_eq_p:ee {#2} {\itdefault} &&
573 !(\str_if_eq_p:ee {\itdefault} {\sldefault})
574 }
575 {
576 \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl}{\g_@@_nfss_family_tl}{#1}{\sldefault}
577 {<->ssub*\g_@@_nfss_family_tl/#1/\itdefault}{\l_@@_postadjust_tl}
578 }
579 }

Similar processing for setting up b/bx substitutions.


\@@_declare_shapes_bx:nn 580 \cs_new:Nn \@@_declare_shapes_bx:nn
581 {
582 \bool_if:nT
583 {
584 \str_if_eq_p:ee {#1} {\bfdefault} &&
585 !(\str_if_eq_p:ee {\bfdefault} {bx})
586 }
587 {
588 % bx/?
589 \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl}

59
590 {bx} {#2}
591 { <->ssub*\g_@@_nfss_family_tl/\bfdefault/#2 }
592 { \l_@@_postadjust_tl }
593

594 % bx/sc -> b/sc


595 \tl_if_empty:NF \l_@@_nfss_sc_tl
596 {
597 \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl}
598 {bx} { \@@_combo_sc_shape:n {#2} }
599 { <->ssub*\g_@@_nfss_family_tl/\bfdefault/#2 }
600 { \l_@@_postadjust_tl }
601 }
602

603 % bx/sl -> bx/it


604 \bool_if:nT
605 {
606 \str_if_eq_p:ee {#2} {\itdefault} &&
607 !(\str_if_eq_p:ee {\itdefault} {\sldefault})
608 }
609 {
610 \@@_DeclareFontShape:xxxxxx {\g_@@_nfss_enc_tl} {\g_@@_nfss_family_tl}
611 {bx} {\sldefault}
612 { <->ssub*\g_@@_nfss_family_tl/bx/\itdefault }
613 { \l_@@_postadjust_tl }
614 }
615

616 }
617 }

Lastly some informative messaging.


\@@_declare_shape_loginfo:nn 618 \cs_new:Nn \@@_declare_shape_loginfo:nn
619 {
620 \tl_gput_right:Nx \g_@@_defined_shapes_tl
621 {
622 \exp_not:n { \\ }
623 -~ \exp_not:N \str_case:nn {#1/#2}
624 {
625 {\mddefault/\shapedefault} {'normal'~}
626 {\bfdefault/\shapedefault} {'bold'~}
627 {\mddefault/\itdefault} {'italic'~}
628 {\mddefault/\sldefault} {'slanted'~}
629 {\mddefault/\swdefault} {'swash'~}
630 {\bfdefault/\itdefault} {'bold~ italic'~}
631 {\bfdefault/\sldefault} {'bold~ slanted'~}
632 {\bfdefault/\swdefault} {'bold~ swash'~}
633 } (#1/#2)~
634 with~ NFSS~ spec.:~
635 \l_@@_nfss_tl
636 \tl_if_empty:NF \l_@@_nfss_sc_tl
637 {
638 \exp_not:n { \\ }
639 -~ \exp_not:N \str_case:nn { #1 / \@@_combo_sc_shape:n {#2} }

60
640 {
641 {\mddefault/\scdefault} {'small~ caps'~}
642 {\bfdefault/\scdefault} {'bold~ small~ caps'~}
643 {\mddefault/\scitdefault} {'italic~ small~ caps'~}
644 {\bfdefault/\scitdefault} {'bold~ italic~ small~ caps'~}
645 {\mddefault/\scsldefault} {'slanted~ small~ caps'~}
646 {\bfdefault/\scsldefault} {'bold~ slanted~ small~ caps'~}
647 }~( #1 / \@@_combo_sc_shape:n {#2} )~
648 with~ NFSS~ spec.:~
649 \l_@@_nfss_sc_tl
650 \tl_if_empty:fF {\l_@@_postadjust_tl}
651 {
652 \exp_not:N \\ and~ font~ adjustment~ code:
653 \exp_not:N \\ \l_@@_postadjust_tl
654 }
655 }
656 }
657 }
Maybe \str_if_eq:eeF would be better?

1.2.2 Features
These are the features always applied to a font selection before other features.
\l_@@_pre_feat_sclist 658 \tl_set:Nn \l_@@_pre_feat_sclist
659 ⟨∗XE⟩
660 {
661 \bool_if:NT \l_@@_ot_bool
662 {
663 \tl_if_empty:NF \l_@@_script_tl { script = \l_@@_script_tl ; }
664 \tl_if_empty:NF \l_@@_lang_tl { language = \l_@@_lang_tl ; }
665 }
666 }
667 ⟨/XE⟩
668 ⟨∗LU⟩
669 {
670 mode = \l_@@_mode_tl ;
671 \tl_if_empty:NF \l_@@_shaper_tl { shaper = \l_@@_shaper_tl ; }
672 \tl_if_empty:NF \l_@@_script_tl { script = \l_@@_script_tl ; }
673 \tl_if_empty:NF \l_@@_lang_tl { language = \l_@@_lang_tl ; }
674 }
675 ⟨/LU⟩

This macro checks if the font contains small caps.


\@@_make_smallcaps:TF 676 \cs_new:Nn \@@_make_ot_smallcaps:TF
\@@_make_ot_smallcaps:TF 677 {
678 \bool_set_false:N \l_@@_tmpa_bool
679 \exp_args:Ne \clist_map_inline:nn { \l_@@_lang_tl , \g_@@_default_langs_clist }
680 {
681 \exp_args:Ne \clist_map_inline:nn { \l_@@_script_tl , \g_@@_default_scripts_clist }
682 {
683 \exp_args:No \@@_check_ot_feat:NnnnT \l_@@_fontface_cs_tl {smcp} {##1} {####1}

61
684 {
685 ⟨debug⟩\typeout{SMCP~found~for~script/lang: ####1/##1~-~assuming~okay}
686 \bool_set_true:N \l_@@_tmpa_bool
687 \clist_map_break:
688 }
689 }
690 }
691 \bool_if:NTF \l_@@_tmpa_bool {#1} {#2}
692 }
693 \cs_new:Nn \@@_make_smallcaps:TF
694 {
695 \bool_if:NTF \l_@@_ot_bool
696 { \@@_make_ot_smallcaps:TF {#1} {#2} }
697 {
698 \bool_if:NT \l_@@_atsui_bool
699 {
700 \exp_args:No \@@_make_AAT_feature_string:NnnTF
701 \l_@@_fontface_cs_tl {3} {3} {#1} {#2}
702 }
703 }
704 }

\g_@@_rawfeatures_sclist is the string used to define the list of specific font features. Each
\@@_update_featstr:n time another font feature is requested, this macro is used to add that feature to the list. Font
features are separated by semicolons.
705 \cs_new:Nn \@@_update_featstr:n
706 {
707 ⟨debug⟩ \typeout{:::: @@_update_featstr:n {#1}}
708 \bool_if:NF \l_@@_firsttime_bool
709 {
710 \tl_gset:Nx \g_@@_single_feat_tl { #1 }
711 ⟨debug⟩ \typeout{::::~ Adding~ feature.}
712 \tl_gput_right:Nx \g_@@_rawfeatures_sclist {#1;}
713 }
714 }

\@@_remove_clashing_featstr:n 715 \cs_new:Nn \@@_remove_clashing_featstr:n


716 {
717 ⟨debug⟩ \typeout{:::: @@_remove_clashing_featstr:n {#1}}
718 \clist_map_inline:nn {#1}
719 {
720 ⟨debug⟩ \typeout{::::~ Removing~ feature~ "##1;"}
721 \tl_gremove_all:Nn \g_@@_rawfeatures_sclist {##1;}
722 }
723 }
724 \cs_generate_variant:Nn \@@_remove_clashing_featstr:n {x}

\@@_get_variations: builds the feature string representing the current variation instance
\@@_get_variations: and/or axis settings.
725 \cs_generate_variant:Nn \tl_tail:n { e }

62
726 \cs_new:Nn \@@_format_axis:nn
727 {
728 , #1 = #2
729 }
730 \cs_new:Nn \@@_get_variations:
731 {
732 \tl_if_empty:NF \g_@@_instance_tl
733 {
734 instance = { \g_@@_instance_tl };
735 }
736 \prop_if_empty:NF \g_@@_rawvariations_prop
737 {
738 axis = {
739 \tl_tail:e {
740 \prop_map_function:NN \g_@@_rawvariations_prop \@@_format_axis:nn
741 }
742 };
743 }
744 }

1.3 Initialisation
Initialisations that need to occur once per fontspec font invocation. (Some of these may be
\@@_init: redundant. Check whether they’re assigned to globally or not.)
745 \cs_set:Npn \@@_init:
746 {
747 ⟨debug⟩ \typeout{:: @@_init:}
748 \bool_set_false:N \l_@@_ot_bool
749 \bool_set_true:N \l_@@_firsttime_bool
750 \@@_font_is_name:
751 \tl_clear:N \l_@@_font_path_tl
752 \tl_clear:N \l_@@_optical_size_tl
753 \tl_clear:N \l_@@_ttc_index_tl
754 \tl_clear:N \l_@@_renderer_tl
755 \tl_gclear:N \g_@@_defined_shapes_tl
756 \tl_gclear:N \g_@@_curr_series_tl
757 \tl_gset_eq:NN \g_@@_nfss_enc_tl \g_fontspec_encoding_tl
758 ⟨∗LU⟩
759 \tl_set:Nn \l_@@_mode_tl {node}
760 ⟨/LU⟩
761 }

Executed in \@@_get_features:Nn.
\@@_init_fontface: 762 \cs_new:Nn \@@_init_fontface:
763 {
764 \tl_gclear:N \g_@@_rawfeatures_sclist
765 \prop_gclear:N \g_@@_rawvariations_prop
766 \tl_gclear:N \g_@@_instance_tl
767 \tl_clear:N \l_@@_scale_tl
768 \tl_set_eq:NN \l_@@_opacity_tl \c_@@_opacity_tl
769 \tl_set_eq:NN \l_@@_hexcol_tl \c_@@_hexcol_tl

63
770 \tl_set_eq:NN \l_@@_postadjust_tl \c_@@_postadjust_tl
771 \tl_clear:N \l_@@_wordspace_adjust_tl
772 \tl_clear:N \l_@@_punctspace_adjust_tl
773 }

1.4 Miscellaneous
This macro takes an OpenType tag and validates it.
\@@_ot_validate_tag:n 774 ⟨∗LU⟩
775 \cs_new_protected:Nn \@@_ot_validate_tag:n
776 {
777 \@@_ot_validate_tag:w #1 \q_nil
778 }
779 \cs_generate_variant:Nn \@@_ot_validate_tag:n {x}
780 \cs_set:Npn \@@_ot_validate_tag:w #1 #2 \q_nil
781 {
782 \bool_if:nTF { \str_if_eq_p:nn {#1} {+} || \str_if_eq_p:nn {#1} {-} }
783 { \@@_ot_validate_tag_aux:w #2 \c_empty_tl \c_empty_tl \q_nil }
784 { \@@_ot_validate_tag_aux:w #1#2 \c_empty_tl \c_empty_tl \q_nil }
785 }
786 \cs_set:Npn \@@_ot_validate_tag_aux:w #1#2#3#4#5 \q_nil
787 {
788 \int_compare:nT { \tl_count:n {#5} > 2 }
789 { \@@_error:nx {ot-tag-too-long} {#1#2#3#4#5} }
790 }
791 ⟨/LU⟩

This macro takes a four character string and converts it to the numerical representation re-
\@@_iv_str_to_num:Nn quired for XETEX OpenType script/language/feature purposes. The output is stored in #1.
This code is not used in LuaTEX, as the checking for that engine is done via Lua code
provided by luaotfload.
792 ⟨∗XE⟩
793 \cs_new:Nn \@@_iv_str_to_num:Nn
794 {
795 ⟨debug⟩\typeout{_iv_str_to_num:~#1~/~#2}
796 \@@_strip_leading_sign:Nw #1#2 \q_nil
797 }
798 \cs_generate_variant:Nn \@@_iv_str_to_num:Nn {Nx}
The input can be of the form of any of these: ‘abcd’, ‘abc’, ‘abc ’, ‘ab’, ‘ab ’, etc. (It is
assumed the first two chars are always not spaces.) So this macro reads in the string padded
with \@empty s, and anything beyond four chars is snipped. The \@empty s then are used to
reconstruct the spaces in the string to number calculation.
For backwards compatibility this code also strips a leading + or -.
799 \cs_set:Npn \@@_strip_leading_sign:Nw #1#2#3 \q_nil
800 {
801 \bool_if:nTF { \str_if_eq_p:nn {#2} {+} || \str_if_eq_p:nn {#2} {-} }
802 { \@@_iv_str_to_num:w #1 \q_nil #3 \c_empty_tl \c_empty_tl \q_nil }

64
803 { \@@_iv_str_to_num:w #1 \q_nil #2#3 \c_empty_tl \c_empty_tl \q_nil }
804 }
If input string (after sign is stripped) is more than 4 chars, #6 will contain ‘⟨excess⟩\c_-
empty_tl\c_empty_tl’. Therefore use #6 to verify string length.
805 \cs_set:Npn \@@_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil
806 {
807 \int_compare:nT { \tl_count:n {#6} > 2 }
808 { \@@_error:nx {ot-tag-too-long} {#2#3#4#5#6} }
809

810 \int_set:Nn #1
811 {
812 `#2 * "1000000
813 + `#3 * "10000
814 + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100
815 + \ifx \c_empty_tl #5 32 \else `#5 \fi
816 }
817 }
818 ⟨/XE⟩

65
File XI
fontspec-code-opentype.dtx
1 OpenType definitions code

\@@_define_opentype_variation_axis:nn 1 \cs_new:Nn \@@_define_opentype_variation_axis:nn


2 {
3 \keys_define:nn {fontspec-opentype}
4 {
5 #1 .code:n = {
6 \prop_gput:Nnn \g_@@_rawvariations_prop { #2 } { ##1 }
7 },
8 #1 .value_required:n = true,
9 #1 .groups:n = {opentype},
10 }
11 }

\@@_define_opentype_feature_group:n 12 \cs_new:Nn \@@_define_opentype_feature_group:n


13 {
14 \keys_define:nn {fontspec-opentype} { #1 .multichoice: , .groups:n = {opentype} }
15 }

#1 : Feature key
\@@_define_opentype_feature:nnnnn #2 : Feature option val
#3 : Check feature — leave empty for no check
#4 : Exact tag string to activate — leave empty for disable only
#5 : Tags to remove (clist)
16 \cs_new:Nn \@@_feat_prop_add:nn
17 {
18 \tl_if_empty:nF {#1}
19 {
20 \prop_if_in:NnF \g_@@_OT_features_prop {#1}
21 {
22 \prop_gput:Nnn \g_@@_OT_features_prop {#1} {#2}
23 }
24 }
25 }
26 \cs_new:Nn \@@_define_opentype_feature:nnnnn
27 {
28 \@@_feat_prop_add:nn {#3} {#1\,=\,#2}
29 \tl_if_empty:nTF {#4}
30 {
31 \keys_define:nn {fontspec-opentype}
32 {
33 #1/#2 .code:n =
34 { \@@_remove_clashing_featstr:n {#5} } ,

66
35 #1/#2 .groups:n = {opentype}
36 }
37 }
38 {
39 \keys_define:nn {fontspec-opentype}
40 {
41 #1/#2 .code:n =
42 {
43 ⟨debug⟩ \typeout{::::::::fontspec-opentype~#1/#2~=~#3/#4/#5}
44 \@@_make_OT_feature:nnn {#3} {#4} {#5}
45 } ,
46 #1/#2 .groups:n = {opentype}
47 }
48 }
49 }

#1 : Feature key
\@@_define_opentype_onoffreset:nnnnn #2 : Feature option val
#3 : Check feature
#4 : Tag prefix to activate: +#4 = on, -#4 = off.
#5 : Tags to remove in the on case (clist)
50 \cs_new:Nn \@@_feat_off:n {#1Off}
51 \cs_new:Nn \@@_feat_reset:n {#1Reset}
52 \cs_new:Nn \@@_define_opentype_onoffreset:nnnnn
53 {
54 \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} {#2} {#3} {+#4} {#5}
55 \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_off:n {#2} } {#3} {-#4}
56 \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_reset:n {#2} } {} {} {+#4,
57 }

#1 : Feature key
\@@_define_opentype_onreset:nnnnn #2 : Feature option val
#3 : Check feature
#4 : Exact tag string to activate
#5 : Tags to remove (clist)
58 \cs_new:Nn \@@_define_opentype_onreset:nnnnn
59 {
60 \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} {#2} {#3} {#4} {#5}
61 \exp_args:Nnx \@@_define_opentype_feature:nnnnn {#1} { \@@_feat_reset:n {#2} } {} {} {#4}
62 }

1.1 Adding features when loading fonts


When remove clashing features,

1. remove the feature being added (to avoid duplicates);

2. remove the inverse of the feature (to avoid cancellation);

3. finally remove all clashing features.

67
63 \cs_new:Nn \@@_make_OT_feature:nnn
64 {
65 ⟨debug⟩ \typeout{:: @@_make_OT_feature:nnn \exp_not:n { {#1}{#2}{#3} } }
66 \@@_remove_clashing_featstr:x { #2 , \@@_swap_plus_minus:n {#2} , #3 }
67 \@@_update_featstr:n {#2}
68 }
69 \cs_generate_variant:Nn \@@_make_OT_feature:nnn {xxx}
70 \cs_new:Nn \@@_swap_plus_minus:n { \@@_swap_plus_minus_aux:Nq #1 \q_nil }
71 \cs_new:Npn \@@_swap_plus_minus_aux:Nq #1#2 \q_nil
72 { \str_case:nn {#1} { {+} {-#2} {-} {+#2} } }

(End of definition for \@@_DeclareFontShape:nnnnnn and others. These functions are documented on page ??.)

\@@_check_script:NnTF This macro takes an OpenType script tag and checks if it exists in the current font. \l_@@_-
script_int is used to store the number corresponding to the script tag string.
73 \prg_new_conditional:Nnn \@@_check_script:Nn {TF,T,F}
74 {
75 ⟨debug⟩\typeout{:: _check_script:Nn~#1~/~#2}
76 \bool_if:NTF \l_@@_never_check_bool
77 { \prg_return_true: }
78 {
79 \bool_if:nTF { \tl_if_empty_p:e {#2} }
80 { \prg_return_false: }
81 {
82 ⟨∗XE⟩
83 ⟨debug⟩\typeout{::::~ checking~ script~ #2}
84 \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2}
85 \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts #1 }
86 \int_zero:N \l_tmpa_int
87 \bool_set_false:N \l__fontspec_check_bool
88 \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
89 {
90 \ifnum \XeTeXOTscripttag #1 \l_tmpa_int = \l_@@_strnum_int
91 \bool_set_true:N \l__fontspec_check_bool
92 \int_set:Nn \l_tmpa_int {\l_tmpb_int}
93 \else
94 \int_incr:N \l_tmpa_int
95 \fi
96 }
97 \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false:
98 ⟨/XE⟩
99 ⟨∗LU⟩
100 \@@_ot_validate_tag:x {#2}
101 \cs_if_eq:NNTF #1 \font
102 { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} }
103 { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} }
104 ⟨debug⟩\typeout{::::~ checking:~"\l_@@_tmp_tl",~ "#2"}
105 \lua_now:e { fontspec.check_ot_script("\l_@@_tmp_tl", "#2") }
106 \bool_if:NTF \l__fontspec_check_bool
107 {
108 ⟨debug⟩\typeout{::::::~ TRUE}

68
109 \prg_return_true:
110 }
111 {
112 ⟨debug⟩\typeout{::::::~ FALSE}
113 \prg_return_false:
114 }
115 ⟨/LU⟩
116 }
117 }
118 }

(End of definition for \@@_check_script:NnTF. This function is documented on page ??.)

\@@_check_lang:NnnTF This macro takes an OpenType language tag and checks if it exists in the current font/script.
\@@_check_lang:NnTF \l_@@_language_int is used to store the number corresponding to the language tag string.
The script used is whatever’s held in \l_@@_script_int. By default, that’s the number corre-
sponding to ‘latn’.
119 \prg_new_conditional:Nnn \@@_check_lang:Nn {TF,F}
120 {
121 \@@_check_lang:NnnTF #1 {#2} {\l_@@_script_tl} {\prg_return_true:} {\prg_return_false:}
122 }
123 \prg_new_conditional:Nnn \@@_check_lang:Nnn {TF}
124 {
125 ⟨debug⟩\typeout{:: _check_lang:Nn~#1~/~#2~/~#3~/}
126 \bool_if:NTF \l_@@_never_check_bool
127 { \prg_return_true: }
128 {
129 \bool_if:nTF { \tl_if_empty_p:e {#3} }
130 { \prg_return_false: }
131 {
132 ⟨∗XE⟩
133 \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2}
134 \@@_iv_str_to_num:Nx \l_@@_script_int {#3}
135 \int_set:Nn \l_@@_tmpb_int
136 { \XeTeXOTcountlanguages #1 \l_@@_script_int }
137 \int_zero:N \l_@@_tmpa_int
138 \bool_set_false:N \l__fontspec_check_bool
139 \bool_until_do:nn { \int_compare_p:nNn \l_@@_tmpa_int = \l_@@_tmpb_int }
140 {
141 \int_set:Nn \l_@@_tmpc_int
142 { \XeTeXOTlanguagetag #1 \l_@@_script_int \l_@@_tmpa_int }
143

144 \int_compare:nNnTF \l_@@_tmpc_int = \l_@@_strnum_int


145 {
146 \bool_set_true:N \l__fontspec_check_bool
147 \int_set:Nn \l_@@_tmpa_int {\l_@@_tmpb_int}
148 }
149 {
150 \int_incr:N \l_@@_tmpa_int
151 }
152 }

69
153 \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false:
154 ⟨/XE⟩
155 ⟨∗LU⟩
156 \@@_ot_validate_tag:x {#2}
157 \@@_ot_validate_tag:x {#3}
158 \cs_if_eq:NNTF #1 \font
159 { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} }
160 { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} }
161 \@@_lua_function:neee {check_ot_lang} {\l_@@_tmp_tl} {#2} {#3}
162 \bool_if:NTF \l__fontspec_check_bool \prg_return_true: \prg_return_false:
163 ⟨/LU⟩
164 }
165 }
166 }

(End of definition for \@@_check_lang:NnnTF and \@@_check_lang:NnTF. These functions are documented on page
??.)

\@@_check_ot_feat:NnnnTF This macro takes an OpenType feature tag and checks if it exists in the current font/script/language.
\l_@@_strnum_int is used to store the number corresponding to the feature tag string. The
script used is whatever’s held in \l_@@_script_int. By default, that’s the number correspond-
ing to ‘latn’. The language used is \l_@@_language_int, by default 0, the ‘default language’.
167 \prg_new_conditional:Nnn \@@_check_ot_feat:Nnnn {TF,T,F}
168 {
169 \bool_if:NTF \l_@@_never_check_bool
170 { \prg_return_true: }
171 {
172 \bool_if:nTF { \tl_if_empty_p:e {#3} || \tl_if_empty_p:e {#4} }
173 { \prg_return_false: }
174 {
175 ⟨∗XE⟩
176 ⟨debug⟩\typeout{::~ fontspec_check_ot_feat:nnn~ {#2}{#3}{#4}}
177 \@@_iv_str_to_num:Nx \l_@@_strnum_int {#2}
178

179 \str_if_eq:eeTF {#3} {dflt}


180 { \int_zero:N \l_@@_language_int }
181 { \@@_iv_str_to_num:Nx \l_@@_language_int {#3} }
182 \@@_iv_str_to_num:Nx \l_@@_script_int {#4}
183

184 \int_set:Nn \l_tmpb_int


185 { \XeTeXOTcountfeatures #1 \l_@@_script_int \l_@@_language_int }
186

187 \int_zero:N \l_tmpa_int


188 \bool_set_false:N \l_@@_check_bool
189 \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
190 {
191 \ifnum\XeTeXOTfeaturetag #1 \l_@@_script_int \l_@@_language_int
192 \l_tmpa_int =\l_@@_strnum_int
193 \bool_set_true:N \l_@@_check_bool
194 \int_set:Nn \l_tmpa_int {\l_tmpb_int}
195 \else
196 \int_incr:N \l_tmpa_int

70
197 \fi
198 }
199 \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false:
200 ⟨/XE⟩
201 ⟨∗LU⟩
202 ⟨debug⟩\typeout{::~ fontspec_check_ot_feat:n~ {#1}}
203 \@@_ot_validate_tag:x {#2}
204 \@@_ot_validate_tag:x {#3}
205 \@@_ot_validate_tag:x {#4}
206 \cs_if_eq:NNTF #1 \font
207 { \tl_set:Nx \l_@@_tmp_tl {\curr@fontshape/\f@size} }
208 { \tl_set:Nx \l_@@_tmp_tl {\cs_to_str:N #1} }
209 \@@_lua_function:neeee {check_ot_feat} {\l_@@_tmp_tl} {#2} {#3} {#4}
210 \bool_if:NTF \l_@@_check_bool \prg_return_true: \prg_return_false:
211 ⟨/LU⟩
212 }
213 }
214 }

(End of definition for \@@_check_ot_feat:NnnnTF. This function is documented on page ??.)

1.2 OpenType feature information


215 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {aalt}{Access~All~Alternates}
216 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {abvf}{Above-base~Forms}
217 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {abvm}{Above-base~Mark~Positioning}
218 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {abvs}{Above-base~Substitutions}
219 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {afrc}{Alternative~Fractions}
220 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {akhn}{Akhands}
221 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {blwf}{Below-base~Forms}
222 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {blwm}{Below-base~Mark~Positioning}
223 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {blws}{Below-base~Substitutions}
224 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {calt}{Contextual~Alternates}
225 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {case}{Case-Sensitive~Forms}
226 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ccmp}{Glyph~Composition~/~Decomposition}
227 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {cfar}{Conjunct~Form~After~Ro}
228 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {cjct}{Conjunct~Forms}
229 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {clig}{Contextual~Ligatures}
230 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {cpct}{Centered~CJK~Punctuation}
231 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {cpsp}{Capital~Spacing}
232 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {cswh}{Contextual~Swash}
233 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {curs}{Cursive~Positioning}
234 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {cvNN}{Character~Variant~$N$}
235 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {c2pc}{Petite~Capitals~From~Capitals}
236 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {c2sc}{Small~Capitals~From~Capitals}
237 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {dist}{Distances}
238 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {dlig}{Discretionary~Ligatures}
239 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {dnom}{Denominators}
240 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {dtls}{Dotless~Forms}
241 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {expt}{Expert~Forms}
242 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {falt}{Final~Glyph~on~Line~Alternates}
243 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {fin2}{Terminal~Forms~\#2}

71
244 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {fin3}{Terminal~Forms~\#3}
245 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {fina}{Terminal~Forms}
246 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {flac}{Flattened~accent~forms}
247 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {frac}{Fractions}
248 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {fwid}{Full~Widths}
249 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {half}{Half~Forms}
250 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {haln}{Halant~Forms}
251 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {halt}{Alternate~Half~Widths}
252 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {hist}{Historical~Forms}
253 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {hkna}{Horizontal~Kana~Alternates}
254 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {hlig}{Historical~Ligatures}
255 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {hngl}{Hangul}
256 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {hojo}{Hojo~Kanji~Forms}
257 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {hwid}{Half~Widths}
258 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {init}{Initial~Forms}
259 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {isol}{Isolated~Forms}
260 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ital}{Italics}
261 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {jalt}{Justification~Alternates}
262 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {jp78}{JIS78~Forms}
263 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {jp83}{JIS83~Forms}
264 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {jp90}{JIS90~Forms}
265 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {jp04}{JIS2004~Forms}
266 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {kern}{Kerning}
267 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {lfbd}{Left~Bounds}
268 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {liga}{Standard~Ligatures}
269 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ljmo}{Leading~Jamo~Forms}
270 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {lnum}{Lining~Figures}
271 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {locl}{Localized~Forms}
272 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ltra}{Left-to-right~alternates}
273 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ltrm}{Left-to-right~mirrored~forms}
274 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {mark}{Mark~Positioning}
275 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {med2}{Medial~Forms~\#2}
276 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {medi}{Medial~Forms}
277 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {mgrk}{Mathematical~Greek}
278 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {mkmk}{Mark~to~Mark~Positioning}
279 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {mset}{Mark~Positioning~via~Substitution}
280 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {nalt}{Alternate~Annotation~Forms}
281 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {nlck}{NLC~Kanji~Forms}
282 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {nukt}{Nukta~Forms}
283 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {numr}{Numerators}
284 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {onum}{Oldstyle~Figures}
285 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {opbd}{Optical~Bounds}
286 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ordn}{Ordinals}
287 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ornm}{Ornaments}
288 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {palt}{Proportional~Alternate~Widths}
289 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pcap}{Petite~Capitals}
290 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pkna}{Proportional~Kana}
291 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pnum}{Proportional~Figures}
292 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pref}{Pre-Base~Forms}
293 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pres}{Pre-base~Substitutions}
294 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pstf}{Post-base~Forms}

72
295 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {psts}{Post-base~Substitutions}
296 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {pwid}{Proportional~Widths}
297 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {qwid}{Quarter~Widths}
298 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rand}{Randomize}
299 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rclt}{Required~Contextual~Alternates}
300 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rkrf}{Rakar~Forms}
301 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rlig}{Required~Ligatures}
302 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rphf}{Reph~Forms}
303 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rtbd}{Right~Bounds}
304 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rtla}{Right-to-left~alternates}
305 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rtlm}{Right-to-left~mirrored~forms}
306 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ruby}{Ruby~Notation~Forms}
307 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {rvrn}{Required~Variation~Alternates}
308 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {salt}{Stylistic~Alternates}
309 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {sinf}{Scientific~Inferiors}
310 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {size}{Optical~size}
311 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {smcp}{Small~Capitals}
312 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {smpl}{Simplified~Forms}
313 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ssNN}{Stylistic~Set~$N$}
314 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {ssty}{Math~script~style~alternates}
315 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {stch}{Stretching~Glyph~Decomposition}
316 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {subs}{Subscript}
317 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {sups}{Superscript}
318 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {swsh}{Swash}
319 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {titl}{Titling}
320 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {tjmo}{Trailing~Jamo~Forms}
321 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {tnam}{Traditional~Name~Forms}
322 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {tnum}{Tabular~Figures}
323 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {trad}{Traditional~Forms}
324 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {twid}{Third~Widths}
325 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {unic}{Unicase}
326 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {valt}{Alternate~Vertical~Metrics}
327 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vatu}{Vattu~Variants}
328 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vert}{Vertical~Writing}
329 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vhal}{Alternate~Vertical~Half~Metrics}
330 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vjmo}{Vowel~Jamo~Forms}
331 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vkna}{Vertical~Kana~Alternates}
332 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vkrn}{Vertical~Kerning}
333 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vpal}{Proportional~Alternate~Vertical~Me
334 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vrt2}{Vertical~Alternates~and~Rotation}
335 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {vrtr}{Vertical~Alternates~for~Rotation}
336 \prop_gput:Nnn \g_@@_all_opentype_feature_names_prop {zero}{Slashed~Zero}
TODO: move the above elsewhere!!

73
File XII
fontspec-code-graphite.dtx
1 Graphite/AAT code
\@@_define_aat_feature_group:n
1 \cs_new:Nn \@@_define_aat_feature_group:n
2 {
3 \keys_define:nn {fontspec-aat} { #1 .multichoice: }
4 }

(End of definition for \@@_define_aat_feature_group:n. This function is documented on page ??.)

\@@_define_aat_feature:nnnn
5 \cs_new:Nn \@@_define_aat_feature:nnnn
6 {
7 \keys_define:nn {fontspec-aat}
8 {
9 #1/#2 .code:n = { \@@_make_AAT_feature:nn {#3}{#4} }
10 }
11 }

(End of definition for \@@_define_aat_feature:nnnn. This function is documented on page ??.)

\@@_make_AAT_feature:nn
12 \cs_new:Nn \@@_make_AAT_feature:nn
13 {
14 \tl_if_empty:nTF {#1}
15 { \@@_warning:n {aat-feature-not-exist} }
16 {
17 \exp_args:No \@@_make_AAT_feature_string:NnnTF \l_@@_fontface_cs_tl {#1} {#2}
18 {
19 \@@_update_featstr:n {\l_fontspec_feature_string_tl}
20 }
21 {
22 \@@_warning:nx {aat-feature-not-exist-in-font} {#1,#2}
23 }
24 }
25 }

(End of definition for \@@_make_AAT_feature:nn. This function is documented on page ??.)

\@@_make_AAT_feature_string:NnnTF This macro takes the numerical codes for a font feature and creates a specified macro contain-
ing the string required in the font definition to turn that feature on or off. Used primarily in
[...], but also used to check if small caps exists in the requested font (see page 61).
For exclusive selectors, it’s easy; just grab the string: For non-exclusive selectors, it’s a
little more complex. If the selector is even, it corresponds to switching the feature on. If the
selector is odd, it corresponds to switching the feature off. But XETEX doesn’t return a selector
string for this number, since the feature is defined for the ‘switching on’ value. So we need to

74
check the selector of the previous number, and then prefix the feature string with ! to denote
the switch.
Finally, save out the complete feature string in \l_fontspec_feature_string_tl.
26 \prg_new_conditional:Nnn \@@_make_AAT_feature_string:Nnn {TF,T,F}
27 {
28 \tl_set:Nx \l_@@_tmpa_tl { \XeTeXfeaturename #1 #2 }
29 \tl_if_empty:NTF \l_@@_tmpa_tl
30 { \prg_return_false: }
31 {
32 \int_compare:nTF { \XeTeXisexclusivefeature #1 #2 > 0 }
33 {
34 \tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3}
35 }
36 {
37 \int_if_even:nTF {#3}
38 {
39 \tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3}
40 }
41 {
42 \tl_set:Nx \l_@@_tmpb_tl
43 {
44 \XeTeXselectorname #1 #2\space \numexpr#3-1\relax
45 }
46 \tl_if_empty:NF \l_@@_tmpb_tl { \tl_put_left:Nn \l_@@_tmpb_tl {!} }
47 }
48 }
49

50 \tl_if_empty:NTF \l_@@_tmpb_tl
51 { \prg_return_false: }
52 {
53 \tl_set:Nx \l_fontspec_feature_string_tl { \l_@@_tmpa_tl = \l_@@_tmpb_tl }
54 \prg_return_true:
55 }
56 }
57 }

(End of definition for \@@_make_AAT_feature_string:NnnTF. This function is documented on page ??.)

75
File XIII
fontspec-code-keyval.dtx
1 Font loading (keyval) definitions
This package uses a large number of keyval modules which operate sequentially on keyval
input to ensure priority.
1 \clist_gset:Nn \g_@@_all_keyval_modules_clist
2 {
3 fontspec, fontspec-opentype, fontspec-aat,
4 fontspec-preparse, fontspec-preparse-cfg, fontspec-preparse-external, fontspec-preparse-ne
5 fontspec-renderer
6 }
Wrapper function to save some characters in the source:
7 \cs_new:Nn \@@_keys_define_code:nnn
8 {
9 \keys_define:nn {#1} { #2 .code:n = {#3} }
10 }
For catching features that cannot be used in \addfontfeatures:
11 \cs_new:Nn \@@_aff_error:n
12 {
13 \@@_keys_define_code:nnn {fontspec-addfeatures} {#1}
14 { \@@_error:nx {not-in-addfontfeatures} {#1} }
15 }

1.1 Pre-pre-parsing stages


These features are extracted from the font feature list before all others.

Don’t load font config file


16 \@@_keys_define_code:nnn {fontspec-preparse-cfg} {IgnoreFontspecFile}
17 {
18 \bool_set_false:N \l_@@_fontcfg_bool
19 }
20 \@@_keys_define_code:nnn {fontspec-preparse-external} {IgnoreFontspecFile}
21 {
22 \bool_set_false:N \l_@@_fontcfg_bool
23 }

Path For fonts that aren’t installed in the system. If no argument is given, the font is located with
kpsewhich; it’s either in the current directory or the TEX tree. Otherwise, the argument given
defines the file path of the font.
24 \@@_keys_define_code:nnn {fontspec-preparse-external} {Path}
25 {
26 \bool_set_true:N \l_@@_nobf_bool
27 \bool_set_true:N \l_@@_noit_bool
28 \tl_set:Nn \l_@@_font_path_tl {#1}

76
29 \@@_font_is_file:
30 ⟨∗XE⟩
31 \keys_set:nn {fontspec-renderer} {Renderer=OpenType}
32 ⟨/XE⟩
33 }
34 \aliasfontfeature{Path}{ExternalLocation}
35 \@@_keys_define_code:nnn {fontspec} {Path} {}

(End of definition for Path. This function is documented on page ??.)

Extension For fonts that aren’t installed in the system. Specifies the font extension to use.
36 \@@_keys_define_code:nnn {fontspec-preparse-external} {Extension}
37 {
38 \tl_set:Nn \l_@@_extension_tl {#1}
39 \bool_if:NF \l_@@_external_bool
40 {
41 \keys_set:nn {fontspec-preparse-external} {Path}
42 }
43 }
44 \tl_clear:N \l_@@_extension_tl
45 \@@_keys_define_code:nnn {fontspec} {Extension} {}

KpseOnly If the font is specified by filename, only search for it through kpse. XETEX does
not support finding system fonts by filename so this is always implicitly set there.
46 \@@_keys_define_code:nnn {fontspec-preparse-external} {KpseOnly}
47 {
48 \bool_set_true:N \l_@@_external_kpse_bool
49 \bool_if:NT \l_@@_external_bool \@@_font_is_file:
50 }
51 \@@_keys_define_code:nnn {fontspec} {KpseOnly} {}

Renderer This feature must be processed before all others (the other font shape and features
options are also pre-parsed for convenience) because the renderer determines the format of
the features and whether certain features are available.
52 ⟨∗XE⟩
53 \keys_define:nn {fontspec-renderer}
54 {
55 Renderer .choices:nn =
56 {AAT,ICU,OpenType,Graphite,Full,Basic,Node,Base,HarfBuzz,Harfbuzz}
57 {
58 \int_compare:nTF {\l_keys_choice_int <= 4}
59 {
60 \tl_set:Nx \l_@@_renderer_tl
61 {
62 \int_case:nn \l_keys_choice_int { 1 {/AAT} 2 {/OT} 3 {/OT} 4 {/GR} }
63 }
64 ⟨debug⟩\typeout{Renderer:~ \l_@@_renderer_tl}
65 \tl_gset:Nx \g_@@_single_feat_tl { \l_@@_renderer_tl }
66 }
67 {

77
68 \@@_warning:nx {only-luatex-feature} {Renderer=Full/Basic/Node/Base/HarfBuzz}
69 }
70 }
71 }
72 ⟨/XE⟩
73 ⟨∗LU⟩
74 \keys_define:nn {fontspec-renderer}
75 {
76 Renderer .choices:nn =
77 {Full,Node,Basic,Base,HarfBuzz,Harfbuzz,OpenType,AAT,Graphite}
78 {
79 \int_compare:nT {\l_keys_choice_int >= 5} { \bool_set_true:N \l_@@_harfbuzz_bool }
80

81 \tl_set:Nx \l_@@_mode_tl
82 {
83 \int_case:nn \l_keys_choice_int { 1 {node} 2 {node} 3 {base} 4 {base} 5 {harf} 6 {
84 }
85

86 \tl_set:Nx \l_@@_shaper_tl
87 {
88 \int_case:nn \l_keys_choice_int { 1 {} 2 {} 3 {} 4 {} 5 {} 6 {} 7 {ot} 8 {coretext
89 }
90

91 ⟨debug⟩\typeout{Mode:~"\l_@@_mode_tl"~/~Shaper:~"\l_@@_shaper_tl"}
92

93 \tl_gset:Nx \g_@@_single_feat_tl
94 {
95 mode=\l_@@_mode_tl ;
96 \tl_if_empty:NF \l_@@_shaper_tl { shaper=\l_@@_shaper_tl}
97 }
98 } ,
99

100 Renderer unknown .code:n =


101 {
102 \bool_set_true:N \l_@@_harfbuzz_bool
103 \@@_warning:nx {unknown-renderer} {#1}
104 \tl_set:Nn \l_@@_mode_tl {harf}
105 \tl_set:Nn \l_@@_shaper_tl {#1}
106 } ,
107 }
108 ⟨/LU⟩

1.2 Pre-parsed features


OpenType script/language See later for the resolutions from fontspec features to Open-
Type definitions.
109 \@@_keys_define_code:nnn {fontspec-preparse} {Script}
110 {
111 ⟨XE⟩ \tl_if_empty:NT \l_@@_renderer_tl { \keys_set:nn {fontspec-renderer} {Renderer=OpenTyp
112 \tl_set:Nn \l_@@_script_name_tl {#1}
113 }

78
Exactly the same:
114 \@@_keys_define_code:nnn {fontspec-preparse} {Language}
115 {
116 ⟨XE⟩ \tl_if_empty:NT \l_@@_renderer_tl { \keys_set:nn {fontspec-renderer} {Renderer=OpenTyp
117 \tl_set:Nn \l_@@_lang_name_tl {#1}
118 }

TTC font index


119 \@@_keys_define_code:nnn {fontspec-preparse} {FontIndex}
120 {
121 \str_if_eq:eeF { \str_lowercase:f {\l_@@_extension_tl} } {.ttc}
122 { \@@_warning:n {font-index-needs-ttc} }
123 ⟨XE⟩ \tl_set:Nn \l_@@_ttc_index_tl {:#1}
124 ⟨LU⟩ \tl_set:Nn \l_@@_ttc_index_tl {(#1)}
125 }
126 \@@_keys_define_code:nnn {fontspec} {FontIndex}
127 {
128 ⟨XE⟩ \tl_set:Nn \l_@@_ttc_index_tl {:#1}
129 ⟨LU⟩ \tl_set:Nn \l_@@_ttc_index_tl {(#1)}
130 }

1.3 Font faces


Upright
131 \@@_keys_define_code:nnn {fontspec-preparse-external} {UprightFont}
132 {
133 \fontspec_complete_fontname:Nn \l_@@_fontname_up_tl {#1}
134 }

Italic and slanted


135 \@@_keys_define_code:nnn {fontspec-preparse-external} {ItalicFont}
136 {
137 \tl_if_empty:nTF {#1}
138 {
139 \bool_set_true:N \l_@@_noit_bool
140 }
141 {
142 \bool_set_false:N \l_@@_noit_bool
143 \fontspec_complete_fontname:Nn \l_@@_fontname_it_tl {#1}
144 }
145 }
146 \@@_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont}
147 {
148 \fontspec_complete_fontname:Nn \l_@@_fontname_sl_tl {#1}
149 }
150 \@@_keys_define_code:nnn {fontspec-preparse-external} {SwashFont}
151 {
152 \fontspec_complete_fontname:Nn \l_@@_fontname_sw_tl {#1}
153 }

79
Bold (NFSS) Series By default, fontspec uses the default bold series, \bfdefault. We want
to be able to make this extensible. This code is not yet functional!
154 %\@@_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries}
155 % {
156 % \tl_gset:Nx \g_@@_curr_series_tl { #1 }
157 % \seq_put_right:Nx \l_@@_bf_series_seq { #1 }
158 % }

Bold This contains some stubb code to allow more than one bold font to be loaded.
159 \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldFont}
160 {
161 \tl_if_empty:nTF {#1}
162 {
163 \bool_set_true:N \l_@@_nobf_bool
164 }
165 {
166 \bool_set_false:N \l_@@_nobf_bool
167 \fontspec_complete_fontname:Nn \l_@@_curr_bfname_tl {#1}
168

169 \seq_if_empty:NT \l_@@_bf_series_seq


170 {
171 \tl_gset:Nx \g_@@_curr_series_tl {\bfdefault}
172 \seq_put_right:Nx \l_@@_bf_series_seq {\bfdefault}
173 }
174

175 \tl_if_eq:oeT \g_@@_curr_series_tl {\bfdefault}


176 {
177 \tl_set_eq:NN \l_@@_fontname_bf_tl \l_@@_curr_bfname_tl
178 }
179

180 \prop_put:NeV \l_@@_nfss_prop {BoldFont-\g_@@_curr_series_tl} \l_@@_curr_bfname_tl


181

182 ⟨debug⟩\typeout{Setting~bold~font~"\l_@@_curr_bfname_tl"~with~series~"\g_@@_curr_series_tl"}
183

184 }
185 }

Bold italic/slanted
186 \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont}
187 {
188 \fontspec_complete_fontname:Nn \l_@@_fontname_bfit_tl {#1}
189 }
190 \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont}
191 {
192 \fontspec_complete_fontname:Nn \l_@@_fontname_bfsl_tl {#1}
193 }
194 \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldSwashFont}
195 {
196 \fontspec_complete_fontname:Nn \l_@@_fontname_bfsw_tl {#1}
197 }

80
Small caps Small caps isn’t pre-parsed because it can vary with others above:
198 \@@_keys_define_code:nnn {fontspec} {SmallCapsFont}
199 {
200 \tl_if_empty:nTF {#1}
201 {
202 \bool_set_true:N \l_@@_nosc_bool
203 }
204 {
205 \bool_set_false:N \l_@@_nosc_bool
206 \fontspec_complete_fontname:Nn \l_@@_fontname_sc_tl {#1}
207 }
208 }

1.3.1 Preparsed font features


209 \@@_keys_define_code:nnn {fontspec-preparse} {UprightFeatures}
210 {
211 \clist_put_right:Nn \l_@@_fontfeat_up_clist {#1}
212 }
213 \@@_keys_define_code:nnn {fontspec-preparse} {BoldFeatures}
214 {
215 \clist_put_right:Nn \l_@@_fontfeat_bf_clist {#1}
216 % \prop_put:NeV \l_@@_nfss_prop
217 % {BoldFont-\g_@@_curr_series_tl} \l_@@_curr_bfname_tl
218 }
219 \@@_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures}
220 {
221 \clist_put_right:Nn \l_@@_fontfeat_it_clist {#1}
222 }
223 \@@_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures}
224 {
225 \clist_put_right:Nn \l_@@_fontfeat_bfit_clist {#1}
226 }
227 \@@_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures}
228 {
229 \clist_put_right:Nn \l_@@_fontfeat_sl_clist {#1}
230 }
231 \@@_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures}
232 {
233 \clist_put_right:Nn \l_@@_fontfeat_bfsl_clist {#1}
234 }
235 \@@_keys_define_code:nnn {fontspec-preparse} {SwashFeatures}
236 {
237 \clist_put_right:Nn \l_@@_fontfeat_sw_clist {#1}
238 }
239 \@@_keys_define_code:nnn {fontspec-preparse} {BoldSwashFeatures}
240 {
241 \clist_put_right:Nn \l_@@_fontfeat_bfsw_clist {#1}
242 }
Note that small caps features can vary by shape, so these in fact aren’t pre-parsed.
243 \@@_keys_define_code:nnn {fontspec} {SmallCapsFeatures}

81
244 {
245 \bool_if:NF \l_@@_firsttime_bool
246 {
247 \clist_put_right:Nn \l_@@_fontfeat_sc_clist {#1}
248 }
249 }
Features varying by size
250 \@@_keys_define_code:nnn {fontspec-preparse} {SizeFeatures}
251 {
252 \clist_set:Nn \l_@@_sizefeat_clist {#1}
253 \clist_put_right:Nn \l_@@_fontfeat_up_clist { SizeFeatures = {#1} }
254 }
255 \@@_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures}
256 {
257 \clist_set:Nn \l_@@_sizefeat_clist {#1}
258 \tl_if_empty:NT \l_@@_this_font_tl
259 { \tl_set:Nn \l_@@_this_font_tl { -- } } % needs to be non-empty as a flag
260 }
261 \@@_keys_define_code:nnn {fontspec-preparse-nested} {Font}
262 {
263 \tl_set:Nn \l_@@_this_font_tl {#1}
264 }
265 \@@_keys_define_code:nnn {fontspec} {SizeFeatures}
266 {
267 % dummy
268 }
269 \@@_keys_define_code:nnn {fontspec} {Font}
270 {
271 % dummy
272 }
273 \@@_keys_define_code:nnn {fontspec-sizing} {Size}
274 {
275 \tl_set:Nn \l_@@_size_tl {#1}
276 }
277 \@@_keys_define_code:nnn {fontspec-sizing} {Font}
278 {
279 \fontspec_complete_fontname:Nn \l_@@_sizedfont_tl {#1}
280 }
A hack to fix a test, needs to be investigated why necessary!
281 \@@_keys_define_code:nnn {fontspec-opentype} {UprightFont} {}
282 \@@_keys_define_code:nnn {fontspec-opentype} {ItalicFont} {}
283 \@@_keys_define_code:nnn {fontspec-opentype} {SlantedFont} {}
284 \@@_keys_define_code:nnn {fontspec-opentype} {BoldFont} {}
285 \@@_keys_define_code:nnn {fontspec-opentype} {BoldItalicFont} {}
286 \@@_keys_define_code:nnn {fontspec-opentype} {BoldSlantedFont} {}

1.4 General font-independent features


These features can be applied to any font.

82
NFSS encoding For the very brave.
287 \@@_keys_define_code:nnn {fontspec-preparse} {NFSSEncoding}
288 {
289 \tl_gset:Nx \g_@@_nfss_enc_tl { #1 }
290 }

NFSS family Interactions with other packages will sometimes require setting the NFSS fam-
ily explicitly. (By default fontspec auto-generates one based on the font name.)
291 \@@_keys_define_code:nnn {fontspec-preparse} {NFSSFamily}
292 {
293 \tl_set:Nx \l_@@_nfss_fam_tl { #1 }
294 }

NFSS series/shape This option looks similar in name but has a very different function.
295 \@@_keys_define_code:nnn {fontspec-preparse} {FontFace}
296 {
297 \tl_clear:N \l_@@_this_font_tl
298 \clist_set:No \l_@@_arg_clist { \use_iii:nnn #1 }
299 \clist_set_eq:NN \l_@@_this_feat_clist \l_@@_arg_clist
300 \int_compare:nT { \clist_count:N \l_@@_arg_clist = 1 }
301 {
302 ⟨debug⟩\typeout{FontFace~ parsing:~ one~ clist~ item}
303 \tl_if_in:NnF \l_@@_arg_clist {=}
304 {
305 ⟨debug⟩\typeout{FontFace~ parsing:~ no~ equals~ =>~ font~ name~ only}
306 \tl_set_eq:NN \l_@@_this_font_tl \l_@@_arg_clist
307 \tl_clear:N \l_@@_this_feat_clist
308 }
309 }
310

311 \@@_add_nfssfont:nnnn
312 {\use_i:nnn #1} {\use_ii:nnn #1} {\l_@@_this_font_tl} {\l_@@_this_feat_clist}
313 }

Scale If the input isn’t one of the pre-defined string options, then it’s gotta be numerical.
\fontspec_calc_scale:n and \fontspec_calc_scale:nn do all the work in the auto-
scaling cases.
314 \@@_keys_define_code:nnn {fontspec} {Scale}
315 {
316 \str_case:nnF {#1}
317 {
318 {MatchLowercase} { \@@_calc_scale:n {5} }
319 {MatchUppercase} { \@@_calc_scale:n {8} }
320 {MatchAveragecase} { \@@_calc_scale:nn {5} {8} }
321 }
322 { \tl_set:Nx \l_@@_scale_tl {#1} }
323 \@@_info:n {set-scale}
324 }

83
ScaleAgain
325 \@@_keys_define_code:nnn {fontspec} {ScaleAgain}
326 {
327 \tl_if_empty:NT \l_@@_scale_tl { \tl_set:Nn \l_@@_scale_tl {1} }
328 \tl_set:Nx \l_@@_scale_tl { \fp_eval:n { #1 * \l_@@_scale_tl } }
329 \@@_info:n {set-scale}
330 }

\@@_calc_scale:n This macro calculates the amount of scaling between the default roman font and the (default
shape of) the font being selected such that the font dimension that is input is equal for both.
The only font dimensions that justify this are 5 (lowercase height) and 8 (uppercase height in
XETEX).
This script is executed for every extra shape, which seems wasteful, but allows alternate
italic shapes from a separate font, say, to be loaded and to be auto-scaled correctly. Even if this
would be ugly.
To begin, change to \rmfamily but use internal commands in case csrmfamily has been
overwritten. (Note that changing \rmfamily with fontspec resets \encodingdefault appro-
priately.)
331 \cs_new:Nn \@@_calc_scale:n
332 {
333 \group_begin:
334

335 \fontencoding { \encodingdefault }


336 \fontfamily { \familydefault }
337 \selectfont
338

339 \@@_set_font_dimen:NnN \l_@@_tmpa_dim {#1} \font


340 \@@_set_font_dimen:NnN \l_@@_tmpb_dim {#1} \l_@@_fontface_cs_tl
341

342 \tl_set:Nx \l_@@_scale_tl


343 {
344 \fp_eval:n { \dim_to_fp:n {\l_@@_tmpa_dim} /
345 \dim_to_fp:n {\l_@@_tmpb_dim} }
346 }
347

348 \exp_args:NNNx
349 \group_end:
350 \tl_set:Nx \l_@@_scale_tl { \l_@@_scale_tl }
351 }

(End of definition for \@@_calc_scale:n. This function is documented on page ??.)

\@@_calc_scale:nn This macro calls \fontspec_calc_scale:n twice and then sets the scale to the average of
the two results.
352 \cs_new:Nn \@@_calc_scale:nn
353 {
354 \group_begin:
355 \__fontspec_calc_scale:n {#1}
356 \tl_set_eq:NN \l_@@_tmp_tl \l_@@_scale_tl
357 \__fontspec_calc_scale:n {#2}
358 \tl_set:Nx \l_@@_scale_tl

84
359 {
360 \fp_eval:n { (\l_@@_tmp_tl + \l_@@_scale_tl)/2 }
361 }
362 \exp_args:NNNx
363 \group_end:
364 \tl_set:Nx \l_@@_scale_tl { \l_@@_scale_tl }
365 }

(End of definition for \@@_calc_scale:nn. This function is documented on page ??.)

\@@_set_font_dimen:NnN This function sets the dimension #1 (for font #3) to ‘fontdimen’ #2 for either font dimension
5 (x-height) or 8 (cap-height). If, for some reason, these return an incorrect ‘zero’ value (as
\fontdimen8 might for a .tfm font), then we cheat and measure the height of a glyph. We
assume in this case that the font contains either an ‘X’ or an ‘x’.
366 \cs_new:Nn \@@_set_font_dimen:NnN
367 {
368 \dim_set:Nn #1 { \fontdimen #2 #3 }
369 \dim_compare:nNnT #1 = {0pt}
370 {
371 \settoheight #1
372 {
373 \str_if_eq:nnTF {#3} {\font} \rmfamily #3
374 \int_case:nnF #2
375 {
376 {5} {x} % x-height
377 {8} {X} % cap-height
378 } {?} % "else" clause; never reached.
379 }
380 }
381 }

(End of definition for \@@_set_font_dimen:NnN. This function is documented on page ??.)

Inter-word space These options set the relevant \fontdimens for the font being loaded.
382 \@@_keys_define_code:nnn {fontspec} {WordSpace}
383 {
384 \bool_if:NF \l_@@_firsttime_bool
385 { \_fontspec_parse_wordspace:w #1,,,\q_stop }
386 }
387 \@@_aff_error:n {WordSpace}

\_fontspec_parse_wordspace:w This macro determines if the input to WordSpace is of the form {X} or {X,Y,Z} and executes
the font scaling. If the former input, it executes {X,X,X}.
388 \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop
389 {
390 \tl_if_empty:nTF {#4}
391 {
392 \tl_set:Nn \l_@@_wordspace_adjust_tl
393 {
394 \fontdimen 2 \font = #1 \fontdimen 2 \font
395 \fontdimen 3 \font = #1 \fontdimen 3 \font

85
396 \fontdimen 4 \font = #1 \fontdimen 4 \font
397 }
398 }
399 {
400 \tl_set:Nn \l_@@_wordspace_adjust_tl
401 {
402 \fontdimen 2 \font = #1 \fontdimen 2 \font
403 \fontdimen 3 \font = #2 \fontdimen 3 \font
404 \fontdimen 4 \font = #3 \fontdimen 4 \font
405 }
406 }
407 }

(End of definition for \_fontspec_parse_wordspace:w. This function is documented on page ??.)

Punctuation space Scaling factor for the nominal \fontdimen#7.


408 \@@_keys_define_code:nnn {fontspec} {PunctuationSpace}
409 {
410 \str_case_e:nnF {#1}
411 {
412 {WordSpace}
413 {
414 \tl_set:Nn \l_@@_punctspace_adjust_tl
415 { \fontdimen 7 \font = 0 \fontdimen 2 \font }
416 }
417 {TwiceWordSpace}
418 {
419 \tl_set:Nn \l_@@_punctspace_adjust_tl
420 { \fontdimen 7 \font = 1 \fontdimen 2 \font }
421 }
422 }
423 {
424 \tl_set:Nn \l_@@_punctspace_adjust_tl
425 { \fontdimen 7 \font = #1 \fontdimen 7 \font }
426 }
427 }
428 \@@_aff_error:n {PunctuationSpace}

Secret hook into the font-adjustment code


429 \@@_keys_define_code:nnn {fontspec} {FontAdjustment}
430 {
431 \tl_put_right:Nx \l_@@_postadjust_tl {#1}
432 }

Letterspacing
433 \@@_keys_define_code:nnn {fontspec} {LetterSpace}
434 {
435 \@@_update_featstr:n {letterspace=#1}
436 }

86
Hyphenation character This feature takes one of three arguments: ‘None’, ⟨glyph⟩, or
⟨slot⟩. If the input isn’t the first, and it’s one character, then it’s the second; otherwise, it’s
the third.
LuaTeX decouples hyphenation from font settings, so only HyphenChar=None works for
that engine.
437 \@@_keys_define_code:nnn {fontspec} {HyphenChar}
438 {
439 \str_if_eq:nnTF {#1} {None}
440 {
441 \tl_put_right:Nn \l_@@_postadjust_tl
442 { \@@_primitive_font_set_hyphenchar:Nn \font {-1} }
443 }
444 {
445 ⟨LU⟩ \@@_warning:nx {only-xetex-feature} {HyphenChar}
446

447 \tl_if_single:nTF {#1}


448 { \tl_set:Nn \l_@@_hyphenchar_tl {`#1} }
449 { \tl_set:Nn \l_@@_hyphenchar_tl { #1} }
450

451 \exp_args:No \@@_primitive_font_glyph_if_exist:NnTF \l_@@_fontface_cs_tl {\l_@@_hyphen


452 {
453 \tl_put_right:Nn \l_@@_postadjust_tl
454 { \@@_primitive_font_set_hyphenchar:Nn \font { \l_@@_hyphenchar_tl } }
455 }
456 { \@@_error:nxx {no-glyph}{\l_fontspec_fontname_tl}{#1} }
457

458 }
459 }
460 \@@_aff_error:n {HyphenChar}

Color Test first if the color is a named l3color, then if it is a color from xcolor, which names
its colours \color@<name>. If this fails the argument is assumed to be a hex color.
461 \@@_keys_define_code:nnn {fontspec} {Color}
462 {
463 ⟨∗XE⟩
464 \color_if_exist:nTF {#1}
465 {
466 \color_export:nnN {#1} {HTML}\l_@@_hexcol_tl
467 }
468 {
469 \cs_if_exist:cTF { \token_to_str:N \color@ #1 }
470 {
471 \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl
472 }
473 {
474 \int_compare:nTF { \tl_count:n {#1} == 6 }
475 { \tl_set:Nn \l_@@_hexcol_tl {#1} }
476 {
477 \int_compare:nTF { \tl_count:n {#1} == 8 }
478 { \fontspec_parse_colour:viii #1 }

87
479 {
480 \bool_if:NF \l_@@_firsttime_bool
481 { \@@_warning:nx {bad-colour} {#1} }
482 }
483 }
484 }
485 }
486 ⟨/XE⟩
487 ⟨∗LU⟩
488 \color_if_exist:nTF {#1}
489 {
490 \tl_set:Nn \l_@@_hexcol_tl {#1}
491 }
492 {
493 \cs_if_exist:cTF { \token_to_str:N \color@ #1 }
494 {
495 \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl
496 }
497 {
498 \int_compare:nTF { \tl_count:n {#1} == 6 }
499 { \tl_set:Nn \l_@@_hexcol_tl {#1} }
500 {
501 \int_compare:nTF { \tl_count:n {#1} == 8 }
502 { \fontspec_parse_colour:viii #1 }
503 {
504 \bool_if:NF \l_@@_firsttime_bool
505 { \@@_warning:nx {bad-colour} {#1} }
506 }
507 }
508 }
509 }
510 ⟨/LU⟩
511 }
512 \cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8
513 {
514 \tl_set:Nn \l_@@_hexcol_tl {#1#2#3#4#5#6}
515 \tl_if_eq:NNF \l_@@_opacity_tl \c_@@_opacity_tl
516 {
517 \bool_if:NF \l_@@_firsttime_bool
518 { \@@_warning:nx {opa-twice-col} {#7#8} }
519 }
520 \tl_set:Nn \l_@@_opacity_tl {#7#8}
521 }
522 \aliasfontfeature{Color}{Colour}
523 \@@_keys_define_code:nnn {fontspec} {Opacity}
524 {
525 \int_set:Nn \l_@@_tmp_int {255}
526 \@@_int_mult_truncate:Nn \l_@@_tmp_int { #1 }
527 \tl_if_eq:NNF \l_@@_opacity_tl \c_@@_opacity_tl
528 {
529 \bool_if:NF \l_@@_firsttime_bool

88
530 { \@@_warning:nx {opa-twice} {#1} }
531 }
532 \tl_set:Nx \l_@@_opacity_tl
533 {
534 ⟨LU⟩ ,
535 \int_compare:nT { \l_@@_tmp_int <= "F } {0} % zero pad
536 \int_to_hex:n { \l_@@_tmp_int }
537 }
538 }

Mapping
539 ⟨∗XE⟩
540 \@@_keys_define_code:nnn {fontspec-aat} {Mapping}
541 {
542 \tl_set:Nn \l_@@_mapping_tl { #1 }
543 }
544 \@@_keys_define_code:nnn {fontspec-opentype} {Mapping}
545 {
546 \tl_set:Nn \l_@@_mapping_tl { #1 }
547 }
548 ⟨/XE⟩
549 ⟨∗LU⟩
550 \@@_keys_define_code:nnn {fontspec-opentype} {Mapping}
551 {
552 \str_if_eq:nnTF {#1} {tex-text}
553 {
554 \@@_warning:n {no-mapping-ligtex}
555 \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none}
556 \keys_set:nn {fontspec-opentype} { Ligatures=TeX }
557 }
558 { \@@_warning:n {no-mapping} }
559 }
560 ⟨/LU⟩

1.4.1 Continuous font axes


561 ⟨∗XE⟩
562 \@@_keys_define_code:nnn {fontspec} {Weight}
563 {
564 \@@_update_featstr:n{weight=#1}
565 }
566 ⟨/XE⟩
567 ⟨LU⟩\@@_define_opentype_variation_axis:nn {Weight} {wght}
568 ⟨∗XE⟩
569 \@@_keys_define_code:nnn {fontspec} {Width}
570 {
571 \@@_update_featstr:n{width=#1}
572 }
573 ⟨/XE⟩
574 ⟨LU⟩\@@_define_opentype_variation_axis:nn {Width} {wdth}
575 \@@_define_opentype_variation_axis:nn {Slant} {slnt}

89
576 \@@_keys_define_code:nnn {fontspec} {OpticalSize}
577 ⟨∗XE⟩
578 {
579 \bool_if:NTF \l_@@_ot_bool
580 {
581 \tl_set:Nn \l_@@_optical_size_tl {/ S = #1}
582 }
583 {
584 \bool_if:NT \l_@@_mm_bool
585 {
586 \@@_update_featstr:n { optical size = #1 }
587 }
588 }
589 \bool_if:nT { !\l_@@_ot_bool && !\l_@@_mm_bool }
590 {
591 \bool_if:NT \l_@@_firsttime_bool
592 { \@@_warning:nx {no-opticals} {\l_fontspec_fontname_tl} }
593 }
594 }
595 ⟨/XE⟩
596 ⟨∗LU⟩
597 {
598 \tl_set:Nn \l_@@_optical_size_tl {/ S = #1}
599 }
600 ⟨/LU⟩
For other potentially font specific variation axes, there is a raw setter available:
601 \@@_keys_define_code:nnn {fontspec-opentype} {RawAxis}
602 {
603 \prop_gput_from_keyval:Nn \g_@@_rawvariations_prop {#1}
604 }
1.4.2 Variation instances
605 \@@_keys_define_code:nnn {fontspec-opentype} {Instance}
606 {
607 \tl_gset:Nn \g_@@_instance_tl {#1}
608 }
1.4.3 Font transformations
These are to be specified to apply directly to a font shape:
609 \keys_define:nn {fontspec}
610 {
611 FakeSlant .code:n =
612 {
613 \@@_update_featstr:n {slant=#1}
614 },
615 FakeSlant .default:n = {0.2}
616 }
617 \keys_define:nn {fontspec}
618 {
619 FakeStretch .code:n =
620 {

90
621 \@@_update_featstr:n {extend=#1}
622 },
623 FakeStretch .default:n = {1.2}
624 }
625 \keys_define:nn {fontspec}
626 {
627 FakeBold .code:n =
628 {
629 \@@_update_featstr:n {embolden=#1}
630 },
631 FakeBold .default:n = {1.5}
632 }
These are to be given to a shape that has no real bold/italic to signal that fontspec should
automatically create ‘fake’ shapes.
The behaviour is currently that only if both AutoFakeSlant and AutoFakeBold are spec-
ified, the bold italic is also faked.
These features presently override real shapes found in the font; in the future I’d like these
features to be ignored in this case, instead. (This is just a bit harder to program in the current
design of fontspec.)
633 \keys_define:nn {fontspec}
634 {
635 AutoFakeSlant .code:n =
636 {
637 \bool_if:NT \l_@@_firsttime_bool
638 {
639 \tl_set:Nn \l_@@_fake_slant_tl {#1}
640 \clist_put_right:Nn \l_@@_fontfeat_it_clist {FakeSlant=#1}
641 \tl_set_eq:NN \l_@@_fontname_it_tl \l_fontspec_fontname_tl
642 \bool_set_false:N \l_@@_noit_bool
643

644 \tl_if_empty:NF \l_@@_fake_embolden_tl


645 {
646 \clist_put_right:Nx \l_@@_fontfeat_bfit_clist
647 {FakeBold=\l_@@_fake_embolden_tl}
648 \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeSlant=#1}
649 \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl
650 }
651 }
652 },
653 AutoFakeSlant .default:n = {0.2}
654 }
Same but reversed:
655 \keys_define:nn {fontspec}
656 {
657 AutoFakeBold .code:n =
658 {
659 \bool_if:NT \l_@@_firsttime_bool
660 {
661 \tl_set:Nn \l_@@_fake_embolden_tl {#1}
662 \clist_put_right:Nn \l_@@_fontfeat_bf_clist {FakeBold=#1}

91
663 \tl_set_eq:NN \l_@@_fontname_bf_tl \l_fontspec_fontname_tl
664 \bool_set_false:N \l_@@_nobf_bool
665

666 \tl_if_empty:NF \l_@@_fake_slant_tl


667 {
668 \clist_put_right:Nx \l_@@_fontfeat_bfit_clist
669 {FakeSlant=\l_@@_fake_slant_tl}
670 \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeBold=#1}
671 \tl_set_eq:NN \l_@@_fontname_bfit_tl \l_fontspec_fontname_tl
672 }
673 }
674 },
675 AutoFakeBold .default:n = {1.5}
676 }

1.4.4 Raw feature string


This allows savvy XETEX-ers to input font features manually if they have already memorised
the OpenType abbreviations and don’t mind not having error checking.
677 \@@_keys_define_code:nnn {fontspec-opentype} {RawFeature}
678 {
679 \@@_update_featstr:n {#1}
680 }
681 \@@_keys_define_code:nnn {fontspec-aat} {RawFeature}
682 {
683 \@@_update_featstr:n {#1}
684 }

92
File XIV
fontspec-code-feat-opentype.dtx
1 OpenType feature definitions
1 \@@_feat_prop_add:nn {salt} { Alternate\,=\,$N$ }
2 \@@_feat_prop_add:nn {nalt} { Annotation\,=\,$N$ }
3 \@@_feat_prop_add:nn {ornm} { Ornament\,=\,$N$ }
4 \@@_feat_prop_add:nn {cvNN} { CharacterVariant\,=\,$N$:$M$ }
5 \@@_feat_prop_add:nn {ssNN} { StylisticSet\,=\,$N$ }

2 Regular key=val / tag definitions


2.1 Ligatures
6 \@@_define_opentype_feature_group:n {Ligatures}
7 \@@_define_opentype_feature:nnnnn {Ligatures} {ResetAll} {} {}
8 {
9 +dlig,-dlig,+rlig,-rlig,+liga,-liga,+dlig,-dlig,+clig,-clig,+hlig,-hlig,
10 ⟨XE⟩ mapping = tex-text
11 ⟨LU⟩ +tlig,-tlig
12 }
13 \@@_define_opentype_onoffreset:nnnnn {Ligatures} {Required} {rlig} {rlig} {}
14 \@@_define_opentype_onoffreset:nnnnn {Ligatures} {Common} {liga} {liga} {}
15 \@@_define_opentype_onoffreset:nnnnn {Ligatures} {Rare} {dlig} {dlig} {}
16 \@@_define_opentype_onoffreset:nnnnn {Ligatures} {Discretionary} {dlig} {dlig} {}
17 \@@_define_opentype_onoffreset:nnnnn {Ligatures} {Contextual} {clig} {clig} {}
18 \@@_define_opentype_onoffreset:nnnnn {Ligatures} {Historic} {hlig} {hlig} {}
Emulate CM extra ligatures.
19 ⟨∗XE⟩
20 \keys_define:nn {fontspec-opentype}
21 {
22 Ligatures / TeX .code:n = { \tl_set:Nn \l_@@_mapping_tl {tex-text} },
23 Ligatures / TeXOff .code:n = { \tl_clear:N \l_@@_mapping_tl },
24 Ligatures / TeXReset .code:n = { \tl_clear:N \l_@@_mapping_tl },
25 }
26 ⟨/XE⟩
27 ⟨LU⟩\@@_define_opentype_onoffreset:nnnnn {Ligatures} {TeX} {} {tlig} {}
2.2 Letters
28 \@@_define_opentype_feature_group:n {Letters}
29 \@@_define_opentype_feature:nnnnn {Letters} {ResetAll} {} {}
30 {
31 ⟨LU⟩ +lower,-lower,+upper,-upper,+case,+cpsp,
32 +smcp,+pcap,+c2sc,+c2pc,+unic,+rand,
33 -smcp,-pcap,-c2sc,-c2pc,-unic,-rand
34 }
35 ⟨∗LU⟩

93
36 \keys_define:nn {fontspec-opentype}
37 {
38 Letters / Uppercase .code:n = {
39 \@@_make_OT_feature:nnn {} {+upper} {+lower}
40 \@@_make_OT_feature:nnn {} {+case} {}
41 \@@_make_OT_feature:nnn {} {+cpsp} {}
42 },
43 }
44 \@@_define_opentype_feature:nnnnn {Letters} {UppercaseOff} {} {-upper} {+case,+cpsp}
45 \@@_define_opentype_feature:nnnnn {Letters} {UppercaseReset} {} {} {+upper,-upper}
46 \@@_define_opentype_onoffreset:nnnnn {Letters} {Lowercase} {} {lower} {+upper,+case,+cpsp}
47 ⟨/LU⟩
48 \@@_define_opentype_onoffreset:nnnnn {Letters} {SmallCaps} {smcp} {smcp} {+pcap,+unic}
49 \@@_define_opentype_onoffreset:nnnnn {Letters} {PetiteCaps} {pcap} {pcap} {+smcp,+unic}
50 \@@_define_opentype_onoffreset:nnnnn {Letters} {UppercaseSmallCaps} {c2sc} {c2sc} {+c2pc,+unic
51 \@@_define_opentype_onoffreset:nnnnn {Letters} {UppercasePetiteCaps} {c2pc} {c2pc} {+c2sc,+uni
52 \@@_define_opentype_onoffreset:nnnnn {Letters} {Unicase} {unic} {unic} {}
53 \@@_define_opentype_onoffreset:nnnnn {Letters} {Random} {rand} {rand} {}

2.3 Numbers
54 \@@_define_opentype_feature_group:n {Numbers}
55 \@@_define_opentype_feature:nnnnn {Numbers} {ResetAll} {} {}
56 {
57 +tnum,-tnum,
58 +pnum,-pnum,
59 +onum,-onum,
60 +lnum,-lnum,
61 +zero,-zero,
62 +anum,-anum,
63 }
64 \@@_define_opentype_onoffreset:nnnnn {Numbers} {Monospaced} {tnum} {tnum} {+pnum,-pnum}
65 \@@_define_opentype_onoffreset:nnnnn {Numbers} {Proportional} {pnum} {pnum} {+tnum,-tnum}
66 \@@_define_opentype_onoffreset:nnnnn {Numbers} {Lowercase} {onum} {onum} {+lnum,-lnum}
67 \@@_define_opentype_onoffreset:nnnnn {Numbers} {Uppercase} {lnum} {lnum} {+onum,-onum}
68 \@@_define_opentype_onoffreset:nnnnn {Numbers} {SlashedZero} {zero} {zero} {}
69 \aliasfontfeatureoption {Numbers} {Monospaced} {Tabular}
70 \aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle}
71 \aliasfontfeatureoption {Numbers} {Uppercase} {Lining}
luaotload provides a custom anum feature for replacing Latin (AKA Arabic) numbers
with Arabic (AKA Indic-Arabic). The same feature maps to Farsi (Persian) numbers if font
language is Farsi.
72 ⟨LU⟩ \@@_define_opentype_onoffreset:nnnnn {Numbers} {Arabic} {anum} {anum} {}
2.4 Vertical position
73 \@@_define_opentype_feature_group:n {VerticalPosition}
74 \@@_define_opentype_feature:nnnnn {VerticalPosition} {ResetAll} {} {}
75 {
76 +sups,-sups,
77 +subs,-subs,
78 +ordn,-ordn,

94
79 +numr,-numr,
80 +dnom,-dnom,
81 +sinf,-sinf,
82 }
83 \@@_define_opentype_onoffreset:nnnnn {VerticalPosition} {Superior} {sups} {sups} {+s
84 \@@_define_opentype_onoffreset:nnnnn {VerticalPosition} {Inferior} {subs} {subs} {+s
85 \@@_define_opentype_onoffreset:nnnnn {VerticalPosition} {Ordinal} {ordn} {ordn} {+s
86 \@@_define_opentype_onoffreset:nnnnn {VerticalPosition} {Numerator} {numr} {numr} {+s
87 \@@_define_opentype_onoffreset:nnnnn {VerticalPosition} {Denominator} {dnom} {dnom} {+s
88 \@@_define_opentype_onoffreset:nnnnn {VerticalPosition} {ScientificInferior} {sinf} {sinf} {+s

2.5 Contextuals
89 \@@_define_opentype_feature_group:n {Contextuals}
90 \@@_define_opentype_feature:nnnnn {Contextuals} {ResetAll} {} {}
91 {
92 +cswh,-cswh,
93 +calt,-calt,
94 +init,-init,
95 +fina,-fina,
96 +falt,-falt,
97 +medi,-medi,
98 }
99 \@@_define_opentype_onoffreset:nnnnn {Contextuals} {Swash} {cswh} {cswh} {}
100 \@@_define_opentype_onoffreset:nnnnn {Contextuals} {Alternate} {calt} {calt} {}
101 \@@_define_opentype_onoffreset:nnnnn {Contextuals} {WordInitial} {init} {init} {}
102 \@@_define_opentype_onoffreset:nnnnn {Contextuals} {WordFinal} {fina} {fina} {}
103 \@@_define_opentype_onoffreset:nnnnn {Contextuals} {LineFinal} {falt} {falt} {}
104 \@@_define_opentype_onoffreset:nnnnn {Contextuals} {Inner} {medi} {medi} {}

2.6 Diacritics
105 \@@_define_opentype_feature_group:n {Diacritics}
106 \@@_define_opentype_feature:nnnnn {Diacritics} {ResetAll} {} {}
107 {
108 +mark,-mark,
109 +mkmk,-mkmk,
110 +abvm,-abvm,
111 +blwm,-blwm,
112 }
113 \@@_define_opentype_onoffreset:nnnnn {Diacritics} {MarkToBase} {mark} {mark} {}
114 \@@_define_opentype_onoffreset:nnnnn {Diacritics} {MarkToMark} {mkmk} {mkmk} {}
115 \@@_define_opentype_onoffreset:nnnnn {Diacritics} {AboveBase} {abvm} {abvm} {}
116 \@@_define_opentype_onoffreset:nnnnn {Diacritics} {BelowBase} {blwm} {blwm} {}

2.7 Kerning
117 \@@_define_opentype_feature_group:n {Kerning}
118 \@@_define_opentype_feature:nnnnn {Kerning} {ResetAll} {} {}
119 {
120 +cpsp,-cpsp,
121 +kern,-kern,
122 }

95
123 \@@_define_opentype_onoffreset:nnnnn {Kerning} {Uppercase} {cpsp} {cpsp} {}
124 \@@_define_opentype_feature:nnnnn {Kerning} {On} {kern} {+kern} {-kern}
125 \@@_define_opentype_feature:nnnnn {Kerning} {Off} {kern} {-kern} {+kern}
126 \@@_define_opentype_feature:nnnnn {Kerning} {Reset} {} {} {+kern,-kern}

2.8 Fractions
127 \@@_define_opentype_feature_group:n {Fractions}
128 \@@_define_opentype_feature:nnnnn {Fractions} {ResetAll} {} {}
129 {
130 +frac,-frac,
131 +afrc,-afrc,
132 }
133 \@@_define_opentype_feature:nnnnn {Fractions} {On} {frac} {+frac} {}
134 \@@_define_opentype_feature:nnnnn {Fractions} {Off} {frac} {-frac} {}
135 \@@_define_opentype_feature:nnnnn {Fractions} {Reset} {} {} {+frac,-frac}
136 \@@_define_opentype_onoffreset:nnnnn {Fractions} {Alternate} {afrc} {afrc} {-frac}
137 \@@_define_opentype_feature_group:n {LocalForms}
138 \@@_define_opentype_feature:nnnnn {LocalForms} {On} {locl} {+locl} {}
139 \@@_define_opentype_feature:nnnnn {LocalForms} {Off} {locl} {-locl} {}
140 \@@_define_opentype_feature:nnnnn {LocalForms} {Reset} {} {} {+locl,-locl}

2.9 Style
141 \@@_define_opentype_feature_group:n {Style}
142 \@@_define_opentype_feature:nnnnn {Style} {ResetAll} {} {}
143 {
144 +salt,-salt,
145 +ital,-ital,
146 +ruby,-ruby,
147 +swsh,-swsh,
148 +hist,-hist,
149 +titl,-titl,
150 +hkna,-hkna,
151 +vkna,-vkna,
152 +ssty=0,-ssty=0,
153 +ssty=1,-ssty=1,
154 }
155 \@@_define_opentype_onoffreset:nnnnn {Style} {Alternate} {salt} {salt} {}
156 \@@_define_opentype_onoffreset:nnnnn {Style} {Italic} {ital} {ital} {}
157 \@@_define_opentype_onoffreset:nnnnn {Style} {Ruby} {ruby} {ruby} {}
158 \@@_define_opentype_onoffreset:nnnnn {Style} {Swash} {swsh} {swsh} {}
159 \@@_define_opentype_onoffreset:nnnnn {Style} {Cursive} {swsh} {curs} {}
160 \@@_define_opentype_onoffreset:nnnnn {Style} {Historic} {hist} {hist} {}
161 \@@_define_opentype_onoffreset:nnnnn {Style} {Titling} {titl} {titl} {}
162 \@@_define_opentype_onoffreset:nnnnn {Style} {TitlingCaps} {titl} {titl} {} % backwards c
163 \@@_define_opentype_onoffreset:nnnnn {Style} {HorizontalKana} {hkna} {hkna} {+vkna,+pkna}
164 \@@_define_opentype_onoffreset:nnnnn {Style} {VerticalKana} {vkna} {vkna} {+hkna,+pkna}
165 \@@_define_opentype_onoffreset:nnnnn {Style} {ProportionalKana} {pkna} {pkna} {+vkna,+hkna}
166 \@@_define_opentype_feature:nnnnn {Style} {MathScript} {ssty} {+ssty=0} {+ssty=1}
167 \@@_define_opentype_feature:nnnnn {Style} {MathScriptScript} {ssty} {+ssty=1} {+ssty=0}
168 \@@_define_opentype_onoffreset:nnnnn {Style} {Uppercase} {case} {case} {}

96
2.10 CJK shape
169 \@@_define_opentype_feature_group:n {CJKShape}
170 \@@_define_opentype_feature:nnnnn {CJKShape} {ResetAll} {} {}
171 {
172 +trad,-trad,
173 +smpl,-smpl,
174 +jp78,-jp78,
175 +jp83,-jp83,
176 +jp90,-jp90,
177 +jp04,-jp04,
178 +expt,-expt,
179 +nlck,-nlck,
180 }
181 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {Traditional} {trad} {trad} {+smpl,+jp78,+jp83
182 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {Simplified} {smpl} {smpl} {+trad,+jp78,+jp83
183 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {JIS1978} {jp78} {jp78} {+trad,+smpl,+jp83
184 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {JIS1983} {jp83} {jp83} {+trad,+smpl,+jp78
185 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {JIS1990} {jp90} {jp90} {+trad,+smpl,+jp78
186 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {JIS2004} {jp04} {jp04} {+trad,+smpl,+jp78
187 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {Expert} {expt} {expt} {+trad,+smpl,+jp78
188 \@@_define_opentype_onoffreset:nnnnn {CJKShape} {NLC} {nlck} {nlck} {+trad,+smpl,+jp78

2.11 Character width


189 \@@_define_opentype_feature_group:n {CharacterWidth}
190 \@@_define_opentype_feature:nnnnn {CharacterWidth} {ResetAll} {} {}
191 {
192 +pwid,-pwid,
193 +fwid,-fwid,
194 +hwid,-hwid,
195 +twid,-twid,
196 +qwid,-qwid,
197 +palt,-palt,
198 +halt,-halt,
199 }
200 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {Proportional} {pwid} {pwid} {+
201 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {Full} {fwid} {fwid} {+
202 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {Half} {hwid} {hwid} {+
203 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {Third} {twid} {twid} {+
204 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {Quarter} {qwid} {qwid} {+
205 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {AlternateProportional} {palt} {palt} {+
206 \@@_define_opentype_onoffreset:nnnnn {CharacterWidth} {AlternateHalf} {halt} {halt} {+

2.12 Vertical
According to spec vkrn must also activate vpal if available but for simplicity we don’t do that
here (yet?).
207 \@@_define_opentype_feature_group:n {Vertical}
208 \@@_define_opentype_onoffreset:nnnnn {Vertical} {RotatedGlyphs} {vrt2} {vrt2} {+vrtr,+
209 \@@_define_opentype_onoffreset:nnnnn {Vertical} {AlternatesForRotation} {vrtr} {vrtr} {+vrt2}
210 \@@_define_opentype_onoffreset:nnnnn {Vertical} {Alternates} {vert} {vert} {+vrt2}

97
211 \@@_define_opentype_onoffreset:nnnnn {Vertical} {KanaAlternates} {vkna} {vkna} {+hkna}
212 \@@_define_opentype_onoffreset:nnnnn {Vertical} {Kerning} {vkrn} {vkrn} {}
213 \@@_define_opentype_onoffreset:nnnnn {Vertical} {AlternateMetrics} {valt} {valt} {+vhal,+
214 \@@_define_opentype_onoffreset:nnnnn {Vertical} {HalfMetrics} {vhal} {vhal} {+valt,+
215 \@@_define_opentype_onoffreset:nnnnn {Vertical} {ProportionalMetrics} {vpal} {vpal} {+valt,+

3 OpenType features that need numbering


3.1 Alternate
216 \@@_define_opentype_feature_group:n {Alternate}
217 \keys_define:nn {fontspec-opentype}
218 {
219 Alternate .default:n = {0} ,
220 Alternate .groups:n = {opentype},
221 Alternate / unknown .code:n =
222 {
223 \clist_map_inline:nn {#1}
224 { \@@_make_OT_feature:nnn {salt}{ +salt = ##1 }{} }
225 }
226 }
227 ⟨∗LU⟩
228 \keys_define:nn {fontspec-opentype}
229 {
230 Alternate / Random .code:n =
231 { \@@_make_OT_feature:nnn {salt}{ +salt = random }{} } ,
232 }
233 ⟨/LU⟩
234 \aliasfontfeature{Alternate}{StylisticAlternates}

3.2 Variant / StylisticSet


235 \@@_define_opentype_feature_group:n {Variant}
236 \keys_define:nn {fontspec-opentype}
237 {
238 Variant .default:n = {0} ,
239 Variant .groups:n = {opentype} ,
240 Variant / unknown .code:n =
241 {
242 \clist_map_inline:nn {#1}
243 {
244 \@@_make_OT_feature:xxx { ss \two@digits {##1} } { +ss \two@digits {##1} } {}
245 }
246 }
247 }
248 \aliasfontfeature{Variant}{StylisticSet}

3.3 CharacterVariant
249 \@@_define_opentype_feature_group:n {CharacterVariant}
250 \use:x

98
251 {
252 \cs_new:Npn \exp_not:N \fontspec_parse_cv:w
253 ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil
254 {
255 \@@_make_OT_feature:xxx
256 { cv \exp_not:N \two@digits {##1} }
257 { +cv \exp_not:N \two@digits {##1} = ##2 } {}
258 }
259 \keys_define:nn {fontspec-opentype}
260 {
261 CharacterVariant / unknown .code:n =
262 {
263 \clist_map_inline:nn {##1}
264 {
265 \exp_not:N \fontspec_parse_cv:w
266 ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil
267 }
268 }
269 }
270 }
Possibilities: a:0:\q_nil or a:b:0:\q_nil.
3.4 Annotation
271 \@@_define_opentype_feature_group:n {Annotation}
272 \keys_define:nn {fontspec-opentype}
273 {
274 Annotation .default:n = {0} ,
275 Annotation .groups:n = {opentype},
276 Annotation / unknown .code:n =
277 {
278 \@@_make_OT_feature:nnn {nalt} {+nalt=#1} {}
279 }
280 }

3.5 Ornament
281 \@@_define_opentype_feature_group:n {Ornament}
282 \keys_define:nn {fontspec-opentype}
283 {
284 Ornament .default:n = {0} ,
285 Ornament .groups:n = {opentype},
286 Ornament / unknown .code:n =
287 {
288 \@@_make_OT_feature:nnn {ornm} { +ornm=#1 } {}
289 }
290 }

4 Script and Language


4.1 Script
291 \keys_define:nn {fontspec-opentype}

99
292 {
293 Script .choice: ,
294 Script .groups:n = {opentype} ,
295 }
296 \cs_new:Nn \fontspec_new_script:nn
297 {
298 \keys_define:nn {fontspec-opentype} { Script / #1 .code:n =
299 {
300 ⟨debug⟩\typeout{Trying~[Script=#1]}
301 \bool_set_false:N \l_@@_scriptlang_exist_bool
302 \clist_map_inline:nn {#2}
303 {
304 \exp_args:No \@@_check_script:NnT \l_@@_fontface_cs_tl {####1}
305 {
306 ⟨debug⟩\typeout{Script~tag~found:~####1}
307 \tl_set:Nn \l_@@_script_name_tl {#1}
308 \tl_set:Nn \l_@@_script_tl {####1}
309 \int_set:Nn \l_@@_script_int {\l_@@_strnum_int}
310 \bool_set_true:N \l_@@_scriptlang_exist_bool
311 \tl_gset:Nx \g_@@_single_feat_tl { script=####1 }
312 \clist_map_break:
313 }
314 }
If not found give a warning but load it anyway:
315 \bool_if:NF \l_@@_scriptlang_exist_bool
316 {
317 ⟨debug⟩\typeout{Script~not~found!}
318 \@@_info:nxx {script-not-exist} {\l_fontspec_fontname_tl} {#1}
319 \clist_set:Nn \l_tmpa_clist {#2}
320 \clist_get:NN \l_tmpa_clist \l_@@_script_tl
321 \exp_args:Noo \@@_check_script:NnF \l_@@_fontface_cs_tl \l_@@_script_tl
322 {
323 \tl_set:Nn \l_@@_script_name_tl {#1}
324 \int_set:Nn \l_@@_script_int {\l_@@_strnum_int}
325 \tl_gset:Nx \g_@@_single_feat_tl { script=\l_@@_script_tl }
326 }
327 }
328 }
329 }
330 }
When script is not explicitly requested, use this list:
331 \clist_new:N \g_@@_default_scripts_clist
332 \cs_new:Nn \fontspec_default_script:n
333 {
334 \clist_gset:Nn \g_@@_default_scripts_clist {#1}
335 }
336 \fontspec_default_script:n {latn,DFLT}
337 \keys_define:nn {fontspec-opentype} { Script / CustomDefault .code:n =
338 {
339 ⟨debug⟩\typeout{Trying~CustomDefault~Script}

100
340 \bool_set_false:N \l_@@_scriptlang_exist_bool
341 \clist_map_inline:Nn \g_@@_default_scripts_clist
342 {
343 \exp_args:No \@@_check_script:NnT \l_@@_fontface_cs_tl {##1}
344 {
345 ⟨debug⟩\typeout{Script~tag~found:~##1}
346 \tl_set:Nn \l_@@_script_name_tl {Default (##1)}
347 \tl_set:Nn \l_@@_script_tl {##1}
348 \int_set:Nn \l_@@_script_int {\l_@@_strnum_int}
349 \bool_set_true:N \l_@@_scriptlang_exist_bool
350 \tl_gset:Nx \g_@@_single_feat_tl { script=##1 }
351 \clist_map_break:
352 }
353 }
354 \bool_if:NF \l_@@_scriptlang_exist_bool
355 {
356 ⟨debug⟩\typeout{Script~not~found!}
357 \tl_clear:N \l_@@_script_name_tl
358 }
359 }
360 }

4.2 Language
361 \keys_define:nn {fontspec-opentype}
362 {
363 Language .choice: ,
364 Language .groups:n = {opentype} ,
365 }
366 \cs_new:Nn \fontspec_new_lang:nn
367 {
368 \keys_define:nn {fontspec-opentype} { Language / #1 .code:n =
369 {
370 \bool_set_false:N \l_@@_scriptlang_exist_bool
371 \clist_map_inline:nn {#2}
372 {
373 \exp_args:No \@@_check_lang:NnTF \l_@@_fontface_cs_tl {####1}
374 {
375 \tl_set:Nn \l_@@_lang_tl {####1}
376 \int_set:Nn \l_@@_language_int {\l_@@_strnum_int}
377 \tl_gset:Nx \g_@@_single_feat_tl { language=####1 }
378 \bool_set_true:N \l_@@_scriptlang_exist_bool
379 \clist_map_break:
380 }
381 }
If not found give a warning but load it anyway:
382 \bool_if:NF \l_@@_scriptlang_exist_bool
383 {
384 ⟨debug⟩\typeout{Lang~not~found!}
385 \@@_info:nx {language-not-exist} {#1}
386 \clist_set:Nn \l_tmpa_clist {#2}
387 \clist_get:NN \l_tmpa_clist \l_@@_lang_tl

101
388 \exp_args:Noo \@@_check_lang:NnF \l_@@_fontface_cs_tl \l_@@_lang_tl
389 {
390 \tl_set:Nn \l_@@_lang_name_tl {#1}
391 \int_set:Nn \l_@@_language_int {\l_@@_strnum_int}
392 \tl_gset:Nx \g_@@_single_feat_tl { language=\l_@@_lang_tl }
393 }
394 }
395 }
396 }
397 }
Language=Default These are special-cased to avoid the additional logic above. From mem-
ory, the OpenType default language is hardcoded to have a zero value, although this might be
some XETEX-specific thing.
398 \clist_new:N \g_@@_default_langs_clist
399 \cs_new:Nn \fontspec_default_lang:n
400 {
401 \clist_gset:Nn \g_@@_default_langs_clist {#1}
402 }
403 \fontspec_default_lang:n {dflt}
404 \@@_keys_define_code:nnn {fontspec-opentype} { Language / Default }
405 {
406 \tl_set:Nn \l_@@_lang_tl {dflt}
407 \int_zero:N \l_@@_language_int
408 \tl_gset:Nn \g_@@_single_feat_tl { language=dflt }
409 }

5 Backwards compatibility
410 \cs_new:Nn \@@_ot_compat:nn
411 {
412 \aliasfontfeatureoption {#1} {#2Off} {No#2}
413 }
414 \@@_ot_compat:nn {Ligatures} {Rare}
415 \@@_ot_compat:nn {Ligatures} {Required}
416 \@@_ot_compat:nn {Ligatures} {Common}
417 \@@_ot_compat:nn {Ligatures} {Discretionary}
418 \@@_ot_compat:nn {Ligatures} {Contextual}
419 \@@_ot_compat:nn {Ligatures} {Historic}
420 \@@_ot_compat:nn {Numbers} {SlashedZero}
421 \@@_ot_compat:nn {Contextuals} {Swash}
422 \@@_ot_compat:nn {Contextuals} {Alternate}
423 \@@_ot_compat:nn {Contextuals} {WordInitial}
424 \@@_ot_compat:nn {Contextuals} {WordFinal}
425 \@@_ot_compat:nn {Contextuals} {LineFinal}
426 \@@_ot_compat:nn {Contextuals} {Inner}
427 \@@_ot_compat:nn {Diacritics} {MarkToBase}
428 \@@_ot_compat:nn {Diacritics} {MarkToMark}
429 \@@_ot_compat:nn {Diacritics} {AboveBase}
430 \@@_ot_compat:nn {Diacritics} {BelowBase}

102
File XV
fontspec-code-scripts.dtx
1 Font script definitions
1 \newfontscript{Adlam}{adlm}
2 \newfontscript{Ahom}{ahom}
3 \newfontscript{Anatolian~Hieroglyphs}{hluw}
4 \newfontscript{Arabic}{arab}
5 \newfontscript{Armenian}{armn}
6 \newfontscript{Avestan}{avst}
7 \newfontscript{Balinese}{bali}
8 \newfontscript{Bamum}{bamu}
9 \newfontscript{Bassa~Vah}{bass}
10 \newfontscript{Batak}{batk}
11 \newfontscript{Bengali}{bng2,beng}
12 \newfontscript{Bhaiksuki}{bhks}
13 \newfontscript{Bopomofo}{bopo}
14 \newfontscript{Brahmi}{brah}
15 \newfontscript{Braille}{brai}
16 \newfontscript{Buginese}{bugi}
17 \newfontscript{Buhid}{buhd}
18 \newfontscript{Byzantine~Music}{byzm}
19 \newfontscript{Canadian~Syllabics}{cans}
20 \newfontscript{Carian}{cari}
21 \newfontscript{Caucasian~Albanian}{aghb}
22 \newfontscript{Chakma}{cakm}
23 \newfontscript{Cham}{cham}
24 \newfontscript{Cherokee}{cher}
25 \newfontscript{Chorasmian}{chrs}
26 \newfontscript{CJK~Ideographic}{hani}
27 \newfontscript{Coptic}{copt}
28 \newfontscript{Cypriot~Syllabary}{cprt}
29 \newfontscript{Cypro-Minoan}{cpmn}
30 \newfontscript{Cyrillic}{cyrl}
31 \newfontscript{Default}{DFLT}
32 \newfontscript{Deseret}{dsrt}
33 \newfontscript{Devanagari}{dev2,deva}
34 \newfontscript{Dives~Akuru}{diak}
35 \newfontscript{Dogra}{dogr}
36 \newfontscript{Duployan}{dupl}
37 \newfontscript{Egyptian~Hieroglyphs}{egyp}
38 \newfontscript{Elbasan}{elba}
39 \newfontscript{Elymaic}{elym}
40 \newfontscript{Ethiopic}{ethi}
41 \newfontscript{Georgian}{geor}
42 \newfontscript{Glagolitic}{glag}
43 \newfontscript{Gothic}{goth}
44 \newfontscript{Grantha}{gran}

103
45 \newfontscript{Greek}{grek}
46 \newfontscript{Gujarati}{gjr2,gujr}
47 \newfontscript{Gunjala~Gondi}{gong}
48 \newfontscript{Gurmukhi}{gur2,guru}
49 \newfontscript{Hangul~Jamo}{jamo}
50 \newfontscript{Hangul}{hang}
51 \newfontscript{Hanifi~Rohingya}{rohg}
52 \newfontscript{Hanunoo}{hano}
53 \newfontscript{Hatran}{hatr}
54 \newfontscript{Hebrew}{hebr}
55 \newfontscript{Hiragana~and~Katakana}{kana}
56 \newfontscript{Imperial~Aramaic}{armi}
57 \newfontscript{Inscriptional~Pahlavi}{phli}
58 \newfontscript{Inscriptional~Parthian}{prti}
59 \newfontscript{Javanese}{java}
60 \newfontscript{Kaithi}{kthi}
61 \newfontscript{Kannada}{knd2,knda}
62 \newfontscript{Kawi}{kawi}
63 \newfontscript{Kayah~Li}{kali}
64 \newfontscript{Kharosthi}{khar}
65 \newfontscript{Khitan~Small~Script}{kits}
66 \newfontscript{Khmer}{khmr}
67 \newfontscript{Khojki}{khoj}
68 \newfontscript{Khudawadi}{sind}
69 \newfontscript{Lao}{lao~}
70 \newfontscript{Latin}{latn}
71 \newfontscript{Lepcha}{lepc}
72 \newfontscript{Limbu}{limb}
73 \newfontscript{Linear~A}{lina}
74 \newfontscript{Linear~B}{linb}
75 \newfontscript{Lisu}{lisu}
76 \newfontscript{Lycian}{lyci}
77 \newfontscript{Lydian}{lydi}
78 \newfontscript{Mahajani}{mahj}
79 \newfontscript{Makasar}{maka}
80 \newfontscript{Malayalam}{mlm2,mlym}
81 \newfontscript{Mandaic}{mand}
82 \newfontscript{Manichaean}{mani}
83 \newfontscript{Marchen}{marc}
84 \newfontscript{Masaram~Gondi}{gonm}
85 \newfontscript{Math}{math}
86 \newfontscript{Medefaidrin}{medf}
87 \newfontscript{Meitei~Mayek}{mtei}
88 \newfontscript{Mende~Kikakui}{mend}
89 \newfontscript{Meroitic~Cursive}{merc}
90 \newfontscript{Meroitic~Hieroglyphs}{mero}
91 \newfontscript{Miao}{plrd}
92 \newfontscript{Modi}{modi}
93 \newfontscript{Mongolian}{mong}
94 \newfontscript{Mro}{mroo}
95 \newfontscript{Multani}{mult}

104
96 \newfontscript{Musical~Symbols}{musc}
97 \newfontscript{Myanmar}{mym2,mymr}
98 \newfontscript{N'Ko}{nko~}
99 \newfontscript{Nabataean}{nbat}
100 \newfontscript{Nag~Mundari}{nagm}
101 \newfontscript{Nandinagari}{nand}
102 \newfontscript{Newa}{newa}
103 \newfontscript{Nushu}{nshu}
104 \newfontscript{Nyiakeng~Puachue~Hmong}{hmnp}
105 \newfontscript{Odia}{ory2,orya}
106 \newfontscript{Ogham}{ogam}
107 \newfontscript{Ol~Chiki}{olck}
108 \newfontscript{Old~Italic}{ital}
109 \newfontscript{Old~Hungarian}{hung}
110 \newfontscript{Old~North~Arabian}{narb}
111 \newfontscript{Old~Permic}{perm}
112 \newfontscript{Old~Persian~Cuneiform}{xpeo}
113 \newfontscript{Old~Sogdian}{sogo}
114 \newfontscript{Old~South~Arabian}{sarb}
115 \newfontscript{Old~Turkic}{orkh}
116 \newfontscript{Old~Uyghur}{ougr}
117 \newfontscript{Osage}{osge}
118 \newfontscript{Osmanya}{osma}
119 \newfontscript{Pahawh~Hmong}{hmng}
120 \newfontscript{Palmyrene}{palm}
121 \newfontscript{Pau~Cin~Hau}{pauc}
122 \newfontscript{Phags-pa}{phag}
123 \newfontscript{Phoenician}{phnx}
124 \newfontscript{Psalter~Pahlavi}{phlp}
125 \newfontscript{Rejang}{rjng}
126 \newfontscript{Runic}{runr}
127 \newfontscript{Samaritan}{samr}
128 \newfontscript{Saurashtra}{saur}
129 \newfontscript{Sharada}{shrd}
130 \newfontscript{Shavian}{shaw}
131 \newfontscript{Siddham}{sidd}
132 \newfontscript{Sign~Writing}{sgnw}
133 \newfontscript{Sinhala}{sinh}
134 \newfontscript{Sogdian}{sogd}
135 \newfontscript{Sora~Sompeng}{sora}
136 \newfontscript{Sumero-Akkadian~Cuneiform}{xsux}
137 \newfontscript{Sundanese}{sund}
138 \newfontscript{Syloti~Nagri}{sylo}
139 \newfontscript{Syriac}{syrc}
140 \newfontscript{Tagalog}{tglg}
141 \newfontscript{Tagbanwa}{tagb}
142 \newfontscript{Tai~Le}{tale}
143 \newfontscript{Tai~Lu}{talu}
144 \newfontscript{Tai~Tham}{lana}
145 \newfontscript{Tai~Viet}{tavt}
146 \newfontscript{Takri}{takr}

105
147 \newfontscript{Tamil}{tml2,taml}
148 \newfontscript{Tangsa}{tnsa}
149 \newfontscript{Tangut}{tang}
150 \newfontscript{Telugu}{tel2,telu}
151 \newfontscript{Thaana}{thaa}
152 \newfontscript{Thai}{thai}
153 \newfontscript{Tibetan}{tibt}
154 \newfontscript{Tifinagh}{tfng}
155 \newfontscript{Tirhuta}{tirh}
156 \newfontscript{Toto}{toto}
157 \newfontscript{Ugaritic~Cuneiform}{ugar}
158 \newfontscript{Vai}{vai~}
159 \newfontscript{Vithkuqi}{vith}
160 \newfontscript{Wancho}{wcho}
161 \newfontscript{Warang~Citi}{wara}
162 \newfontscript{Yezidi}{yezi}
163 \newfontscript{Yi}{yi~~}
164 \newfontscript{Zanabazar~Square}{zanb}
For convenience or backwards compatibility:
165 \newfontscript{CJK}{hani}
166 \newfontscript{Kana}{kana}
167 \newfontscript{Maths}{math}
168 \newfontscript{N'ko}{nko~}
169 \newfontscript{Oriya}{ory2,orya}

106
File XVI
fontspec-code-lang.dtx
1 Font language definitions
1 \newfontlanguage{Abaza}{ABA}
2 \newfontlanguage{Abkhazian}{ABK}
3 \newfontlanguage{Adyghe}{ADY}
4 \newfontlanguage{Afrikaans}{AFK}
5 \newfontlanguage{Afar}{AFR}
6 \newfontlanguage{Agaw}{AGW}
7 \newfontlanguage{Altai}{ALT}
8 \newfontlanguage{Amharic}{AMH}
9 \newfontlanguage{Arabic}{ARA}
10 \newfontlanguage{Aari}{ARI}
11 \newfontlanguage{Arakanese}{ARK}
12 \newfontlanguage{Assamese}{ASM}
13 \newfontlanguage{Athapaskan}{ATH}
14 \newfontlanguage{Avar}{AVR}
15 \newfontlanguage{Awadhi}{AWA}
16 \newfontlanguage{Aymara}{AYM}
17 \newfontlanguage{Azeri}{AZE}
18 \newfontlanguage{Badaga}{BAD}
19 \newfontlanguage{Baghelkhandi}{BAG}
20 \newfontlanguage{Balkar}{BAL}
21 \newfontlanguage{Baule}{BAU}
22 \newfontlanguage{Berber}{BBR}
23 \newfontlanguage{Bench}{BCH}
24 \newfontlanguage{Bible~Cree}{BCR}
25 \newfontlanguage{Belarussian}{BEL}
26 \newfontlanguage{Bemba}{BEM}
27 \newfontlanguage{Bengali}{BEN}
28 \newfontlanguage{Bulgarian}{BGR}
29 \newfontlanguage{Bhili}{BHI}
30 \newfontlanguage{Bhojpuri}{BHO}
31 \newfontlanguage{Bikol}{BIK}
32 \newfontlanguage{Bilen}{BIL}
33 \newfontlanguage{Blackfoot}{BKF}
34 \newfontlanguage{Balochi}{BLI}
35 \newfontlanguage{Balante}{BLN}
36 \newfontlanguage{Balti}{BLT}
37 \newfontlanguage{Bambara}{BMB}
38 \newfontlanguage{Bamileke}{BML}
39 \newfontlanguage{Breton}{BRE}
40 \newfontlanguage{Brahui}{BRH}
41 \newfontlanguage{Braj~Bhasha}{BRI}
42 \newfontlanguage{Burmese}{BRM}
43 \newfontlanguage{Bashkir}{BSH}
44 \newfontlanguage{Beti}{BTI}

107
45 \newfontlanguage{Catalan}{CAT}
46 \newfontlanguage{Cebuano}{CEB}
47 \newfontlanguage{Chechen}{CHE}
48 \newfontlanguage{Chaha~Gurage}{CHG}
49 \newfontlanguage{Chattisgarhi}{CHH}
50 \newfontlanguage{Chichewa}{CHI}
51 \newfontlanguage{Chukchi}{CHK}
52 \newfontlanguage{Chipewyan}{CHP}
53 \newfontlanguage{Cherokee}{CHR}
54 \newfontlanguage{Chuvash}{CHU}
55 \newfontlanguage{Comorian}{CMR}
56 \newfontlanguage{Coptic}{COP}
57 \newfontlanguage{Cree}{CRE}
58 \newfontlanguage{Carrier}{CRR}
59 \newfontlanguage{Crimean~Tatar}{CRT}
60 \newfontlanguage{Church~Slavonic}{CSL}
61 \newfontlanguage{Czech}{CSY}
62 \newfontlanguage{Danish}{DAN}
63 \newfontlanguage{Dargwa}{DAR}
64 \newfontlanguage{Woods~Cree}{DCR}
65 \newfontlanguage{German}{DEU}
66 \newfontlanguage{Dogri}{DGR}
67 \newfontlanguage{Divehi}{DIV}
68 \newfontlanguage{Djerma}{DJR}
69 \newfontlanguage{Dangme}{DNG}
70 \newfontlanguage{Dinka}{DNK}
71 \newfontlanguage{Dungan}{DUN}
72 \newfontlanguage{Dzongkha}{DZN}
73 \newfontlanguage{Ebira}{EBI}
74 \newfontlanguage{Eastern~Cree}{ECR}
75 \newfontlanguage{Edo}{EDO}
76 \newfontlanguage{Efik}{EFI}
77 \newfontlanguage{Greek}{ELL}
78 \newfontlanguage{English}{ENG}
79 \newfontlanguage{Erzya}{ERZ}
80 \newfontlanguage{Spanish}{ESP}
81 \newfontlanguage{Estonian}{ETI}
82 \newfontlanguage{Basque}{EUQ}
83 \newfontlanguage{Evenki}{EVK}
84 \newfontlanguage{Even}{EVN}
85 \newfontlanguage{Ewe}{EWE}
86 \newfontlanguage{French~Antillean}{FAN}
87 \newfontlanguage{Farsi}{FAR}
88 \newfontlanguage{Parsi}{FAR}
89 \newfontlanguage{Persian}{FAR}
90 \newfontlanguage{Finnish}{FIN}
91 \newfontlanguage{Fijian}{FJI}
92 \newfontlanguage{Flemish}{FLE}
93 \newfontlanguage{Forest~Nenets}{FNE}
94 \newfontlanguage{Fon}{FON}
95 \newfontlanguage{Faroese}{FOS}

108
96 \newfontlanguage{French}{FRA}
97 \newfontlanguage{Frisian}{FRI}
98 \newfontlanguage{Friulian}{FRL}
99 \newfontlanguage{Futa}{FTA}
100 \newfontlanguage{Fulani}{FUL}
101 \newfontlanguage{Ga}{GAD}
102 \newfontlanguage{Gaelic}{GAE}
103 \newfontlanguage{Gagauz}{GAG}
104 \newfontlanguage{Galician}{GAL}
105 \newfontlanguage{Garshuni}{GAR}
106 \newfontlanguage{Garhwali}{GAW}
107 \newfontlanguage{Ge'ez}{GEZ}
108 \newfontlanguage{Gilyak}{GIL}
109 \newfontlanguage{Gumuz}{GMZ}
110 \newfontlanguage{Gondi}{GON}
111 \newfontlanguage{Greenlandic}{GRN}
112 \newfontlanguage{Garo}{GRO}
113 \newfontlanguage{Guarani}{GUA}
114 \newfontlanguage{Gujarati}{GUJ}
115 \newfontlanguage{Haitian}{HAI}
116 \newfontlanguage{Halam}{HAL}
117 \newfontlanguage{Harauti}{HAR}
118 \newfontlanguage{Hausa}{HAU}
119 \newfontlanguage{Hawaiin}{HAW}
120 \newfontlanguage{Hammer-Banna}{HBN}
121 \newfontlanguage{Hiligaynon}{HIL}
122 \newfontlanguage{Hindi}{HIN}
123 \newfontlanguage{High~Mari}{HMA}
124 \newfontlanguage{Hindko}{HND}
125 \newfontlanguage{Ho}{HO}
126 \newfontlanguage{Harari}{HRI}
127 \newfontlanguage{Croatian}{HRV}
128 \newfontlanguage{Hungarian}{HUN}
129 \newfontlanguage{Armenian}{HYE}
130 \newfontlanguage{Igbo}{IBO}
131 \newfontlanguage{Ijo}{IJO}
132 \newfontlanguage{Ilokano}{ILO}
133 \newfontlanguage{Indonesian}{IND}
134 \newfontlanguage{Ingush}{ING}
135 \newfontlanguage{Inuktitut}{INU}
136 \newfontlanguage{Irish}{IRI}
137 \newfontlanguage{Irish~Traditional}{IRT}
138 \newfontlanguage{Icelandic}{ISL}
139 \newfontlanguage{Inari~Sami}{ISM}
140 \newfontlanguage{Italian}{ITA}
141 \newfontlanguage{Hebrew}{IWR}
142 \newfontlanguage{Javanese}{JAV}
143 \newfontlanguage{Yiddish}{JII}
144 \newfontlanguage{Japanese}{JAN}
145 \newfontlanguage{Judezmo}{JUD}
146 \newfontlanguage{Jula}{JUL}

109
147 \newfontlanguage{Kabardian}{KAB}
148 \newfontlanguage{Kachchi}{KAC}
149 \newfontlanguage{Kalenjin}{KAL}
150 \newfontlanguage{Kannada}{KAN}
151 \newfontlanguage{Karachay}{KAR}
152 \newfontlanguage{Georgian}{KAT}
153 \newfontlanguage{Kazakh}{KAZ}
154 \newfontlanguage{Kebena}{KEB}
155 \newfontlanguage{Khutsuri~Georgian}{KGE}
156 \newfontlanguage{Khakass}{KHA}
157 \newfontlanguage{Khanty-Kazim}{KHK}
158 \newfontlanguage{Khmer}{KHM}
159 \newfontlanguage{Khanty-Shurishkar}{KHS}
160 \newfontlanguage{Khanty-Vakhi}{KHV}
161 \newfontlanguage{Khowar}{KHW}
162 \newfontlanguage{Kikuyu}{KIK}
163 \newfontlanguage{Kirghiz}{KIR}
164 \newfontlanguage{Kisii}{KIS}
165 \newfontlanguage{Kokni}{KKN}
166 \newfontlanguage{Kalmyk}{KLM}
167 \newfontlanguage{Kamba}{KMB}
168 \newfontlanguage{Kumaoni}{KMN}
169 \newfontlanguage{Komo}{KMO}
170 \newfontlanguage{Komso}{KMS}
171 \newfontlanguage{Kanuri}{KNR}
172 \newfontlanguage{Kodagu}{KOD}
173 \newfontlanguage{Korean~Old~Hangul}{KOH}
174 \newfontlanguage{Konkani}{KOK}
175 \newfontlanguage{Kikongo}{KON}
176 \newfontlanguage{Komi-Permyak}{KOP}
177 \newfontlanguage{Korean}{KOR}
178 \newfontlanguage{Komi-Zyrian}{KOZ}
179 \newfontlanguage{Kpelle}{KPL}
180 \newfontlanguage{Krio}{KRI}
181 \newfontlanguage{Karakalpak}{KRK}
182 \newfontlanguage{Karelian}{KRL}
183 \newfontlanguage{Karaim}{KRM}
184 \newfontlanguage{Karen}{KRN}
185 \newfontlanguage{Koorete}{KRT}
186 \newfontlanguage{Kashmiri}{KSH}
187 \newfontlanguage{Khasi}{KSI}
188 \newfontlanguage{Kildin~Sami}{KSM}
189 \newfontlanguage{Kui}{KUI}
190 \newfontlanguage{Kulvi}{KUL}
191 \newfontlanguage{Kumyk}{KUM}
192 \newfontlanguage{Kurdish}{KUR}
193 \newfontlanguage{Kurukh}{KUU}
194 \newfontlanguage{Kuy}{KUY}
195 \newfontlanguage{Koryak}{KYK}
196 \newfontlanguage{Ladin}{LAD}
197 \newfontlanguage{Lahuli}{LAH}

110
198 \newfontlanguage{Lak}{LAK}
199 \newfontlanguage{Lambani}{LAM}
200 \newfontlanguage{Lao}{LAO}
201 \newfontlanguage{Latin}{LAT}
202 \newfontlanguage{Laz}{LAZ}
203 \newfontlanguage{L-Cree}{LCR}
204 \newfontlanguage{Ladakhi}{LDK}
205 \newfontlanguage{Lezgi}{LEZ}
206 \newfontlanguage{Lingala}{LIN}
207 \newfontlanguage{Low~Mari}{LMA}
208 \newfontlanguage{Limbu}{LMB}
209 \newfontlanguage{Lomwe}{LMW}
210 \newfontlanguage{Lower~Sorbian}{LSB}
211 \newfontlanguage{Lule~Sami}{LSM}
212 \newfontlanguage{Lithuanian}{LTH}
213 \newfontlanguage{Luba}{LUB}
214 \newfontlanguage{Luganda}{LUG}
215 \newfontlanguage{Luhya}{LUH}
216 \newfontlanguage{Luo}{LUO}
217 \newfontlanguage{Latvian}{LVI}
218 \newfontlanguage{Majang}{MAJ}
219 \newfontlanguage{Makua}{MAK}
220 \newfontlanguage{Malayalam~Traditional}{MAL}
221 \newfontlanguage{Mansi}{MAN}
222 \newfontlanguage{Marathi}{MAR}
223 \newfontlanguage{Marwari}{MAW}
224 \newfontlanguage{Mbundu}{MBN}
225 \newfontlanguage{Manchu}{MCH}
226 \newfontlanguage{Moose~Cree}{MCR}
227 \newfontlanguage{Mende}{MDE}
228 \newfontlanguage{Me'en}{MEN}
229 \newfontlanguage{Mizo}{MIZ}
230 \newfontlanguage{Macedonian}{MKD}
231 \newfontlanguage{Male}{MLE}
232 \newfontlanguage{Malagasy}{MLG}
233 \newfontlanguage{Malinke}{MLN}
234 \newfontlanguage{Malayalam~Reformed}{MLR}
235 \newfontlanguage{Malay}{MLY}
236 \newfontlanguage{Mandinka}{MND}
237 \newfontlanguage{Mongolian}{MNG}
238 \newfontlanguage{Manipuri}{MNI}
239 \newfontlanguage{Maninka}{MNK}
240 \newfontlanguage{Manx~Gaelic}{MNX}
241 \newfontlanguage{Moksha}{MOK}
242 \newfontlanguage{Moldavian}{MOL}
243 \newfontlanguage{Mon}{MON}
244 \newfontlanguage{Moroccan}{MOR}
245 \newfontlanguage{Maori}{MRI}
246 \newfontlanguage{Maithili}{MTH}
247 \newfontlanguage{Maltese}{MTS}
248 \newfontlanguage{Mundari}{MUN}

111
249 \newfontlanguage{Naga-Assamese}{NAG}
250 \newfontlanguage{Nanai}{NAN}
251 \newfontlanguage{Naskapi}{NAS}
252 \newfontlanguage{N-Cree}{NCR}
253 \newfontlanguage{Ndebele}{NDB}
254 \newfontlanguage{Ndonga}{NDG}
255 \newfontlanguage{Nepali}{NEP}
256 \newfontlanguage{Newari}{NEW}
257 \newfontlanguage{Nagari}{NGR}
258 \newfontlanguage{Norway~House~Cree}{NHC}
259 \newfontlanguage{Nisi}{NIS}
260 \newfontlanguage{Niuean}{NIU}
261 \newfontlanguage{Nkole}{NKL}
262 \newfontlanguage{N'ko}{NKO}
263 \newfontlanguage{Dutch}{NLD}
264 \newfontlanguage{Nogai}{NOG}
265 \newfontlanguage{Norwegian}{NOR}
266 \newfontlanguage{Northern~Sami}{NSM}
267 \newfontlanguage{Northern~Tai}{NTA}
268 \newfontlanguage{Esperanto}{NTO}
269 \newfontlanguage{Nynorsk}{NYN}
270 \newfontlanguage{Oji-Cree}{OCR}
271 \newfontlanguage{Ojibway}{OJB}
272 \newfontlanguage{Oriya}{ORI}
273 \newfontlanguage{Oromo}{ORO}
274 \newfontlanguage{Ossetian}{OSS}
275 \newfontlanguage{Palestinian~Aramaic}{PAA}
276 \newfontlanguage{Pali}{PAL}
277 \newfontlanguage{Punjabi}{PAN}
278 \newfontlanguage{Palpa}{PAP}
279 \newfontlanguage{Pashto}{PAS}
280 \newfontlanguage{Polytonic~Greek}{PGR}
281 \newfontlanguage{Pilipino}{PIL}
282 \newfontlanguage{Palaung}{PLG}
283 \newfontlanguage{Polish}{PLK}
284 \newfontlanguage{Provencal}{PRO}
285 \newfontlanguage{Portuguese}{PTG}
286 \newfontlanguage{Chin}{QIN}
287 \newfontlanguage{Rajasthani}{RAJ}
288 \newfontlanguage{R-Cree}{RCR}
289 \newfontlanguage{Russian~Buriat}{RBU}
290 \newfontlanguage{Riang}{RIA}
291 \newfontlanguage{Rhaeto-Romanic}{RMS}
292 \newfontlanguage{Romanian}{ROM}
293 \newfontlanguage{Romany}{ROY}
294 \newfontlanguage{Rusyn}{RSY}
295 \newfontlanguage{Ruanda}{RUA}
296 \newfontlanguage{Russian}{RUS}
297 \newfontlanguage{Sadri}{SAD}
298 \newfontlanguage{Sanskrit}{SAN}
299 \newfontlanguage{Santali}{SAT}

112
300 \newfontlanguage{Sayisi}{SAY}
301 \newfontlanguage{Sekota}{SEK}
302 \newfontlanguage{Selkup}{SEL}
303 \newfontlanguage{Sango}{SGO}
304 \newfontlanguage{Shan}{SHN}
305 \newfontlanguage{Sibe}{SIB}
306 \newfontlanguage{Sidamo}{SID}
307 \newfontlanguage{Silte~Gurage}{SIG}
308 \newfontlanguage{Skolt~Sami}{SKS}
309 \newfontlanguage{Slovak}{SKY}
310 \newfontlanguage{Slavey}{SLA}
311 \newfontlanguage{Slovenian}{SLV}
312 \newfontlanguage{Somali}{SML}
313 \newfontlanguage{Samoan}{SMO}
314 \newfontlanguage{Sena}{SNA}
315 \newfontlanguage{Sindhi}{SND}
316 \newfontlanguage{Sinhalese}{SNH}
317 \newfontlanguage{Soninke}{SNK}
318 \newfontlanguage{Sodo~Gurage}{SOG}
319 \newfontlanguage{Sotho}{SOT}
320 \newfontlanguage{Albanian}{SQI}
321 \newfontlanguage{Serbian}{SRB}
322 \newfontlanguage{Saraiki}{SRK}
323 \newfontlanguage{Serer}{SRR}
324 \newfontlanguage{South~Slavey}{SSL}
325 \newfontlanguage{Southern~Sami}{SSM}
326 \newfontlanguage{Suri}{SUR}
327 \newfontlanguage{Svan}{SVA}
328 \newfontlanguage{Swedish}{SVE}
329 \newfontlanguage{Swadaya~Aramaic}{SWA}
330 \newfontlanguage{Swahili}{SWK}
331 \newfontlanguage{Swazi}{SWZ}
332 \newfontlanguage{Sutu}{SXT}
333 \newfontlanguage{Syriac}{SYR}
334 \newfontlanguage{Tabasaran}{TAB}
335 \newfontlanguage{Tajiki}{TAJ}
336 \newfontlanguage{Tamil}{TAM}
337 \newfontlanguage{Tatar}{TAT}
338 \newfontlanguage{TH-Cree}{TCR}
339 \newfontlanguage{Telugu}{TEL}
340 \newfontlanguage{Tongan}{TGN}
341 \newfontlanguage{Tigre}{TGR}
342 \newfontlanguage{Tigrinya}{TGY}
343 \newfontlanguage{Thai}{THA}
344 \newfontlanguage{Tahitian}{THT}
345 \newfontlanguage{Tibetan}{TIB}
346 \newfontlanguage{Turkish}{TRK,TUR}
347 \newfontlanguage{Turkmen}{TKM}
348 \newfontlanguage{Temne}{TMN}
349 \newfontlanguage{Tswana}{TNA}
350 \newfontlanguage{Tundra~Nenets}{TNE}

113
351 \newfontlanguage{Tonga}{TNG}
352 \newfontlanguage{Todo}{TOD}
353 \newfontlanguage{Tsonga}{TSG}
354 \newfontlanguage{Turoyo~Aramaic}{TUA}
355 \newfontlanguage{Tulu}{TUL}
356 \newfontlanguage{Tuvin}{TUV}
357 \newfontlanguage{Twi}{TWI}
358 \newfontlanguage{Udmurt}{UDM}
359 \newfontlanguage{Ukrainian}{UKR}
360 \newfontlanguage{Urdu}{URD}
361 \newfontlanguage{Upper~Sorbian}{USB}
362 \newfontlanguage{Uyghur}{UYG}
363 \newfontlanguage{Uzbek}{UZB}
364 \newfontlanguage{Venda}{VEN}
365 \newfontlanguage{Vietnamese}{VIT}
366 \newfontlanguage{Wa}{WA}
367 \newfontlanguage{Wagdi}{WAG}
368 \newfontlanguage{West-Cree}{WCR}
369 \newfontlanguage{Welsh}{WEL}
370 \newfontlanguage{Wolof}{WLF}
371 \newfontlanguage{Tai~Lue}{XBD}
372 \newfontlanguage{Xhosa}{XHS}
373 \newfontlanguage{Yakut}{YAK}
374 \newfontlanguage{Yoruba}{YBA}
375 \newfontlanguage{Y-Cree}{YCR}
376 \newfontlanguage{Yi~Classic}{YIC}
377 \newfontlanguage{Yi~Modern}{YIM}
378 \newfontlanguage{Chinese~Hong~Kong}{ZHH}
379 \newfontlanguage{Chinese~Phonetic}{ZHP}
380 \newfontlanguage{Chinese~Simplified}{ZHS}
381 \newfontlanguage{Chinese~Traditional}{ZHT}
382 \newfontlanguage{Zande}{ZND}
383 \newfontlanguage{Zulu}{ZUL}

114
File XVII
fontspec-code-feat-aat.dtx
1 AAT feature definitions
These are only defined for XETEX.

1.1 Ligatures
1 \@@_define_aat_feature_group:n {Ligatures}
2 \@@_define_aat_feature:nnnn {Ligatures} {Required} {1} {0}
3 \@@_define_aat_feature:nnnn {Ligatures} {NoRequired} {1} {1}
4 \@@_define_aat_feature:nnnn {Ligatures} {Common} {1} {2}
5 \@@_define_aat_feature:nnnn {Ligatures} {NoCommon} {1} {3}
6 \@@_define_aat_feature:nnnn {Ligatures} {Rare} {1} {4}
7 \@@_define_aat_feature:nnnn {Ligatures} {NoRare} {1} {5}
8 \@@_define_aat_feature:nnnn {Ligatures} {Discretionary} {1} {4}
9 \@@_define_aat_feature:nnnn {Ligatures} {NoDiscretionary} {1} {5}
10 \@@_define_aat_feature:nnnn {Ligatures} {Logos} {1} {6}
11 \@@_define_aat_feature:nnnn {Ligatures} {NoLogos} {1} {7}
12 \@@_define_aat_feature:nnnn {Ligatures} {Rebus} {1} {8}
13 \@@_define_aat_feature:nnnn {Ligatures} {NoRebus} {1} {9}
14 \@@_define_aat_feature:nnnn {Ligatures} {Diphthong} {1} {10}
15 \@@_define_aat_feature:nnnn {Ligatures} {NoDiphthong} {1} {11}
16 \@@_define_aat_feature:nnnn {Ligatures} {Squared} {1} {12}
17 \@@_define_aat_feature:nnnn {Ligatures} {NoSquared} {1} {13}
18 \@@_define_aat_feature:nnnn {Ligatures} {AbbrevSquared} {1} {14}
19 \@@_define_aat_feature:nnnn {Ligatures} {NoAbbrevSquared} {1} {15}
20 \@@_define_aat_feature:nnnn {Ligatures} {Icelandic} {1} {32}
21 \@@_define_aat_feature:nnnn {Ligatures} {NoIcelandic} {1} {33}
Emulate CM extra ligatures.
22 \keys_define:nn {fontspec-aat}
23 {
24 Ligatures / TeX .code:n =
25 {
26 \tl_set:Nn \l_@@_mapping_tl { tex-text }
27 }
28 }
1.2 Letters
29 \@@_define_aat_feature_group:n {Letters}
30 \@@_define_aat_feature:nnnn {Letters} {Normal} {3} {0}
31 \@@_define_aat_feature:nnnn {Letters} {Uppercase} {3} {1}
32 \@@_define_aat_feature:nnnn {Letters} {Lowercase} {3} {2}
33 \@@_define_aat_feature:nnnn {Letters} {SmallCaps} {3} {3}
34 \@@_define_aat_feature:nnnn {Letters} {InitialCaps} {3} {4}

115
1.3 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.
35 \@@_define_aat_feature_group:n {Numbers}
36 \@@_define_aat_feature:nnnn {Numbers} {Monospaced} {6} {0}
37 \@@_define_aat_feature:nnnn {Numbers} {Proportional} {6} {1}
38 \@@_define_aat_feature:nnnn {Numbers} {Lowercase} {21} {0}
39 \@@_define_aat_feature:nnnn {Numbers} {OldStyle} {21} {0}
40 \@@_define_aat_feature:nnnn {Numbers} {Uppercase} {21} {1}
41 \@@_define_aat_feature:nnnn {Numbers} {Lining} {21} {1}
42 \@@_define_aat_feature:nnnn {Numbers} {SlashedZero} {14} {5}
43 \@@_define_aat_feature:nnnn {Numbers} {NoSlashedZero} {14} {4}

1.4 Contextuals
44 \@@_define_aat_feature_group:n {Contextuals}
45 \@@_define_aat_feature:nnnn {Contextuals} {WordInitial} {8} {0}
46 \@@_define_aat_feature:nnnn {Contextuals} {NoWordInitial} {8} {1}
47 \@@_define_aat_feature:nnnn {Contextuals} {WordFinal} {8} {2}
48 \@@_define_aat_feature:nnnn {Contextuals} {NoWordFinal} {8} {3}
49 \@@_define_aat_feature:nnnn {Contextuals} {LineInitial} {8} {4}
50 \@@_define_aat_feature:nnnn {Contextuals} {NoLineInitial} {8} {5}
51 \@@_define_aat_feature:nnnn {Contextuals} {LineFinal} {8} {6}
52 \@@_define_aat_feature:nnnn {Contextuals} {NoLineFinal} {8} {7}
53 \@@_define_aat_feature:nnnn {Contextuals} {Inner} {8} {8}
54 \@@_define_aat_feature:nnnn {Contextuals} {NoInner} {8} {9}

1.5 Diacritics
55 \@@_define_aat_feature_group:n {Diacritics}
56 \@@_define_aat_feature:nnnn {Diacritics} {Show} {9} {0}
57 \@@_define_aat_feature:nnnn {Diacritics} {Hide} {9} {1}
58 \@@_define_aat_feature:nnnn {Diacritics} {Decompose} {9} {2}

1.6 Vertical position


59 \@@_define_aat_feature_group:n {VerticalPosition}
60 \@@_define_aat_feature:nnnn {VerticalPosition} {Normal} {10} {0}
61 \@@_define_aat_feature:nnnn {VerticalPosition} {Superior} {10} {1}
62 \@@_define_aat_feature:nnnn {VerticalPosition} {Inferior} {10} {2}
63 \@@_define_aat_feature:nnnn {VerticalPosition} {Ordinal} {10} {3}

1.7 Fractions
64 \@@_define_aat_feature_group:n {Fractions}
65 \@@_define_aat_feature:nnnn {Fractions} {On} {11} {1}
66 \@@_define_aat_feature:nnnn {Fractions} {Off} {11} {0}
67 \@@_define_aat_feature:nnnn {Fractions} {Diagonal} {11} {2}

1.8 Alternate
68 \@@_define_aat_feature_group:n { Alternate }

116
69 \keys_define:nn {fontspec-aat}
70 {
71 Alternate .default:n = {0} ,
72 Alternate / unknown .code:n =
73 {
74 \clist_map_inline:nn {#1}
75 {
76 \@@_make_AAT_feature:nn {17}{##1}
77 }
78 }
79 }

1.9 Variant / StylisticSet


80 \@@_define_aat_feature_group:n {Variant}
81 \keys_define:nn {fontspec-aat}
82 {
83 Variant .default:n = {0} ,
84 Variant / unknown .code:n =
85 {
86 \clist_map_inline:nn {#1}
87 { \@@_make_AAT_feature:nn {18}{##1} }
88 }
89 }
90 \aliasfontfeature{Variant}{StylisticSet}
91 \@@_define_aat_feature_group:n {Vertical}
92 \keys_define:nn {fontspec-aat}
93 {
94 Vertical .choice: ,
95 Vertical / RotatedGlyphs .code:n =
96 {
97 \__fontspec_update_featstr:n {vertical}
98 }
99 }

1.10 Style
100 \@@_define_aat_feature_group:n {Style}
101 \@@_define_aat_feature:nnnn {Style} {Italic} {32} {2}
102 \@@_define_aat_feature:nnnn {Style} {Ruby} {28} {2}
103 \@@_define_aat_feature:nnnn {Style} {Display} {19} {1}
104 \@@_define_aat_feature:nnnn {Style} {Engraved} {19} {2}
105 \@@_define_aat_feature:nnnn {Style} {Titling} {19} {4}
106 \@@_define_aat_feature:nnnn {Style} {TitlingCaps} {19} {4} % backwards compat
107 \@@_define_aat_feature:nnnn {Style} {TallCaps} {19} {5}

1.11 CJK shape


108 \@@_define_aat_feature_group:n {CJKShape}
109 \@@_define_aat_feature:nnnn {CJKShape} {Traditional} {20} {0}
110 \@@_define_aat_feature:nnnn {CJKShape} {Simplified} {20} {1}
111 \@@_define_aat_feature:nnnn {CJKShape} {JIS1978} {20} {2}
112 \@@_define_aat_feature:nnnn {CJKShape} {JIS1983} {20} {3}

117
113 \@@_define_aat_feature:nnnn {CJKShape} {JIS1990} {20} {4}
114 \@@_define_aat_feature:nnnn {CJKShape} {Expert} {20} {10}
115 \@@_define_aat_feature:nnnn {CJKShape} {NLC} {20} {13}

1.12 Character width


116 \@@_define_aat_feature_group:n {CharacterWidth}
117 \@@_define_aat_feature:nnnn {CharacterWidth} {Proportional} {22} {0}
118 \@@_define_aat_feature:nnnn {CharacterWidth} {Full} {22} {1}
119 \@@_define_aat_feature:nnnn {CharacterWidth} {Half} {22} {2}
120 \@@_define_aat_feature:nnnn {CharacterWidth} {Third} {22} {3}
121 \@@_define_aat_feature:nnnn {CharacterWidth} {Quarter} {22} {4}
122 \@@_define_aat_feature:nnnn {CharacterWidth} {AlternateProportional} {22} {5}
123 \@@_define_aat_feature:nnnn {CharacterWidth} {AlternateHalf} {22} {6}
124 \@@_define_aat_feature:nnnn {CharacterWidth} {Default} {22} {7}

1.13 Annotation
125 \@@_define_aat_feature_group:n {Annotation}
126 \@@_define_aat_feature:nnnn {Annotation} {Off} {24} {0}
127 \@@_define_aat_feature:nnnn {Annotation} {Box} {24} {1}
128 \@@_define_aat_feature:nnnn {Annotation} {RoundedBox} {24} {2}
129 \@@_define_aat_feature:nnnn {Annotation} {Circle} {24} {3}
130 \@@_define_aat_feature:nnnn {Annotation} {BlackCircle} {24} {4}
131 \@@_define_aat_feature:nnnn {Annotation} {Parenthesis} {24} {5}
132 \@@_define_aat_feature:nnnn {Annotation} {Period} {24} {6}
133 \@@_define_aat_feature:nnnn {Annotation} {RomanNumerals} {24} {7}
134 \@@_define_aat_feature:nnnn {Annotation} {Diamond} {24} {8}
135 \@@_define_aat_feature:nnnn {Annotation} {BlackSquare} {24} {9}
136 \@@_define_aat_feature:nnnn {Annotation} {BlackRoundSquare} {24} {10}
137 \@@_define_aat_feature:nnnn {Annotation} {DoubleCircle} {24} {11}

118
File XVIII
fontspec-code-enc.dtx
1 Extended font encodings
\EncodingCommand
1 \DeclareDocumentCommand \EncodingCommand { m O{} O{} m }
2 {
3 \bool_if:NF \l_@@_defining_encoding_bool
4 { \@@_error:nn {only-inside-encdef} \EncodingCommand }
5 \DeclareTextCommand{#1}{\UnicodeEncodingName}[#2][#3]{#4}
6 }
(End of definition for \EncodingCommand. This function is documented on page ??.)

\EncodingAccent
7 \DeclareDocumentCommand \EncodingAccent {mm}
8 {
9 \bool_if:NF \l_@@_defining_encoding_bool
10 { \@@_error:nn {only-inside-encdef} \EncodingAccent }
11 \DeclareTextCommand{#1}{\UnicodeEncodingName}{\add@unicode@accent{#2}}
12 }
(End of definition for \EncodingAccent. This function is documented on page ??.)

\EncodingSymbol
13 \DeclareDocumentCommand \EncodingSymbol {mm}
14 {
15 \bool_if:NF \l_@@_defining_encoding_bool
16 { \@@_error:nn {only-inside-encdef} \EncodingSymbol }
17 \DeclareTextSymbol{#1}{\UnicodeEncodingName}{#2}
18 }
(End of definition for \EncodingSymbol. This function is documented on page ??.)

\EncodingComposite
19 \DeclareDocumentCommand \EncodingComposite {mmm}
20 {
21 \bool_if:NF \l_@@_defining_encoding_bool
22 { \@@_error:nn {only-inside-encdef} \EncodingComposite }
23 \DeclareTextComposite{#1}{\UnicodeEncodingName}{#2}{#3}
24 }
(End of definition for \EncodingComposite. This function is documented on page ??.)

\EncodingCompositeCommand
25 \DeclareDocumentCommand \EncodingCompositeCommand {mmm}
26 {
27 \bool_if:NF \l_@@_defining_encoding_bool
28 { \@@_error:nn {only-inside-encdef} \EncodingCompositeCommand }
29 \DeclareTextCompositeCommand{#1}{\UnicodeEncodingName}{#2}{#3}
30 }

119
(End of definition for \EncodingCompositeCommand. This function is documented on page ??.)

\DeclareUnicodeEncoding
31 \DeclareDocumentCommand \DeclareUnicodeEncoding {mm}
32 {
33 \DeclareFontEncoding{#1}{}{}
34 \DeclareFontSubstitution{#1}{lmr}{m}{n}
35 \DeclareFontFamily{#1}{lmr}{}
36

37 \DeclareFontShape{#1}{lmr}{m}{n}
38 {<->\UnicodeFontFile{lmroman10-regular}{\UnicodeFontTeXLigatures}}{}
39 \DeclareFontShape{#1}{lmr}{m}{it}
40 {<->\UnicodeFontFile{lmroman10-italic}{\UnicodeFontTeXLigatures}}{}
41 \DeclareFontShape{#1}{lmr}{m}{sc}
42 {<->\UnicodeFontFile{lmromancaps10-regular}{\UnicodeFontTeXLigatures}}{}
43 \DeclareFontShape{#1}{lmr}{bx}{n}
44 {<->\UnicodeFontFile{lmroman10-bold}{\UnicodeFontTeXLigatures}}{}
45 \DeclareFontShape{#1}{lmr}{bx}{it}
46 {<->\UnicodeFontFile{lmroman10-bolditalic}{\UnicodeFontTeXLigatures}}{}
47

48 \tl_set_eq:NN \l_@@_prev_unicode_name_tl \UnicodeEncodingName


49 \tl_set:Nn \UnicodeEncodingName {#1}
50 \bool_set_true:N \l_@@_defining_encoding_bool
51 #2
52 \bool_set_false:N \l_@@_defining_encoding_bool
53 \tl_set_eq:NN \UnicodeEncodingName \l_@@_prev_unicode_name_tl
54 }

(End of definition for \DeclareUnicodeEncoding. This function is documented on page ??.)

\UndeclareSymbol Synonyms for each other but all included for completeness.
\UndeclareAccent 55 \DeclareDocumentCommand \UndeclareSymbol {m}
\UndeclareCommand 56 {
57 \bool_if:NF \l_@@_defining_encoding_bool
58 { \@@_error:nn {only-inside-encdef} \UndeclareSymbol }
59 \UndeclareTextCommand {#1} {\UnicodeEncodingName}
60 }
61 \DeclareDocumentCommand \UndeclareAccent {m}
62 {
63 \bool_if:NF \l_@@_defining_encoding_bool
64 { \@@_error:nn {only-inside-encdef} \UndeclareAccent }
65 \UndeclareTextCommand {#1} {\UnicodeEncodingName}
66 }
67 \DeclareDocumentCommand \UndeclareCommand {m}
68 {
69 \bool_if:NF \l_@@_defining_encoding_bool
70 { \@@_error:nn {only-inside-encdef} \UndeclareCommand }
71 \UndeclareTextCommand {#1} {\UnicodeEncodingName}
72 }

(End of definition for \UndeclareSymbol , \UndeclareAccent , and \UndeclareCommand. These functions are docu-
mented on page ??.)

120
\UndeclareComposite
73 \DeclareDocumentCommand \UndeclareComposite {mm}
74 {
75 \bool_if:NF \l_@@_defining_encoding_bool
76 { \@@_error:nn {only-inside-encdef} \UndeclareComposite }
77 \cs_undefine:c
78 { \c_backslash_str \UnicodeEncodingName \token_to_str:N #1 - \tl_to_str:n {#2} }
79 }

(End of definition for \UndeclareComposite. This function is documented on page ??.)

121
File XIX
fontspec-code-math.dtx
1 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 \setmainfont and friends was run.

\fontspec_setup_maths: Everything here is performed \AtBeginDocument in order to overwrite euler’s attempt. This
means fontspec must be loaded after euler. We set up a conditional to return an error if this
rule is violated.
Since every maths setup is slightly different, we also take different paths for defining
various math glyphs depending which maths font package has been loaded.
1 \@ifpackageloaded{euler}
2 { \bool_gset_true:N \g_@@_pkg_euler_loaded_bool }
3 { \bool_gset_false:N \g_@@_pkg_euler_loaded_bool }
4 \cs_new:Nn \fontspec_setup_maths:
5 {
6 \@ifpackageloaded{euler}
7 {
8 \bool_if:NTF \g_@@_pkg_euler_loaded_bool
9 { \bool_gset_true:N \g_@@_math_euler_bool }
10 { \@@_error:n {euler-too-late} }
11 }
12 {}
13 \@ifpackageloaded{lucbmath}{ \bool_gset_true:N \g_@@_math_lucida_bool }{}
14 \@ifpackageloaded{lucidabr}{ \bool_gset_true:N \g_@@_math_lucida_bool }{}
15 \@ifpackageloaded{lucimatx}{ \bool_gset_true:N \g_@@_math_lucida_bool }{}
Knuth’s CM fonts fonts are all squashed together, combining letters, accents, text symbols
and maths symbols all in the one font, cmr, plus other things in other fonts. Because we
are changing the roman font in the document, we need to redefine all of the maths glyphs
in LATEX’s operators maths font to still go back to the legacy cmr font for all these random
glyphs, unless a separate maths font package has been loaded instead.
In every case, the maths accents are always taken from the operators font, which is
generally the main text font. (Actually, there is a \hat accent in EulerFractur, but it’s ugly.
So I ignore it. Sorry if this causes inconvenience.)
16 \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n}
17 \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n}
18 \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19}
19 \DeclareMathAccent{\grave} {\mathalpha}{legacymaths}{18}
20 \DeclareMathAccent{\ddot} {\mathalpha}{legacymaths}{127}
21 \DeclareMathAccent{\tilde} {\mathalpha}{legacymaths}{126}
22 \DeclareMathAccent{\bar} {\mathalpha}{legacymaths}{22}
23 \DeclareMathAccent{\breve} {\mathalpha}{legacymaths}{21}
24 \DeclareMathAccent{\check} {\mathalpha}{legacymaths}{20}
25 \DeclareMathAccent{\hat} {\mathalpha}{legacymaths}{94} % too bad, euler

122
26 \DeclareMathAccent{\dot} {\mathalpha}{legacymaths}{95}
27 \DeclareMathAccent{\mathring}{\mathalpha}{legacymaths}{23}

\colon: what’s going on? Okay, so : and \colon in maths mode are defined in a few places,
so I need to work out what does what. Respectively, we have:

% % fontmath.ltx:
% \DeclareMathSymbol{\colon}{\mathpunct}{operators}{"3A}
% \DeclareMathSymbol{:}{\mathrel}{operators}{"3A}
%
% % amsmath.sty:
% \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
% \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
%
% % euler.sty:
% \DeclareMathSymbol{:}\mathrel {EulerFraktur}{"3A}
%
% % lucbmath.sty:
% \DeclareMathSymbol{\@tempb}{\mathpunct}{operators}{58}
% \ifx\colon\@tempb
% \DeclareMathSymbol{\colon}{\mathpunct}{operators}{58}
% \fi
% \DeclareMathSymbol{:}{\mathrel}{operators}{58}

(3A16 = 5810 ) So I think, based on this summary, that it is fair to tell fontspec to ‘replace’
the operators font with legacymaths for this symbol, except when amsmath is loaded since we
want to keep its definition.
28 \group_begin:
29 \mathchardef\@tempa="603A \relax
30 \ifx\colon\@tempa
31 \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58}
32 \fi
33 \group_end:
The following symbols are only defined specifically in euler, so skip them if that package is
loaded.
34 \bool_if:NF \g_@@_math_euler_bool
35 {
36 \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33}
37 \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58}
38 \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59}
39 \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63}
And these ones are defined both in euler and lucbmath, so we only need to run this code if no
extra maths package has been loaded.
40 \bool_if:NF \g_@@_math_lucida_bool
41 {
42 \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0}
43 \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1}
44 \DeclareMathSymbol{2}{\mathalpha}{legacymaths}{`2}

123
45 \DeclareMathSymbol{3}{\mathalpha}{legacymaths}{`3}
46 \DeclareMathSymbol{4}{\mathalpha}{legacymaths}{`4}
47 \DeclareMathSymbol{5}{\mathalpha}{legacymaths}{`5}
48 \DeclareMathSymbol{6}{\mathalpha}{legacymaths}{`6}
49 \DeclareMathSymbol{7}{\mathalpha}{legacymaths}{`7}
50 \DeclareMathSymbol{8}{\mathalpha}{legacymaths}{`8}
51 \DeclareMathSymbol{9}{\mathalpha}{legacymaths}{`9}
52 \DeclareMathSymbol{\Gamma}{\mathalpha}{legacymaths}{0}
53 \DeclareMathSymbol{\Delta}{\mathalpha}{legacymaths}{1}
54 \DeclareMathSymbol{\Theta}{\mathalpha}{legacymaths}{2}
55 \DeclareMathSymbol{\Lambda}{\mathalpha}{legacymaths}{3}
56 \DeclareMathSymbol{\Xi}{\mathalpha}{legacymaths}{4}
57 \DeclareMathSymbol{\Pi}{\mathalpha}{legacymaths}{5}
58 \DeclareMathSymbol{\Sigma}{\mathalpha}{legacymaths}{6}
59 \DeclareMathSymbol{\Upsilon}{\mathalpha}{legacymaths}{7}
60 \DeclareMathSymbol{\Phi}{\mathalpha}{legacymaths}{8}
61 \DeclareMathSymbol{\Psi}{\mathalpha}{legacymaths}{9}
62 \DeclareMathSymbol{\Omega}{\mathalpha}{legacymaths}{10}
63 \DeclareMathSymbol{+}{\mathbin}{legacymaths}{43}
64 \DeclareMathSymbol{=}{\mathrel}{legacymaths}{61}
65 \DeclareMathDelimiter{(}{\mathopen} {legacymaths}{40}{largesymbols}{0}
66 \DeclareMathDelimiter{)}{\mathclose}{legacymaths}{41}{largesymbols}{1}
67 \DeclareMathDelimiter{[}{\mathopen} {legacymaths}{91}{largesymbols}{2}
68 \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3}
69 \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14}
70 \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36}
71 \renewcommand{\hbar}{{\mathchar"AF\mkern-9mu h}}% TODO: test with other fonts
72 }
73 }
Finally, we change the font definitions for \mathrm and so on. These are defined using the
\g_@@_mathrm_tl (…) macros, which default to \rmdefault but may be specified with the
\setmathrm (…) commands in the preamble.
Since LATEX only generally defines one level of boldness, we omit \mathbf in the bold
maths series. It can be specified as per usual with \setboldmathrm, which stores the appro-
priate family name in \g_@@_bfmathrm_tl.
74 \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\shapedefault
75 \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\shapedefau
76 \DeclareSymbolFontAlphabet\mathrm{operators}
77 \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\itdefault
78 \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\shapedefault
79 \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g_@@_mathsf_tl\mddefault\shapedefault
80 \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g_@@_mathtt_tl\mddefault\shapedefault
81 \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\shapedefault
82 \tl_if_empty:NTF \g_@@_bfmathrm_tl
83 {
84 \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\itdefault
85 }
86 {
87 \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_@@_bfmathrm_tl\mddefault\shapedefau
88 \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g_@@_bfmathrm_tl\bfdefault\shapedefau

124
89 \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_@@_bfmathrm_tl\mddefault\itdefault
90 }
91 \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g_@@_mathsf_tl\bfdefault\shapedefault
92 \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g_@@_mathtt_tl\bfdefault\shapedefault
93 }

(End of definition for \fontspec_setup_maths:. This function is documented on page ??.)

\fontspec_maybe_setup_maths: We’re a little less sophisticated about not executing the maths setup if various other maths
font packages are loaded. This list is based on the wonderful ‘LATEXFont Catalogue’: http://
www.tug.dk/FontCatalogue/mathfonts.html. I’m sure there are more I’ve missed. Do the
TEX Gyre fonts have maths support yet?
Untested: would \unless\ifnum\Gamma=28672\relax\bool_set_false:N \g_@@_math_bool\fi
be a better test? This needs more cooperation with euler and lucida, I think.
94 \cs_new:Nn \fontspec_maybe_setup_maths:
95 {
96 \@ifpackageloaded{anttor}
97 {
98 \ifx\define@antt@mathversions a\bool_gset_false:N \g_@@_math_bool\fi
99 }{}
100 \@ifpackageloaded{arevmath} {\bool_gset_false:N \g_@@_math_bool}{}
101 \@ifpackageloaded{eulervm} {\bool_gset_false:N \g_@@_math_bool}{}
102 \@ifpackageloaded{mathdesign} {\bool_gset_false:N \g_@@_math_bool}{}
103 \@ifpackageloaded{concmath} {\bool_gset_false:N \g_@@_math_bool}{}
104 \@ifpackageloaded{cmbright} {\bool_gset_false:N \g_@@_math_bool}{}
105 \@ifpackageloaded{mathesf} {\bool_gset_false:N \g_@@_math_bool}{}
106 \@ifpackageloaded{gfsartemisia} {\bool_gset_false:N \g_@@_math_bool}{}
107 \@ifpackageloaded{gfsneohellenic} {\bool_gset_false:N \g_@@_math_bool}{}
108 \@ifpackageloaded{iwona}
109 {
110 \ifx\define@iwona@mathversions a\bool_set_false:N \g_@@_math_bool\fi
111 }{}
112 \@ifpackageloaded{kpfonts}{\bool_gset_false:N \g_@@_math_bool}{}
113 \@ifpackageloaded{kmath} {\bool_gset_false:N \g_@@_math_bool}{}
114 \@ifpackageloaded{kurier}
115 {
116 \ifx\define@kurier@mathversions a\bool_set_false:N \g_@@_math_bool\fi
117 }{}
118 \@ifpackageloaded{fouriernc} {\bool_gset_false:N \g_@@_math_bool}{}
119 \@ifpackageloaded{fourier} {\bool_gset_false:N \g_@@_math_bool}{}
120 \@ifpackageloaded{lmodern} {\bool_gset_false:N \g_@@_math_bool}{}
121 \@ifpackageloaded{mathpazo} {\bool_gset_false:N \g_@@_math_bool}{}
122 \@ifpackageloaded{mathptmx} {\bool_gset_false:N \g_@@_math_bool}{}
123 \@ifpackageloaded{MinionPro} {\bool_gset_false:N \g_@@_math_bool}{}
124 \@ifpackageloaded{unicode-math} {\bool_gset_false:N \g_@@_math_bool}{}
125 \@ifpackageloaded{breqn} {\bool_gset_false:N \g_@@_math_bool}{}
126 \@ifpackageloaded{pxfonts} {\bool_gset_false:N \g_@@_math_bool}{}
127 \@ifpackageloaded{txfonts} {\bool_gset_false:N \g_@@_math_bool}{}
128 \@ifpackageloaded{newpxmath} {\bool_gset_false:N \g_@@_math_bool}{}
129 \@ifpackageloaded{newtxmath} {\bool_gset_false:N \g_@@_math_bool}{}
130 \@ifpackageloaded{mtpro2} {\bool_gset_false:N \g_@@_math_bool}{}

125
131 \bool_if:NT \g_@@_math_bool
132 {
133 \@@_info:n {setup-math}
134 \fontspec_setup_maths:
135 }
136 }
137 \AtBeginDocument{\fontspec_maybe_setup_maths:}

(End of definition for \fontspec_maybe_setup_maths:. This function is documented on page ??.)

126
File XX
fontspec-code-closing.dtx
1 Closing code
1.1 Finishing up
Now we just want to set up loading the .cfg file, if it exists.
1 \bool_if:NT \g_@@_cfg_bool
2 {
3 \InputIfFileExists{fontspec.cfg}
4 {}
5 { \typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.} }
6 }

127
File XXI
fontspec-code-xfss.dtx
1 Changes/additions to the NFSS

\strong \strong {⟨text⟩}


\strongenv \begin{strongenv} ⟨text⟩ \end{strongenv}
Typesets text in the ‘strong’ font. NFSS series equivalent to \emph. Can be nested.

\strongfontdeclare \strongfontdeclare {⟨comma-separated font switch declarations⟩}


Define the behaviour of nested \strong commands.

\strongreset \renewcommand \strongreset {⟨font switch declarations⟩}


Define the behaviour when a \strong command is nested deeper than the definitions pro-
vided by \strongfontdeclare. By default this is ⟨empty⟩ — i.e., bold on top of bold remains
bold. In certain circumstances it may be appropriate to reset to a default state.

2 Implementation
1 ⟨∗fontspec⟩

2.1 Italic small caps and so on


2 \providecommand*\scitdefault{\scdefault\itdefault}
3 \providecommand*\scsldefault{\scdefault\sldefault}
4 \providecommand*\scswdefault{\scdefault\swdefault}
LATEX’s ‘shape’ font axis needs to be overloaded to support italic small caps and slanted small
caps. These are the combinations to support:
5 \cs_new:Nn \@@_shape_merge:nn { c_@@_shape_#1_#2_tl }
6 \cs_new:Nn \@@_merge_default_shapes:
7 {
8 \tl_const:cn { \@@_shape_merge:nn \shapedefault\scdefault } {\scdefault}
9 \tl_const:cn { \@@_shape_merge:nn \itdefault \scdefault } {\scitdefault}
10 \tl_const:cn { \@@_shape_merge:nn \sldefault \scdefault } {\scsldefault}
11 \tl_const:cn { \@@_shape_merge:nn \swdefault \scdefault } {\scswdefault}
12 \tl_const:cn { \@@_shape_merge:nn \scdefault \itdefault } {\scitdefault}
13 \tl_const:cn { \@@_shape_merge:nn \scdefault \sldefault } {\scsldefault}
14 \tl_const:cn { \@@_shape_merge:nn \scdefault \swdefault } {\scswdefault}
15 \tl_const:cn { \@@_shape_merge:nn \scsldefault \itdefault } {\scitdefault}
16 \tl_const:cn { \@@_shape_merge:nn \scitdefault \sldefault } {\scsldefault}
17 \tl_const:cn { \@@_shape_merge:nn \scitdefault \shapedefault } {\scdefault}
18 \tl_const:cn { \@@_shape_merge:nn \scsldefault \shapedefault } {\scdefault}
19 }
20 \@@_merge_default_shapes:

128
The following is rather specific; it only returns true if the merged shape exists, but more
importantly also if the merged shape is defined for the current font.
21 \prg_new_conditional:Nnn \@@_if_merge_shape:n {TF}
22 {
23 \bool_lazy_and:nnTF
24 { \tl_if_exist_p:c { \@@_shape_merge:nn {\f@shape} {#1} } }
25 {
26 \cs_if_exist_p:c
27 {
28 \f@encoding/\f@family/\f@series/
29 \tl_use:c { \@@_shape_merge:nn {\f@shape} {#1} }
30 }
31 }
32 \prg_return_true: \prg_return_false:
33 }
34 \cs_set_eq:NN \emfontdeclare \DeclareEmphSequence

2.2 Strong emphasis


\strongfontdeclare
35 \cs_set_protected:Npn \strongfontdeclare #1
36 {
37 \prop_gclear:N \g_@@_strong_prop
38 \int_zero:N \l_@@_strongdef_int
39

40 \group_begin:
41 \normalfont
42 \clist_map_inline:nn {\strongreset,#1}
43 {
44 ##1
45 \prop_gput_if_not_in:NeV \g_@@_strong_prop { \f@series } { \l_@@_strongdef_int }
46 \prop_gput:Nen \g_@@_strong_prop { switch-\int_use:N \l_@@_strongdef_int } { ##1 }
47 \int_incr:N \l_@@_strongdef_int
48 }
49 \group_end:
50 }

(End of definition for \strongfontdeclare. This function is documented on page 128.)

\strongenv
51 \DeclareRobustCommand \strongenv
52 {
53 \@nomath\strongenv
54

55 ⟨debug⟩ \typeout{Strong~ level:~\int_use:N \l_@@_strong_int}


56 \prop_get:NeNT \g_@@_strong_prop { \f@series } \l_@@_strong_tmp_tl
57 {
58 \int_set:Nn \l_@@_strong_int { \l_@@_strong_tmp_tl }
59 ⟨debug⟩ \typeout{Series~ (\f@series)~ detected;~ new~ level:~\int_use:N \l_@@_strong_int}
60 }
61

62 \int_incr:N \l_@@_strong_int

129
63

64 \prop_get:NeNTF \g_@@_strong_prop { switch-\int_use:N \l_@@_strong_int } \l_@@_strong_swit


65 { \l_@@_strong_switch_tl }
66 {
67 \int_zero:N \l_@@_strong_int
68 \strongreset
69 }
70

71 }

(End of definition for \strongenv. This function is documented on page 128.)

\strong
72 \DeclareTextFontCommand{\strong}{\strongenv}

(End of definition for \strong. This function is documented on page 128.)

\strongreset
73 \cs_set:Npn \strongreset {}

(End of definition for \strongreset. This function is documented on page 128.)

\reset@font Ensure nesting resets when necessary:


74 \cs_set_protected:Npn \reset@font
75 {
76 \normalfont
77 \int_zero:N \l_@@_strong_int
78 }

(End of definition for \reset@font.)

2.3 Defaults
79 \strongfontdeclare{\bfseries}
80 ⟨/fontspec⟩

130
Index
The italic numbers denote the pages where the corresponding entry is described, numbers
underlined point to the definition, all others indicate the places where it is used.

Symbols \l_@@_check_bool . . . . . . . . . . . . .
\# . . . . . . . . . . . . . . . . . . . . . 243, 244, 275 . . . . . . . . 5, 58, 59, 188, 193, 199, 210
\, . . . . . . . . . . . . . . . . . . . . 1, 2, 3, 4, 5, 28 \@@_check_lang:Nn . . . . . . . . . . . . 119
@@ commands: \@@_check_lang:NnTF . 97, 119, 373, 388
\@@_DeclareFontShape:nnnnnn . 541, \@@_check_lang:Nnn . . . . . . . . . . . . 123
548, 558, 558, 567, 576, 589, 597, 610 \@@_check_lang:NnnTF . . . 110, 119, 121
\g_@@_OT_features_prop . . . . 20, 22, 76 \@@_check_ot_feat:Nnnn . . . . . . . . 167
\@@_add_nfssfont:nnnn 311, 337, 338, \@@_check_ot_feat:NnnnTF . . . . . .
339, 340, 341, 342, 343, 344, 361, 361 . . . . . . . . . . . . . . . . . 50, 67, 167, 683
\@@_aff_error:n . . . . 11, 387, 428, 460 \@@_check_script:Nn . . . . . . . . . . . . 73
\l_@@_alias_bool . . . . . . . . . . . . . \@@_check_script:NnTF . . . . . . . . .
. . . . . 25, 207, 214, 220, 225, 232, 252 . . . . . . . . . . . . . 73, 80, 304, 321, 343
\l_@@_all_features_clist . . . . . . \@@_combo_sc_shape:n . . . . . . . . . .
. . . . . . 23, 56, 120, 130, 144, 190, 303 . . . . . . . . . . . 549, 552, 598, 639, 647
\g_@@_all_keyval_modules_clist . \@@_construct_font_call:nn . . . . .
. . . . . . . . . . . . . . . . . . 1, 50, 209, 227 . . . . . . . . . . . . . . . . 160, 164, 167,
\g_@@_all_opentype_feature_- 173, 178, 180, 306, 427, 428, 450, 535
names_prop . . . . . . 77, 215, 216, \@@_construct_font_call:nnnnnn .
217, 218, 219, 220, 221, 222, 223, . . . . . . . . . . . . . . . . . . . . . . 173, 182
224, 225, 226, 227, 228, 229, 230, \l_@@_curr_bfname_tl . . . . . . . . . .
231, 232, 233, 234, 235, 236, 237, . . . . . . . . . 97, 167, 177, 180, 182, 217
238, 239, 240, 241, 242, 243, 244, \l_@@_curr_fontname_tl . . 96, 350, 351
245, 246, 247, 248, 249, 250, 251, \g_@@_curr_series_tl . . . . . . . . . .
252, 253, 254, 255, 256, 257, 258, . . 95, 156, 171, 175, 180, 182, 217, 756
259, 260, 261, 262, 263, 264, 265, \@@_declare_shape:nnnn . . . . . . . .
266, 267, 268, 269, 270, 271, 272, . . . . . . . . . . . . . . . 438, 458, 458, 476
273, 274, 275, 276, 277, 278, 279, \@@_declare_shape_loginfo:nn . . .
280, 281, 282, 283, 284, 285, 286, . . . . . . . . . . . . . . . . . . . 474, 618, 618
287, 288, 289, 290, 291, 292, 293, \@@_declare_shape_slanted:nn . . .
294, 295, 296, 297, 298, 299, 300, . . . . . . . . . . . . . . . . . . . 472, 568, 568
301, 302, 303, 304, 305, 306, 307, \@@_declare_shapes_bx:nn 473, 580, 580
308, 309, 310, 311, 312, 313, 314,
\@@_declare_shapes_normal:nn . . .
315, 316, 317, 318, 319, 320, 321,
. . . . . . . . . . . . . . . . . . . 470, 539, 539
322, 323, 324, 325, 326, 327, 328,
\@@_declare_shapes_smcaps:nn . . .
329, 330, 331, 332, 333, 334, 335, 336
. . . . . . . . . . . . . . . . . . . 471, 544, 544
\l_@@_arg_clist . . . . . . . . . . . . . .
\g_@@_default_fontopts_clist . . .
. . . . . . . . . 62, 298, 299, 300, 303, 306
. . . . . . . . . . . . . . . . . . . 49, 122, 132
\l_@@_atsui_bool 7, 10, 235, 380, 389, 698
\g_@@_default_langs_clist 398, 401, 679
\l_@@_basename_tl . . . . 44, 10, 94, 358
\g_@@_default_scripts_clist . . . .
\l_@@_bf_series_seq . 48, 157, 169, 172 . . . . . . . . . . . . . . . 331, 334, 341, 681
\g_@@_bfmathrm_tl . . . . . . . . . . . . \@@_define_aat_feature:nnnn . . . 2,
. . . . . . . . . . 72, 73, 82, 87, 88, 89, 125 3, 4, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12,
\@@_calc_scale:n . . . 318, 319, 331, 331 13, 14, 15, 16, 17, 18, 19, 20, 21, 30,
\@@_calc_scale:nn . . . . . 320, 352, 352 31, 32, 33, 34, 36, 37, 38, 39, 40, 41,
\g_@@_cfg_bool . . . . . . . . . . 1, 9, 11, 19 42, 43, 45, 46, 47, 48, 49, 50, 51, 52,

131
53, 54, 56, 57, 58, 60, 61, 62, 63, 65, \l_@@_ext_filename_tl . . . . . . . . .
66, 67, 101, 102, 103, 104, 105, 106, . . . 98, 99, 100, 103, 105, 108, 109, 110
107, 109, 110, 111, 112, 113, 114, \l_@@_extension_tl . . . . . . . . . . . .
115, 117, 118, 119, 120, 121, 122, . . . . . . 31, 38, 44, 67, 87, 99, 121, 184
123, 124, 126, 127, 128, 129, 130, \l_@@_extensions_clist 53, 61, 76, 257
131, 132, 133, 134, 135, 136, 137, 186 \l_@@_external_bool 26, 39, 49, 198, 411
\@@_define_aat_feature_group:n . \l_@@_external_kpse_bool . 30, 48, 199
. . . . . . . . . . 1, 1, 1, 29, 35, 44, 55, \@@_extract_all_features: . . . . . 115
59, 64, 68, 80, 91, 100, 108, 116, 125, 181 \@@_extract_all_features:n . . . 22, 115
\@@_define_opentype_feature:nnnnn \l_@@_fake_embolden_tl . . . . . . . .
. . . . . . 7, 16, 26, 29, 44, 45, 54, 55, . . . . . . . . . . . . . . . 133, 644, 647, 661
55, 56, 60, 61, 74, 90, 106, 118, 124, \l_@@_fake_slant_tl . 132, 639, 666, 669
125, 126, 128, 133, 134, 135, 138, \l_@@_family_fontopts_clist . . . .
139, 140, 142, 166, 167, 170, 190, 196 . . . . . . . . . . . . . . . . 55, 126, 127, 133
\@@_define_opentype_feature_- \g_@@_family_int_prop . . . 81, 280, 286
group:n . . . . . . . 6, 12, 12, 28, 54, \l_@@_family_label_tl . . . . . . . . .
73, 89, 105, 117, 127, 137, 141, 169, . . . . . . . . . . . 126, 128, 131, 151, 166
189, 191, 207, 216, 235, 249, 271, 281 \@@_feat_off:n . . . . . . . . . . . . . 50, 55
\@@_define_opentype_onoffreset:nnnnn \@@_feat_prop_add:nn 1, 2, 3, 4, 5, 16, 28
. . . . . . . . . . . . . . . . . . 13, 14, 15, \@@_feat_reset:n . . . . . . . . . 51, 56, 61
16, 17, 18, 27, 46, 48, 49, 50, 50, 51, \@@_find_autofonts: . . . . 294, 314, 314
52, 52, 53, 64, 65, 66, 67, 68, 72, 83, \l_@@_firsttime_bool . . . . . . . . . .
84, 85, 86, 87, 88, 99, 100, 101, 102, . . . . 1, 36, 210, 245, 274, 384, 480,
103, 104, 113, 114, 115, 116, 123, 504, 517, 529, 591, 637, 659, 708, 749
136, 155, 156, 157, 158, 159, 160, \@@_font_is_file: . . . . . . . . . . . .
161, 162, 163, 164, 165, 168, 181, . . . . . . . . . . . 29, 49, 68, 177, 190, 195
182, 183, 184, 185, 186, 187, 188, \@@_font_is_name: . . . . . 190, 190, 750
200, 201, 202, 203, 204, 205, 206, \l_@@_font_path_tl 28, 100, 199, 204, 751
208, 209, 210, 211, 212, 213, 214, 215 \@@_font_suppress_not_found_-
\@@_define_opentype_onreset:nnnnn error: . . . . . . . . . . . . 5, 9, 9, 38, 270
. . . . . . . . . . . . . . . . . . . . . . . . 58, 58 \l_@@_fontcfg_bool . . . 12, 13, 18, 22, 96
\@@_define_opentype_variation_- \l_@@_fontface_cs_tl . . . . . . . . . .
axis:nn . . . . . . . . 1, 1, 567, 574, 575 . . . . . . . . . . . . . 17, 150, 155, 161,
\g_@@_defined_shapes_tl . . . . . . . 162, 165, 166, 169, 170, 304, 321,
. . . . . . . . . . . . . . . . 92, 193, 620, 755 340, 343, 373, 388, 449, 451, 683, 701
\l_@@_defining_encoding_bool . . 3, \l_@@_fontfeat_bf_clist . . . . . . .
9, 15, 21, 27, 27, 50, 52, 57, 63, 69, 75 . . . . . . . . . . . . . . . . 65, 215, 338, 662
\l_@@_disable_defaults_bool . . . . \l_@@_fontfeat_bfit_clist . . . . .
. . . . . . . . . . . . . . . . . . . 24, 118, 156 . . . . . 67, 225, 342, 646, 648, 668, 670
\l_@@_em_int . . . . . . . . . . . . . . . . . . 39 \l_@@_fontfeat_bfsl_clist 69, 233, 343
\g_@@_em_normalise_slant_bool . . . 29 \l_@@_fontfeat_bfsw_clist 71, 241, 344
\g_@@_em_prop . . . . . . . . . . . . . . . . . 78 \l_@@_fontfeat_clist 60, 151, 224, 275
\l_@@_fontfeat_curr_clist . . . . .
\l_@@_em_switch_tl . . . . . . . . . . . . 117
. . . . . . . . . . . . . . . . 61, 493, 502, 515
\l_@@_em_tmp_tl . . . . . . . . . . . . . . 122
\l_@@_fontfeat_it_clist . . . . . . .
\l_@@_emdef_int . . . . . . . . . . . . . . . 40 . . . . . . . . . . . . . . . . 66, 221, 339, 640
\l_@@_emshape_query_tl . . . . . . . . 116 \l_@@_fontfeat_sc_clist . 72, 247, 493
\@@_error:n . . . . . . . . . . . . . . 1, 10, 484 \l_@@_fontfeat_sl_clist . 68, 229, 340
\@@_error:nn . . . . . 2, 3, 4, 10, 14, 16, \l_@@_fontfeat_sw_clist . 70, 237, 341
22, 28, 58, 64, 70, 76, 162, 451, 789, 808 \l_@@_fontfeat_up_clist . . . . . . .
\@@_error:nnn . . . . . . . . . . . . . . 4, 456 . . . . . . . . . . . . . . . . 64, 211, 253, 337

132
\g_@@_fontid_family_prop 80, 260, 288 \g_@@_instance_tl 158, 607, 732, 734, 766
\l_@@_fontid_tl . . . . . . . . . . . . . . \@@_int_mult_truncate:Nn . 67, 67, 526
. . . . . . . 44, 23, 25, 101, 256, 260, 268 \@@_iv_str_to_num:Nn . . . . . . . . 84,
\l_@@_fontname_bf_tl . . . . . . . . . . 133, 134, 177, 181, 182, 792, 793, 798
. . . . . 90, 135, 177, 319, 325, 338, 663 \@@_iv_str_to_num:w . . . . 802, 803, 805
\l_@@_fontname_bfit_tl . . . . . . 91,
\@@_keys_define_code:nnn . . 7, 13,
137, 188, 318, 319, 320, 342, 649, 671
16, 20, 24, 35, 36, 45, 46, 51, 109, 114,
\l_@@_fontname_bfsl_tl . . . . . . . .
119, 126, 131, 135, 146, 150, 154,
. . . . . . . . . . . . . . . 139, 192, 333, 343
159, 186, 190, 194, 198, 209, 213,
\l_@@_fontname_bfsw_tl . 141, 196, 344
219, 223, 227, 231, 235, 239, 243,
\l_@@_fontname_it_tl . . . . . . . . . . 250, 255, 261, 265, 269, 273, 277,
. . . . . 89, 136, 143, 318, 330, 339, 641 281, 282, 283, 284, 285, 286, 287,
\l_@@_fontname_sc_tl 142, 206, 497, 509 291, 295, 314, 325, 382, 404, 408,
\l_@@_fontname_sl_tl 138, 148, 333, 340 429, 433, 437, 461, 523, 540, 544,
\l_@@_fontname_sw_tl . . . 140, 152, 341 550, 562, 569, 576, 601, 605, 677, 681
\l_@@_fontname_tl . . 102, 155, 157, 161 \l_@@_keys_leftover_clist . . . . .
\l_@@_fontname_up_tl . . . . . . . . . . . . . . . . . . . 58, 145, 148, 149, 150,
. . . . . . . . . . . . . 44, 48, 9, 30, 133, 225, 226, 230, 231, 234, 236, 240, 241
134, 147, 157, 158, 160, 162, 164, 167
\@@_keys_set_known:nnN . . . . . . 60,
\@@_fontname_wrap:n . . . . . . . . . . .
60, 66, 143, 148, 150, 224, 226, 367, 436
. . . . . 49, 175, 176, 192, 193, 201, 204
\l_@@_lang_name_tl . . . . . . . . . . . .
\l_@@_fontopts_clist . . . . . . . . . .
. . . . . . . . 117, 147, 148, 214, 216, 390
. . 54, 123, 124, 134, 438, 446, 447, 448
\l_@@_lang_tl . . . . 48, 50, 146, 312,
\g_@@_fontopts_prop . . . . . . . . . 73,
375, 387, 388, 392, 406, 664, 673, 679
101, 123, 126, 135, 138, 142, 143, 446
\l_@@_language_int . . . . . . . . . . 33,
\@@_format_axis:nn . . . . . . . . . 726, 740
45, 180, 181, 185, 191, 310, 376, 391, 407
\@@_get_features:Nn . . . . . . . . . 63, 220
\l_@@_leftover_clist . . . . 57, 436, 438
\@@_get_features:n . . 35, 220, 276, 523
\@@_load_external_fontoptions:N
\@@_get_variations: . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 20, 94, 94, 445
. . . . . . . . . 62, 307, 525, 536, 725, 730
\@@_load_font: . . . . . . . . . 33, 153, 153
\l_@@_graphite_bool . 11, 235, 383, 401
\l_@@_harfbuzz_bool . . . . . . 10, 79, 102 \@@_load_fontname:Nn 437, 441, 488, 509
\c_@@_hexcol_tl . . . . . . . 159, 248, 769 \@@_lua_function:nn . . . . . . . . . 71, 72
\l_@@_hexcol_tl . 151, 247, 249, 250, \@@_lua_function:nnn . . . . . . . . 71, 73
466, 471, 475, 490, 495, 499, 514, 769 \@@_lua_function:nnnn . . . . 71, 74, 161
\l_@@_hyphenchar_tl . . . . . . . . . . . \@@_lua_function:nnnnn . . . 71, 75, 209
. . . . . . . . . . . 150, 448, 449, 451, 454 \@@_main_DeclareFontExtensions:n
\@@_if_autofont:nn . . . . . . . . . . . . 424 . . . . . . . . . . . . . . . 122, 255, 255, 259
\@@_if_autofont:nnTF . . . . . . . . . . 417 \@@_main_IfFontFeatureActiveTF:nnn
\@@_if_detect_external:n . . . . . . . 73 . . . . . . . . . . . . . . . . . . . . . . 126, 260
\@@_if_detect_external:nTF 14, 73, 177 \@@_main_addfontfeatures:n 82, 86, 147
\@@_if_font_feature:n . . . . . . . . . 266 \@@_main_aliasfontfeature:nn 106, 204
\@@_if_font_feature:nTF . . . . . . . 264 \@@_main_aliasfontfeatureoption:nnn
\@@_if_merge_shape:n . . . . . . . . . . . 21 . . . . . . . . . . . . . . . . . . . . . . 110, 223
\@@_if_merge_shape:nTF . . . . . . . . 193 \@@_main_fontspec:nn . . . . . . . . 1, 1, 3
\@@_info:n . . . . . . . . . . 8, 133, 323, 329 \@@_main_liningnums:n . . . . . . 137, 295
\@@_info:nn . . . . . . . . . . . . . 9, 385, 419 \@@_main_newAATfeature:nnnn . . 94, 178
\@@_info:nnn . . . . . . . . . . . 10, 297, 318 \@@_main_newfontface:NnnN . . . . .
\@@_init: . . . . . . . 6, 176, 271, 745, 745 . . . . . . . . . . . . 59, 63, 67, 71, 115, 115
\@@_init_fontface: . . . . . 223, 762, 762 \@@_main_newfontfamily:NnnN . . . .
\@@_init_ttc:n . . . . . . . . . . . 19, 85, 85 . . . . . . . . 43, 47, 51, 55, 102, 102, 117

133
\@@_main_newfontfeature:nn . . . 90, 171 \l_@@_nfss_fam_tl . . 110, 258, 273, 293
\@@_main_newopentypefeature:nnn \g_@@_nfss_family_tl . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . 98, 102, 188 . . . . . . 48, 107, 164, 189, 262, 273,
\@@_main_oldstylenums:n . . . . 132, 288 274, 287, 288, 295, 301, 302, 303,
\@@_main_setboldmathrm:nn . . . 27, 70 304, 309, 310, 311, 312, 541, 548,
\@@_main_setmainfont:nn . . . . 8, 24, 39 576, 577, 589, 591, 597, 599, 610, 612
\@@_main_setmathrm:nn . . . . . . . 23, 64 \l_@@_nfss_prop . . . . . . . . 74, 180, 216
\@@_main_setmathsf:nn . . . . . . . 31, 76 \l_@@_nfss_sc_tl . . . . . . . . . . 108,
\@@_main_setmathtt:nn . . . . . . . 35, 82 462, 468, 514, 546, 549, 595, 636, 649
\@@_main_setmonofont:nn . . . . . 18, 51 \l_@@_nfss_tl 109, 461, 467, 489, 542, 635
\@@_main_setsansfont:nn . . . . . 13, 38 \l_@@_nfssfont_prop . . . . . 75, 345, 371
\@@_make_AAT_feature:nn . . . . . . . \l_@@_nobf_bool . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . 9, 12, 12, 76, 87 . . . . . . . 2, 26, 163, 166, 316, 323, 664
\@@_make_AAT_feature_string:Nnn . 26 \l_@@_noit_bool . . . . . . . . . . . . . .
\@@_make_AAT_feature_string:NnnTF . . . . . . . 3, 27, 139, 142, 316, 328, 642
. . . . . . . . . . . . . . . . . . 12, 17, 26, 700 \l_@@_nosc_bool 4, 202, 205, 495, 506, 512
\@@_make_OT_feature:nnn 39, 40, 41, \c_@@_opacity_tl . . . . . . . . . . . . .
44, 63, 69, 224, 231, 244, 255, 278, 288 . . . . . . . . 160, 161, 248, 515, 527, 768
\@@_make_font_shapes:Nnnnn . . . . . \l_@@_opacity_tl . . . . . . . . . . 152,
. . . . . . . . . . . . . . . . . . . 351, 433, 433 247, 249, 250, 515, 520, 527, 532, 768
\@@_make_ot_smallcaps:TF 676, 676, 696 \l_@@_optical_size_tl . . . . . . . . .
\@@_make_smallcaps:TF . . 499, 676, 693 . . . . . . . . . . . 153, 187, 581, 598, 752
\l_@@_mapping_tl . . . . . . . . . . . . . \l_@@_options_tl . . . 103, 154, 157, 161
. 22, 23, 24, 26, 154, 244, 245, 542, 546 \l_@@_ot_bool . . . . . . . . . . 8, 28, 39,
\g_@@_math_bool . . . . . . . . . . . . . . 65, 78, 91, 108, 121, 136, 228, 272,
. . . 4, 7, 20, 98, 100, 101, 102, 103, 381, 397, 406, 579, 589, 661, 695, 748
104, 105, 106, 107, 110, 112, 113, \@@_ot_compat:nn . . . 410, 414, 415,
116, 118, 119, 120, 121, 122, 123, 416, 417, 418, 419, 420, 421, 422,
124, 125, 126, 127, 128, 129, 130, 131 423, 424, 425, 426, 427, 428, 429, 430
\g_@@_math_euler_bool . . . . . . 9, 14, 34 \@@_ot_validate_tag:n . . . . . . 100,
\g_@@_math_lucida_bool . . . . . . . . 156, 157, 203, 204, 205, 774, 775, 779
. . . . . . . . . . . . . . . . 13, 14, 15, 15, 40 \@@_ot_validate_tag:w . . . . . . 777, 780
\g_@@_mathrm_tl . . . . . . . . . . . . 66, \@@_ot_validate_tag_aux:w 783, 784, 786
67, 74, 75, 77, 78, 81, 84, 99, 124, 128 \g_@@_pkg_euler_loaded_bool 2, 3, 8, 16
\g_@@_mathsf_tl . . . . . . . . . . . . . . \c_@@_postadjust_tl . . . . . . . . 162, 770
. . . . . . . . 78, 79, 79, 91, 100, 126, 129 \l_@@_postadjust_tl . . . . . . . . . . .
\g_@@_mathtt_tl . . . . . . . . . . . . . . . . . . . . . . 157, 431, 441, 453, 542,
. . . . . . . . 80, 84, 85, 92, 101, 127, 130 549, 577, 592, 600, 613, 650, 653, 770
\@@_merge_default_shapes: . . . . 6, 20 \l_@@_pre_feat_sclist . . . 158, 160,
\l_@@_mm_bool . . . . 9, 382, 393, 584, 589 164, 167, 307, 427, 428, 450, 536, 658
\l_@@_mode_tl 81, 90, 91, 95, 104, 670, 759 \@@_preparse_features: . . 27, 139, 139
\@@_msg_new:nn . . . 14, 19, 24, 48, 88, \l_@@_prev_unicode_name_tl 48, 53, 105
94, 98, 108, 112, 116, 121, 126, 130, \l_@@_primitive_font . . . . . . . . 39, 40
136, 144, 148, 152, 157, 161, 178, \@@_primitive_font_current_name:
183, 187, 195, 199, 203, 207, 212, 217 . . . . . . . . . . . . . . . . . 56, 57, 186, 188
\@@_msg_new:nnn 16, 29, 41, 52, 62, 70, 78 \@@_primitive_font_get_name:N . .
\l_@@_never_check_bool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56, 56, 59
. . . . . . . . . . . . . 31, 76, 126, 169, 273 \@@_primitive_font_glyph_if_-
\g_@@_nfss_enc_tl . . . . . . . . . . . 4, exist:Nn . . . . . . . . . . . . . . . . . . 44
32, 34, 45, 47, 58, 60, 106, 110, 289, \@@_primitive_font_glyph_if_-
295, 541, 548, 576, 589, 597, 610, 757 exist:NnTF . . . . . . . . . . . . . 44, 451

134
\@@_primitive_font_gset:Nnn . . . . \l_@@_script_name_tl 112, 140, 144,
. . . . . . . . . . . . . . . . . . 1, 5, 26, 28, 33 145, 212, 214, 215, 307, 323, 346, 357
\@@_primitive_font_gset:NnnTF . . . 34 \l_@@_script_tl . . . . . . . . . . . . . .
\@@_primitive_font_gset:NnnTFTF . 21 . . . . . . . . 47, 50, 95, 121, 143, 308,
\@@_primitive_font_gset:Onn . . 33, 166 311, 320, 321, 325, 347, 663, 672, 681
\@@_primitive_font_gset:OnnTF . . . 34 \l_@@_scriptlang_exist_bool . . . .
\@@_primitive_font_gset_p:NnnTF . 21 . . . . . . . . . . . . . . . . . . . . 28, 301,
\@@_primitive_font_if_exist:n . . . 35 310, 315, 340, 349, 354, 370, 378, 382
\@@_primitive_font_if_exist:nTF \@@_select_font_family:nn . . . . .
. . . . . . . . . . . . . . . . . . . . . . . 35, 178 . . . . . . . . . 1, 1, 51, 152, 157, 160, 167
\@@_primitive_font_if_null:N . . . . 13 \@@_set_autofont:Nnn . . . . . . . . . .
\@@_primitive_font_if_null:NTF . . 318, 319, 320, 325, 330, 333, 409, 409
. . . . . . . . . . . . . . . . . . . 13, 24, 29, 40 \@@_set_default_features:nn . . . .
\@@_primitive_font_if_null_p:N . . 13 . . . . . . . . . . . . . . . . . . . 76, 119, 119
\@@_primitive_font_set:Nnn . . . . . \@@_set_faces: . . . . . . . . 296, 335, 335
. . . . . . . . 1, 1, 21, 23, 31, 39, 427, 428 \@@_set_faces_aux:nnnnn . . . . 345, 347
\@@_primitive_font_set:NnnTF . 32, 159 \@@_set_family:NnnN . . . . 147, 158, 159
\@@_primitive_font_set:NnnTFTF . . 21 \@@_set_font_default_features:nnn
\@@_primitive_font_set:Onn . . . . . . 31 . . . . . . . . . . . . . . . . . . . 77, 124, 124
\@@_primitive_font_set:OnnTF . 32, 449 \@@_set_font_dimen:NnN . . . . . . . .
\@@_primitive_font_set_hyphenchar:Nn . . . . . . . . . . . . . . . 339, 340, 366, 366
. . . . . . . . . . . . . . . . . 52, 52, 442, 454 \@@_set_font_type:N . . . . . 9, 27, 38,
\@@_primitive_font_set_p:NnnTF . . 21 64, 77, 90, 107, 120, 135, 165, 375, 375
\@@_process_ext:N . . . . . . . . . . 56, 59 \@@_set_fontface:NNnnN . 163, 171, 172
\l_@@_punctspace_adjust_tl . . . . . \@@_set_scriptlang: . . . . . 34, 207, 207
. . . . . . . . 155, 162, 414, 419, 424, 772
\@@_setboldmathrm_hook:nn . . . 74, 94
\g_@@_rawfeatures_sclist . . . . 62,
\@@_setmainfont_hook:nn . . . . . 35, 88
163, 279, 307, 525, 536, 712, 721, 764
\@@_setmathrm_hook:nn . . . . . . . 68, 91
\g_@@_rawvariations_prop . . . . . .
\@@_setmathsf_hook:nn . . . . . . . 80, 92
. . . . . . . . . . . 6, 82, 603, 736, 740, 765
\@@_setmathtt_hook:nn . . . . . . . 86, 93
\@@_remove_clashing_featstr:n . .
\@@_setmonofont_hook:nn . . . . . 61, 90
. . . . . . . . . . . . . 34, 66, 715, 715, 724
\@@_setsansfont_hook:nn . . . . . 48, 89
\l_@@_renderer_tl . . . . . 55, 60, 64, \@@_setup_nfss:Nn . . 489, 514, 518, 518
65, 89, 111, 116, 186, 390, 398, 402, 754
\@@_setup_single_size:nn 465, 477, 477
\l_@@_rmfamily_encoding_tl . . . . .
\l_@@_sffamily_encoding_tl . . . . .
. . . . . . . . . . . . . . . . 9, 15, 21, 32, 168
. . . . . . . . . . . . . . . 10, 17, 22, 45, 169
\l_@@_rmfamily_family_tl . 30, 31, 165
\l_@@_sffamily_family_tl . 43, 44, 166
\@@_sanitise_fontname:Nn . . . . . .
. . . . . . . . . . . . 8, 52, 52, 131, 157, 444 \@@_shape_merge:nn . . . . . . . . . . . .
. . . . . . . . . . 5, 8, 9, 10, 11, 12, 13,
\@@_save_family:nn . . . . . . 40, 291, 291
14, 15, 16, 17, 18, 24, 29, 195, 554, 555
\@@_save_family_needed:n . . . . . . 252 \l_@@_shaper_tl 86, 91, 91, 96, 105, 671
\@@_save_family_needed:nTF . . . 38, 252 \g_@@_single_feat_tl . . . . . . . . . .
\@@_save_fontid_family:nn 268, 278, 290 . . . . . . . . 65, 93, 93, 268, 280, 282,
\@@_save_fontinfo:n . . . . 293, 299, 299 284, 311, 325, 350, 377, 392, 408, 710
\l_@@_saved_fontname_tl 104, 463, 480 \l_@@_size_tl . . . . . . . . . . . . . . . .
\l_@@_scale_tl . . . . . . . . . . . . . . . . . . . 111, 275, 479, 484, 485, 520, 534
. 149, 201, 322, 327, 328, 342, 350, \l_@@_sizedfont_tl . . . . . . . . . . . .
356, 358, 360, 364, 527, 529, 534, 767 . . . . . . . . . . . 112, 279, 480, 488, 490
\l_@@_script_int 32, 42, 94, 134, 136, \l_@@_sizefeat_clist . . . . . . . . . .
142, 182, 185, 191, 309, 309, 324, 348 . . . . . . . . . . 51, 52, 252, 257, 366, 372

135
\l_@@_sizing_leftover_clist . . . . \@@_update_featstr:n . . . . . . . . 19,
. . . . . . . . . . . . . . . . 59, 483, 489, 515 67, 175, 245, 249, 250, 435, 564, 571,
\l_@@_smcp_shape_tl . . . . . . . . . . . 586, 613, 621, 629, 679, 683, 705, 705
. . . . . . . . . . . 115, 195, 198, 201, 204 \@@_warning:n . . 5, 15, 40, 122, 554, 558
\@@_strip_leading_sign:Nw . . 796, 799 \@@_warning:nn . . 6, 22, 68, 103, 167,
\@@_strip_plus_minus:n . . . . . 197, 199 221, 253, 445, 481, 505, 518, 530, 592
\@@_strip_plus_minus_aux:Nq . 199, 200 \@@_warning:nnn . . . . . . 7, 41, 184, 194
\l_@@_strnum_int . . 34, 84, 90, 133, \l_@@_wordspace_adjust_tl . . . . .
144, 177, 192, 309, 324, 348, 376, 391 . . . . . . . . . . . 156, 162, 392, 400, 771
\l_@@_strong_int . . . . . . . . . . . . . \\ . 17, 26, 32, 36, 37, 37, 38, 38, 101, 102,
. . . . . . . . 41, 55, 58, 59, 62, 64, 67, 77 103, 163, 180, 190, 191, 192, 209,
\g_@@_strong_prop 37, 45, 46, 56, 64, 79 214, 220, 221, 222, 622, 638, 652, 653
\l_@@_strong_switch_tl . . . 64, 65, 118 \␣ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
\l_@@_strong_tmp_tl . . . . . . 56, 58, 123
\l_@@_strongdef_int . . 38, 42, 45, 46, 47 A
\@@_swap_plus_minus:n . . . . . . . 66, 70 \acute . . . . . . . . . . . . . . . . . . . . . . . . . . 18
\@@_swap_plus_minus_aux:Nq . . . 70, 71 \addfontfeature . . 31, 50, 84, 100, 291, 298
\l_@@_test_font . . . . . . . . . . . 159, 165 \addfontfeatures . . . . . . . . . . . 80, 80, 147
\l_@@_tfm_bool . . . . . . . . . . 6, 379, 386 \aliasfontfeature . . . . . . . . . . . . . . .
\l_@@_this_feat_clist 63, 299, 307, 312 . . . . . . 34, 90, 104, 204, 234, 248, 522
\l_@@_this_font_tl . . . . . . 113, 258, \aliasfontfeatureoption . . . . . . . . . .
259, 263, 297, 306, 312, 363, 369, 372 . . . . . . . . . . . 69, 70, 71, 108, 223, 412
\@@_tl_new_if_free:N . . . . . . . 146, 153 \AtBeginDocument . . . . . . . 122, 53, 128, 137
\l_@@_tmp_int . . . 35, 525, 526, 535, 536 \author . . . . . . . . . . . . . . . . . . . . . . . . . 35
\l_@@_tmp_tl . . . . . 41, 42, 44, 45, 93,
94, 102, 103, 104, 105, 119, 123, 124, B
130, 131, 135, 138, 138, 139, 142, \bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
143, 153, 159, 160, 161, 207, 208, \bfdefault . . . . . . . . . 52, 80, 28, 41, 54,
209, 260, 262, 266, 267, 268, 280, 78, 81, 84, 88, 91, 92, 171, 172, 175,
282, 283, 285, 286, 287, 356, 360, 367 338, 342, 343, 344, 584, 585, 591,
\l_@@_tmpa_bool . . . . . . . . . . . . . . 599, 626, 630, 631, 632, 642, 644, 646
. . . . . . . . 23, 78, 81, 83, 678, 686, 691 \bfseries . . . . . . . . . . . . . . . . . . . . . . . 79
\l_@@_tmpa_dim . . . . . . . . . 45, 339, 344 \boldmath . . . . . . . . . . . . . . . . . . . . . . . 28
\l_@@_tmpa_font . . . . . . . . . . . 427, 429 bool commands:
\l_@@_tmpa_fp . . . . . . . . . . . . . . . . . 43 \bool_gset_false:N . . . . . 3, 98, 100,
\l_@@_tmpa_int 36, 137, 139, 142, 147, 150 101, 102, 103, 104, 105, 106, 107,
\l_@@_tmpa_tl . . . . . . . . 28, 29, 53, 120 112, 113, 118, 119, 120, 121, 122,
\l_@@_tmpb_dim . . . . . . . . . 46, 340, 345 123, 124, 125, 126, 127, 128, 129, 130
\l_@@_tmpb_font . . . . . . . . . . . 428, 429 \bool_gset_true:N . . . . 2, 9, 13, 14, 15
\l_@@_tmpb_fp . . . . . . . . . . . . . . . . . 44 \bool_if:NTF . . . . . . . . . . . . . . . . .
\l_@@_tmpb_int . . . . . 37, 135, 139, 147 . . . 1, 3, 8, 9, 10, 15, 21, 27, 28, 34,
\l_@@_tmpb_tl . . . . . . . . . . . . . . 34, 39, 39, 40, 49, 57, 63, 65, 69, 75, 76,
39, 42, 46, 50, 53, 121, 135, 136, 137, 138 78, 83, 91, 96, 97, 106, 108, 118, 121,
\l_@@_tmpc_dim . . . . . . . . . . . . . . . . 47 126, 131, 136, 153, 162, 169, 199,
\l_@@_tmpc_int . . . . . . . . . 38, 141, 144 210, 210, 220, 228, 245, 252, 315,
\@@_trace:n . . . . . . . . . . . . . . . . . . . 11 323, 328, 354, 382, 384, 411, 480,
\l_@@_ttc_index_tl . . . . . . . . . . . . 495, 504, 512, 517, 529, 579, 584,
. . . . 114, 123, 124, 128, 129, 185, 753 591, 637, 659, 661, 691, 695, 698, 708
\l_@@_ttfamily_encoding_tl . . . . . \bool_if:nTF . . . . . . . . 79, 129, 172,
. . . . . . . . . . . . . . . 11, 19, 23, 58, 170 235, 316, 570, 582, 589, 604, 782, 801
\l_@@_ttfamily_family_tl . 56, 57, 167 \bool_lazy_and:nnTF . . . . . . . . . 23, 199

136
\bool_new:N . . . . . . . . . . . . . 1, 2, 3, cs commands:
4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, \cs:w . . . . . . . . . . . . . . . . . . . . . . . 130
19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 31 \cs_end: . . . . . . . . . . . . . . . . . . . . 130
\bool_set_false:N . . . . . . . . . . . . \cs_generate_variant:Nn . . . . . . .
. . . . . . . . . . 18, 22, 36, 52, 59, 78, . . . . . 12, 13, 66, 69, 77, 78, 79, 80,
87, 110, 116, 138, 142, 166, 188, 205, 81, 160, 290, 476, 567, 724, 725, 779, 798
207, 225, 274, 301, 340, 370, 379, \cs_if_eq:NNTF . . . . . 101, 158, 206, 429
380, 381, 382, 383, 642, 664, 678, 748 \cs_if_exist:NTF 3, 7, 38, 201, 469, 493
\bool_set_true:N . . . . . . . . . . . 13, \cs_if_exist_p:N . . . . . . . . . . . . . . 26
26, 27, 48, 50, 58, 79, 81, 91, 102, 139, \cs_new:Nn . 1, 1, 1, 4, 5, 5, 6, 7, 11, 12,
146, 156, 163, 193, 198, 202, 214, 12, 14, 16, 16, 24, 26, 38, 50, 51, 51,
232, 272, 273, 310, 349, 378, 386, 52, 52, 52, 58, 59, 60, 63, 64, 67, 70,
389, 393, 397, 401, 406, 506, 686, 749 70, 76, 82, 85, 94, 94, 102, 115, 115,
\bool_until_do:nn . . . . . . 88, 139, 189 119, 124, 139, 146, 147, 147, 153,
\breve . . . . . . . . . . . . . . . . . . . . . . . . . . 23 158, 159, 163, 171, 171, 172, 173,
178, 180, 188, 190, 195, 199, 204,
C 207, 220, 223, 255, 260, 278, 291,
char commands: 296, 299, 314, 331, 332, 335, 347,
\char_set_catcode_ignore:n . . . . . 225 352, 353, 361, 366, 366, 375, 399,
\char_set_catcode_space:n . . . . . . 18 409, 410, 433, 441, 458, 477, 518,
\check . . . . . . . . . . . . . . . . . . . . . . . . . . 24 539, 544, 552, 558, 568, 580, 618,
clist commands: 676, 693, 705, 715, 726, 730, 762, 793
\clist_clear:N . . . . . 124, 127, 275, 447 \cs_new:Npn . . . . . . . . . . 1, 2, 3, 4, 5,
\clist_count:N . . . . . . . . . . . . . . . 300 6, 7, 8, 9, 10, 11, 57, 58, 59, 71, 200, 252
\clist_count:n . . . . . . . . . . . . . . . 104 \cs_new_eq:NN . . . . . . . . . . . . . . . . . 56
\clist_get:NN . . . . . . . . . . . . . 320, 387 \cs_new_protected:Nn . 1, 288, 295, 775
\cs_set:Npn . . . . . . . . . . . 1, 5, 9, 31,
\clist_gput_right:Nn . . . . . . . . . . 121
32, 33, 34, 72, 73, 73, 74, 75, 193, 201,
\clist_gset:Nn . . . . . . 1, 121, 334, 401
204, 388, 512, 745, 780, 786, 799, 805
\clist_map_break: . . . . . . . . . . . .
\cs_set_eq:NN . . . . . . . . . . . . . . 34,
. . . . . . . . . . 69, 81, 312, 351, 379, 687
51, 88, 89, 90, 91, 92, 93, 94, 182, 192
\clist_map_inline:Nn . . . . . . . . . .
\cs_set_protected:Npn . . . . . . . 35, 74
. . . . . . . . . . . . . 61, 76, 209, 227, 341
\cs_to_str:N 103, 104, 109, 130, 160, 208
\clist_map_inline:nn . . . . . . . . . .
\cs_undefine:N . . . . . . . . . 77, 274, 563
. . . . . . . . . . . 42, 74, 86, 127, 223,
\cyrillicencoding . . . . . . . . . . . 51, 55, 87
242, 263, 302, 371, 465, 679, 681, 718
\clist_new:N . . . . . . . 49, 50, 51, 53, D
54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \date . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
64, 65, 66, 67, 68, 69, 70, 71, 72, 331, 398 \ddot . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
\clist_put_left:Nn . . . . . . . . . . . . 502 \DeclareDocumentCommand . . . . . . . . . 1,
\clist_put_right:Nn . . . . . . . . 211, 7, 13, 19, 25, 31, 51, 55, 61, 67, 67, 73
215, 221, 225, 229, 233, 237, 241, \DeclareEmphSequence . . . . . . . . . . . . . . 34
247, 253, 640, 646, 648, 662, 668, 670 \DeclareFontEncoding . . . . . . . . . . . 33, 41
\clist_set:Nn . . . . . . . . . . . 52, 120, \DeclareFontExtensions . . . . . . . . . . . 120
130, 252, 257, 257, 298, 319, 366, 386 \DeclareFontFamily . . . . . . . . . . . . 35, 295
\clist_set_eq:NN . . . . . . . . . . 299, 493 \DeclareFontSeriesDefault . . . . . . . .
\l_tmpa_clist . . . . . . 319, 320, 386, 387 . . . . . . . . . . . . . 27, 28, 40, 41, 53, 54
\colon . . . . . . . . . . . . . . . . . . . . 123, 30, 31 \DeclareFontShape 56, 37, 39, 41, 43, 45, 565
color commands: \DeclareFontSubstitution . . . . . . . 34, 42
\color_export:nnN . . . . . . . . . . . . 466 \DeclareKeys . . . . . . . . . . . . . . . . . . . . . . 1
\color_if_exist:nTF . . . . . . . . 464, 488 \DeclareMathAccent . . . . . . . . . . . . . .
\convertcolorspec . . . . . . . . . . . . 471, 495 . . . 18, 19, 20, 21, 22, 23, 24, 25, 26, 27

137
\DeclareMathDelimiter . . . 65, 66, 67, 68, 69 \exp_args:Noo . . . . . . . . . . . . . 321, 388
\DeclareMathSymbol . . . . . . . . . . . . . . \exp_args:NV . . . . . . . . . . . . . . . . . 284
. . . . . 31, 36, 37, 38, 39, 42, 43, 44, \exp_args:Nx . . . . . . . . . . . . . . . 79, 465
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, \exp_args:Nxx . . . . . . . . . . . . . . . . 187
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 70 \exp_last_unbraced:No . . 31, 32, 33, 34
\DeclareRobustCommand . . . . . . . . . . . . . 51 \exp_not:N . . . . . . . 21, 98, 107, 109,
\DeclareSymbolFont . . . . . . . . . . . . 16, 74 110, 111, 252, 253, 256, 257, 265,
\DeclareSymbolFontAlphabet . . . . . . . . 76 266, 279, 280, 443, 623, 639, 652, 653
\DeclareTextCommand . . . . . . . . . . . . 5, 11 \exp_not:n 65, 75, 222, 263, 349, 622, 638
\DeclareTextComposite . . . . . . . . . . . . . 23 \expandafter . . . . . . . . . . . . . . . . . . . . . 28
\DeclareTextCompositeCommand . . . . . . . 29
\DeclareTextFontCommand . . . . . . . . . . . 72 F
\DeclareTextSymbol . . . . . . . . . . . . . . . 17 \familydefault . . . . . . . . . . 33, 46, 59, 336
\DeclareUnicodeEncoding . . . . . . . . 22, 31 \fi . . . . . . . . . . . . 19, 28, 29, 32, 42, 55,
\def . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 95, 98, 110, 116, 197, 394, 403, 814, 815
\defaultfontfeatures . . . . . . . . . . . . . . 73 fi commands:
\Delta . . . . . . . . . . . . . . . . . . . . . . . . . . 53 \fi: . . . . . . . . . . . . . . . . . . . . . . . . . 50
dim commands: file commands:
\dim_compare:nNnTF . . . . . . . . . . . . 369 \file_if_exist:nTF . . . . . . . . . 103, 109
\dim_eval:n . . . . . . . . . . . . . . . . . . 3, 7 \file_input:n . . . . . . . . . . . . . 105, 110
\dim_new:N . . . . . . . . . . . . . . . 45, 46, 47 \filedate . . . . . . . . . . . . . . . . . . . . . . . 55
\dim_set:Nn . . . . . . . . . . . . . . . . . . 368 \fileversion . . . . . . . . . . . . . . . . . . . . . 55
\dim_to_fp:n . . . . . . . . . . . . . . 344, 345 \fmtname . . . . . . . . . . . . . . . . . . . . . . . . 28
dim internal commands: \font . 44, 3, 7, 9, 12, 27, 38, 50, 64, 67, 77,
\__dim_eval:w . . . . . . . . . . . . . . . . . 69 80, 90, 97, 101, 107, 110, 120, 135,
\__dim_eval_end: . . . . . . . . . . . . . . 69 158, 206, 339, 373, 394, 395, 396,
\dot . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 402, 403, 404, 415, 420, 425, 442, 454
\DTX . . . . . . . . 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, \fontdimen . . . . . . . . . 85, 86, 368, 394,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 395, 396, 402, 403, 404, 415, 420, 425
\fontdimen8 . . . . . . . . . . . . . . . . . . . . . 85
E \fontencoding 4, 9, 10, 11, 15, 17, 19, 110, 335
\else . . . . . . . . . . . . . . 17, 93, 195, 814, 815 \fontfamily . . . . . . . . . . . . . . . . . . . .
else commands: 30, 14, 15, 16, 17, 18, 19, 109, 164, 336
\else: . . . . . . . . . . . . . . . . . . . . . . . 48 \fontname . . . . . . . . . . . . . . . . . . . . 42, 56
\emfontdeclare . . . . . . . . . . . . . . . . . . . 34 \fontspec . . . . . . . . . . . . . . . . 24, 31, 44, 1
\emph . . . . . . . . . . . . . . . . . . . . . . . . . . 128 fontspec commands:
\EncodingAccent . . . . . . . . . . . . . . . . . . . 7 \fontspec_calc_scale:n . . . . . . . 83, 84
\EncodingCommand . . . . . . . . . . . . . . . . . . 1 \fontspec_calc_scale:nn . . . . . . . . 83
\EncodingComposite . . . . . . . . . . . . . . . 19 \fontspec_complete_fontname:Nn .
\EncodingCompositeCommand . . . . . . . . . 25 . . . . . . . . 133, 143, 148, 152, 167,
\encodingdefault 84, 21, 22, 23, 34, 47, 60, 335 188, 192, 196, 206, 279, 350, 353, 353
\EncodingSymbol . . . . . . . . . . . . . . . . . . 13 \g_fontspec_default_fontopts_tl . 31
\endinput . . . . . . . . . . . . . . . . 8, 13, 22, 28 \fontspec_default_lang:n . . . 399, 403
exp commands: \fontspec_default_script:n . . 332, 336
\exp_after:wN . . . . . . . . . . . . . . . . 482 \g_fontspec_encoding_tl . . . . . 44,
\exp_args:Ne . . . . . . . . . . . . . . 679, 681 48, 49, 51, 52, 55, 56, 74, 75, 77, 78,
\exp_args:NNNx . . . . . . . . . . . . 348, 362 79, 80, 81, 84, 84, 87, 88, 89, 91, 92, 757
\exp_args:Nnnx . . . . . . . . . . . . . . . 196 \l_fontspec_family_tl . . . . . . . . .
\exp_args:Nnx . . . . . . . 54, 55, 56, 60, 61 . . . . . . . . . . . . . . 44, 48, 83, 154, 168
\exp_args:No . . . . . . . . . . . . . . . 17, \l_fontspec_feature_string_tl 19, 53
103, 109, 304, 343, 373, 451, 683, 700 \l_fontspec_font 44, 150, 155, 162, 169

138
\fontspec_font_if_exist:n . . . . . 173 \fontspec_select:nn . . . . . . . . . 51, 51
\fontspec_font_if_exist:nTF . . . . \fontspec_set_family:Nnn . . . . . .
. . . . . . . . . . . . . . . . . . . 36, 173, 182 . . . 36, 3, 30, 43, 56, 104, 146, 159, 160
\l_fontspec_fontname_tl . . . . . . . \fontspec_set_fontface:NNnn . . . .
. . 44, 48, 8, 9, 10, 12, 20, 23, 29, 85, . . . . . . . . . . . . . . . . . . . 36, 161, 172
89, 90, 91, 119, 123, 124, 139, 147, \fontspec_setup_maths: . . . . . 1, 4, 134
201, 306, 318, 320, 325, 330, 337, fontspec internal commands:
356, 437, 455, 456, 460, 463, 488, \__fontspec_calc_scale:n . . . 355, 357
509, 520, 535, 592, 641, 649, 663, 671 \l__fontspec_check_bool . . . . . . .
\fontspec_gset_family:Nnn . . . 36, . . . . 87, 91, 97, 106, 138, 146, 153, 162
66, 67, 72, 73, 78, 79, 84, 85, 146, 158 \__fontspec_update_featstr:n . . . . 97
\fontspec_gset_fontface:NNnn . . . \FONTSPECDTX . . . . . . . . . . . . . . . . . . . . . . 2
. . . . . . . . . . . . . . . . . . . 36, 161, 171 \FontspecSetCheckBoolFalse . . . . . . . . 58
\fontspec_if_aat_feature:nn . . . . . . 5 \FontspecSetCheckBoolTrue . . . . . . . . . 58
\fontspec_if_aat_feature:nnTF . 36, 5 fp commands:
\fontspec_if_current_feature:n . 183 \fp_eval:n . . . . . . . . . . . . 328, 344, 360
\fontspec_if_current_feature:nTF \fp_new:N . . . . . . . . . . . . . . . . . 43, 44
. . . . . . . . . . . . . . . . . . . 37, 183, 284
\fontspec_if_current_language:n 131 G
\fontspec_if_current_language:nTF \g . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
. . . . . . . . . . . . . . . . . . . . . . . 37, 131 \Gamma . . . . . . . . . . . . . . . . . . . . . . . . . . 52
\fontspec_if_current_script:n . . 116 \gdef . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
\fontspec_if_current_script:nTF \GetFileInfo . . . . . . . . . . . . . . . . . . . . . 54
. . . . . . . . . . . . . . . . . . . . . . . 37, 116 \global . . . . . . . . . . . . . . . . . . . . . . . . . . 7
\fontspec_if_feature:n . . . . . . . . . 34 \grave . . . . . . . . . . . . . . . . . . . . . . . . . . 19
\fontspec_if_feature:nnn . . . . . . . 60 group commands:
\fontspec_if_feature:nnnTF . . . 37, 60 \group_begin: 4, 28, 37, 40, 152, 175,
\fontspec_if_feature:nTF . . . . 37, 34 269, 290, 297, 333, 354, 426, 435, 561
\fontspec_if_fontspec_font: . . . . . . 1 \group_end: . . . . . . . . . . . . . . . . . .
\fontspec_if_fontspec_font:TF 36, 33, 41, 42, 46, 49, 163, 179, 180, 277,
1, 7, 25, 36, 62, 75, 88, 105, 118, 133, 150 293, 300, 349, 363, 430, 431, 439, 564
\fontspec_if_language:n . . . . . . . . 86
H
\fontspec_if_language:nn . . . . . . 103
\hat . . . . . . . . . . . . . . . . . . . . . . . . . 122, 25
\fontspec_if_language:nnTF . . . 37, 103
\hbar . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
\fontspec_if_language:nTF . . . 37, 86
\fontspec_if_opentype: . . . . . . . . . 23 I
\fontspec_if_opentype:TF . . . . 36, 23 \IfBooleanTF . . . . . . . . . . . . . . . . . 121, 133
\fontspec_if_script:n . . . . . . . . . . 73 \ifcase . . . . . . . . . . . . . . . . . . . . . . . . 384
\fontspec_if_script:nTF . . . . . 37, 73 \ifdefined . . . . . . . . . . . . . . . . . 27, 40, 53
\fontspec_if_small_caps: . . . . . . 191 \IfFontExistsTF . . . . . . . . . . . . . . . . . 182
\fontspec_if_small_caps:TF . . . 37, 191 \IfFontFeatureActiveTF . . . . . . . . 124, 260
\fontspec_maybe_setup_maths: . . . \IfNoValueTF . . . . . . . . . . . . . . . . . . . . . 75
. . . . . . . . . . . . . . . . . . . . 94, 94, 137 \ifnum . . . . . . . . . . . . . . . . . . . 90, 191, 391
\fontspec_new_lang:nn . . . . . . 118, 366 \ifx . . . . . . 15, 28, 30, 98, 110, 116, 814, 815
\fontspec_new_script:nn . . . . 114, 296 \ignorespaces . . . . . . . . 4, 9, 14, 19, 78, 169
\fontspec_parse_colour:niii . . . . \InputIfFileExists . . . . . . . . . . . . . . . . 3
. . . . . . . . . . . . . . . . . . . 478, 502, 512 int commands:
\fontspec_parse_cv:w . . . . . . . 252, 265 \int_case:nn . . . . . . . . . . . . . 62, 83, 88
\_fontspec_parse_wordspace:w . . . \int_case:nnTF . . . . . . . . . . . . . . . 374
. . . . . . . . . . . . . . . . . . . 385, 388, 388 \int_compare:nNnTF . . . . . . . . . . . . 144

139
\int_compare:nTF . . 32, 58, 79, 104, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
300, 474, 477, 498, 501, 535, 788, 807 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62
\int_compare_p:nNn . . . . . . 88, 139, 189 \mathbf . . . . . . . . . . . . . . . . 124, 60, 78, 88
\int_eval:n . . . . . . . . . . . . . . . . . . 283 \mathbin . . . . . . . . . . . . . . . . . . . . . . . . 63
\int_if_even:nTF . . . . . . . . . . . . . . 37 \mathchar . . . . . . . . . . . . . . . . . . . . . . . 71
\int_incr:N . . . . . . . 47, 62, 94, 150, 196 \mathchardef . . . . . . . . . . . . . . . . . . . . . 29
\int_new:N . . . . . . . . . . . . . . . . . . . \mathclose . . . . . . . . . . . . . . 36, 39, 66, 68
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42 \mathdollar . . . . . . . . . . . . . . . . . . . . . 70
\int_set:Nn . . . . . . . . 11, 42, 45, 58, \mathit . . . . . . . . . . . . . . . . . 60, 77, 84, 89
69, 77, 85, 92, 94, 135, 141, 147, 184, \mathopen . . . . . . . . . . . . . . . . . . . . 65, 67
194, 309, 324, 348, 376, 391, 525, 810 \mathord . . . . . . . . . . . . . . . . . . . . . 69, 70
\int_to_hex:n . . . . . . . . . . . . . . . . 536 \mathpunct . . . . . . . . . . . . . . . . . . . 31, 38
\int_use:N . . . . . . . . . . . . 46, 55, 59, 64 \mathrel . . . . . . . . . . . . . . . . . . . . . 37, 64
\int_zero:N . . . . . . . . . . . . . . . . . . \mathring . . . . . . . . . . . . . . . . . . . . . . . 27
. . . . . 38, 67, 77, 86, 137, 180, 187, 407 \mathrm . . . . . . . . . . . . . . . . 28, 124, 76, 87
\l_tmpa_int . . . . . . . . . . . . . . . . 86, \mathsf . . . . . . . . . . . . . . . . . . . . . . 79, 91
88, 90, 92, 94, 187, 189, 192, 194, 196 \mathtt . . . . . . . . . . . . . . . . . . . . . . 80, 92
\l_tmpb_int . . . 85, 88, 92, 184, 189, 194 \mddefault . . . . . . . . . . . . . . . . . . . 74,
\itdefault 2, 9, 12, 15, 77, 84, 89, 339, 342, 75, 77, 79, 80, 87, 89, 337, 339, 340,
572, 573, 577, 606, 607, 612, 627, 630 341, 625, 627, 628, 629, 641, 643, 645
\mkern . . . . . . . . . . . . . . . . . . . . . . . . . . 71
K msg commands:
keys commands: \msg_error:nn . . . . . . . . . . . . . . . . . . 1
\l_keys_choice_int . . . 58, 62, 79, 83, 88 \msg_error:nnn . . . . . . . . . . . . . . . 2, 3
\keys_define:nn . . . . . . . . 3, 3, 7, 9, \msg_error:nnnn . . . . . . . . . . . . . . . . 4
14, 20, 22, 31, 36, 39, 53, 69, 74, 81, \msg_fatal:nn . . . . . . . . . . . . . . . . . 21
92, 173, 215, 217, 228, 233, 236, 240, \msg_info:nn . . . . . . . . . . . . . . . . . . . 8
247, 259, 272, 282, 291, 298, 337,
\msg_info:nnn . . . . . . . . . . . . . . . . . . 9
361, 368, 453, 609, 617, 625, 633, 655
\msg_info:nnnn . . . . . . . . . . . . . . . . 10
\keys_if_choice_exist:nnnTF . 183, 193
\msg_line_context: . . . . . . . . . . . . 100
\keys_if_exist:nnTF . . . . . . . . . . .
\msg_new:nnn . . . 12, 15, 15, 31, 168, 172
. . . . . . . . 180, 190, 211, 229, 237, 244
\msg_new:nnnn . . . . . . . . . . . . . . 13, 17
\l_keys_key_tl . . . . . . . . . . . . 118, 123
\msg_redirect_module:nnn . . . . . .
\keys_set:nn . . . . . 8, 15, 31, 41, 111,
. . . . . . . . . . . . . 17, 18, 22, 23, 27, 28
116, 215, 216, 216, 234, 241, 248, 556
\msg_redirect_name:nnn . . . . . . . . 555
\keys_set_groups:nnn . . . . . . . . . . 448
\msg_trace:nn . . . . . . . . . . . . . . . . . 11
\keys_set_known:nn . . 17, 231, 236, 241
\msg_warning:nn . . . . . . . . . . . . . . 3, 5
\keys_set_known:nnN . . . . . 63, 153, 482
\msg_warning:nnn . . . . . . . . 6, 6, 13, 14
\l_keys_value_tl . . . . . . . . . . 118, 123
\msg_warning:nnnn . . . . . . . . . . . . . . 7
L
N
\l . . . . . . . . . . . . . . .. 31, 54, 56, 68–70, 75
\newAATfeature . . . . . . . . . . . . . . . . 92, 178
\Lambda . . . . . . . . . . .. . . . . . . . . . . . . . 55
\latinencoding . . . . .. . . . . . . . . 52, 56, 88 \NewDocumentCommand . . . . . 1, 6, 11, 16,
\liningnums . . . . . . .. . . . . . . 35, 135, 288 21, 25, 29, 33, 37, 41, 43, 45, 49, 53,
lua commands: 57, 59, 61, 65, 69, 73, 80, 84, 88, 92,
\lua_now:n . . . . . . . 6, 72, 73, 74, 75, 105 96, 100, 104, 108, 112, 116, 120, 124, 135
\LuaLaTeX . . . . . . . . . . . . . . . . . . . . . . . 33 \newfontface . . . . . . . . . . . . . . . . . . 30, 57
\newfontfamily . . . . . . . . . . . . . . . . . . . 41
M \newfontfeature . . . . . . . . . . . . 32, 88, 171
\mathalpha . . . . . . . . . . . . . . . . . . . . . \newfontlanguage . . . . . . . . . . . . . . . 1,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,

140
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
95, 96, 97, 98, 99, 100, 101, 102, 103, 99, 100, 101, 102, 103, 104, 105, 106,
104, 105, 106, 107, 108, 109, 110, 107, 108, 109, 110, 111, 112, 112,
111, 112, 113, 114, 115, 116, 116, 113, 114, 115, 116, 117, 118, 119,
117, 118, 119, 120, 121, 122, 123, 120, 121, 122, 123, 124, 125, 126,
124, 125, 126, 127, 128, 129, 130, 127, 128, 129, 130, 131, 132, 133,
131, 132, 133, 134, 135, 136, 137, 134, 135, 136, 137, 138, 139, 140,
138, 139, 140, 141, 142, 143, 144, 141, 142, 143, 144, 145, 146, 147,
145, 146, 147, 148, 149, 150, 151, 148, 149, 150, 151, 152, 153, 154,
152, 153, 154, 155, 156, 157, 158, 155, 156, 157, 158, 159, 160, 161,
159, 160, 161, 162, 163, 164, 165, 162, 163, 164, 165, 166, 167, 168, 169
166, 167, 168, 169, 170, 171, 172, \newICUfeature . . . . . . . . . . . . . . . . . . 100
173, 174, 175, 176, 177, 178, 179, \newopentypefeature . . . . . . . . . . . 96, 188
180, 181, 182, 183, 184, 185, 186, \normalfont . . . . . . . . . . . 36, 41, 49, 62, 76
187, 188, 189, 190, 191, 192, 193, \normalsize . . . . . . . . . . . . . . . . . . 50, 562
194, 195, 196, 197, 198, 199, 200, \nullfont . . . . . . . . . . . . . . . . . . . . . . . 15
201, 202, 203, 204, 205, 206, 207, \numexpr . . . . . . . . . . . . . . . . . . . . . . . . 44
208, 209, 210, 211, 212, 213, 214,
215, 216, 217, 218, 219, 220, 221, O
222, 223, 224, 225, 226, 227, 228, \oldstylenums . . . . . . . . . . . . . 35, 128, 288
229, 230, 231, 232, 233, 234, 235, \Omega . . . . . . . . . . . . . . . . . . . . . . . . . . 62
236, 237, 238, 239, 240, 241, 242, \or . . . . . . . . . . . . . . . . . . . . 387, 395, 399
243, 244, 245, 246, 247, 248, 249,
250, 251, 252, 253, 254, 255, 256, P
257, 258, 259, 260, 261, 262, 263, Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
264, 265, 266, 267, 268, 269, 270, \Phi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
271, 272, 273, 274, 275, 276, 277, \Pi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
278, 279, 280, 281, 282, 283, 284, prg commands:
285, 286, 287, 288, 289, 290, 291, \prg_new_conditional:Nnn . . . . . 1,
292, 293, 294, 295, 296, 297, 298, 5, 13, 21, 21, 23, 26, 26, 34, 35, 44,
299, 300, 301, 302, 303, 304, 305, 60, 73, 73, 73, 86, 103, 116, 119, 123,
306, 307, 308, 309, 310, 311, 312, 131, 167, 173, 183, 191, 252, 266, 424
313, 314, 315, 316, 317, 318, 319, \prg_return_false: . . . . . . 3, 13, 16,
320, 321, 322, 323, 324, 325, 326, 18, 20, 24, 28, 29, 30, 31, 32, 41, 49,
327, 328, 329, 330, 331, 332, 333, 50, 51, 53, 57, 67, 69, 71, 80, 80, 82,
334, 335, 336, 337, 338, 339, 340, 83, 84, 97, 97, 99, 101, 110, 112, 113,
341, 342, 343, 344, 345, 346, 347, 114, 121, 125, 127, 129, 130, 140,
348, 349, 350, 351, 352, 353, 354, 142, 144, 153, 162, 173, 180, 189,
355, 356, 357, 358, 359, 360, 361, 199, 206, 209, 210, 263, 282, 285, 430
362, 363, 364, 365, 366, 367, 368, \prg_return_true: . . . . . . . . . . . 3,
369, 370, 371, 372, 373, 374, 375, 13, 16, 24, 28, 29, 32, 42, 47, 50, 54,
376, 377, 378, 379, 380, 381, 382, 383 67, 77, 80, 83, 97, 97, 109, 110, 121,
125, 127, 140, 153, 162, 170, 179,
\newfontscript . . . . . . . 1, 2, 3, 4, 5, 6, 7, 189, 199, 207, 210, 269, 275, 285, 431
8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, \ProcessKeyOptions . . . . . . . . . . . . . . . 37

141
prop commands: R
\prop_gclear:N . . . . . . . . . . . . . 37, 765 \relax . . . . . . . . . . . . . . . . . . . . 29, 44, 391
\prop_get:NnN . . . . . . . . . . . . . . . . \renewcommand . . . . . . . . . . . . . . . . . . . . 71
41, 44, 47, 48, 93, 95, 123, 138, 154, 155 \RenewDocumentCommand . . . . . . . 47, 63, 130
\prop_get:NnNTF . . . . . . . . . . . . . . \renewfontface . . . . . . . . . . . . . . . . . . . 61
. . . 56, 64, 123, 126, 135, 260, 280, 446 \renewfontfamily . . . . . . . . . . . . . . . . . 45
\prop_gput:Nnn . . . . . . . . . . . 6, 22, \RequirePackage . . . . . . . 5, 7, 12, 42, 47, 48
46, 79, 138, 143, 215, 216, 217, 218, \rmdefault . . . . . 29, 124, 31, 33, 45, 99, 128
219, 220, 221, 222, 223, 224, 225, \rmfamily . . . . . . . . . . . . . . . . . . 84, 7, 373
226, 227, 228, 229, 230, 231, 232,
233, 234, 235, 236, 237, 238, 239, S
240, 241, 242, 243, 244, 245, 246, scan commands:
247, 248, 249, 250, 251, 252, 253, \scan_stop: . . . . . . . . . . . . . 3, 7, 46, 54
254, 255, 256, 257, 258, 259, 260, \scdefault . . . . . . . . 2, 3, 4, 8, 9, 10, 11,
261, 262, 263, 264, 265, 266, 267, 12, 13, 14, 17, 18, 554, 555, 556, 641, 642
268, 269, 270, 271, 272, 273, 274, \scitdefault . . . 2, 9, 12, 15, 16, 17, 643, 644
275, 276, 277, 278, 279, 280, 281, \scsldefault . . 3, 10, 13, 15, 16, 18, 645, 646
282, 283, 284, 285, 286, 286, 287, \scswdefault . . . . . . . . . . . . . . . . . 4, 11, 14
288, 288, 289, 290, 291, 292, 293, \select . . . . . . . . . . . . . . . . . . . . . . . . . 19
294, 295, 296, 297, 298, 299, 300, \selectfont . . . . . . . . . . . 5, 111, 164, 337
301, 302, 302, 303, 303, 304, 304, seq commands:
305, 306, 307, 308, 309, 309, 310, \seq_if_empty:NTF . . . . . . . . . . . . 169
310, 311, 311, 312, 312, 313, 314, \seq_new:N . . . . . . . . . . . . . . . . . . . . 48
315, 316, 317, 318, 319, 320, 321, \seq_put_right:Nn . . . . . . . . . 157, 172
322, 323, 324, 325, 326, 327, 328, \setboldmathrm . . . . . . . . 28, 124, 25, 70, 96
329, 330, 331, 332, 333, 334, 335, 336 \setfontface . . . . . . . . . . . . . . . . . . . . . 65
\prop_gput_from_keyval:Nn . . . . . 603 \setfontfamily . . . . . . . . . . . . . . . . . . . 49
\prop_gput_if_not_in:Nnn . . . . 45, 78 \SetKeys . . . . . . . . . . . . . . . . . . . . . . . . 36
\prop_gremove:Nn . . . . . . . . . . . . . 142 \setmainfont . . . . . . . . . . . 24, 28, 122, 6, 24
\prop_if_empty:NTF . . . . . . . . . . . . 736 \SetMathAlphabet . . . . . . . . . . . . . . . .
\prop_if_in:NnTF . . . . . . . . . . . 20, 101 . . . 77, 78, 79, 80, 84, 87, 88, 89, 91, 92
\setmathrm . . . . . . . . . . . . . 124, 21, 64, 95
\prop_map_function:NN . . . . . . . . . 740
\prop_map_inline:Nn . . . . . . . . . . . 345 \setmathsf . . . . . . . . . . . . . . . . . 29, 76, 97
\prop_new:N . . . . . . . . . . . . . . . . 73, \setmathtt . . . . . . . . . . . . . . . . . 33, 82, 98
74, 75, 76, 77, 78, 79, 80, 81, 82, 301 \setmonofont . . . . . . . . . . . . . . . . . . 16, 51
\prop_put:Nnn . . . . . . . . . 180, 216, 371 \setromanfont . . . . . . . . . . . . . . . . . . . . 37
\providecommand . . . . . . . . . . . . . . . 2, 3, 4 \setsansfont . . . . . . . . . . . . . . . . . . 11, 38
\ProvideDocumentCommand . . . . . . . . 55, 71 \SetSymbolFont . . . . . . . . . . . . . . 17, 75, 81
\providefontface . . . . . . . . . . . . . . . . . 69 \settoheight . . . . . . . . . . . . . . . . . . . . 371
\providefontfamily . . . . . . . . . . . . . . . 53 \sfdefault . . . . . . . . . . 44, 46, 46, 100, 129
\ProvidesExplFile . . . . . . . . . . . . . . . . 48 \sffamily . . . . . . . . . . . . . . . . . . . . . . . . 7
\ProvidesExplPackage . . . . . . . . . 43, 44, 45 \shapedefault 8, 17, 18, 74, 75, 78, 79, 80,
\Psi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 81, 87, 88, 91, 92, 205, 337, 338, 625, 626
\Sigma . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Q \sldefault . . . . . . . . . . . . . . . 3, 10, 13,
\qquad . . . . . . . . . . . . . . . . . . . . . . . . . . 55 16, 340, 343, 573, 576, 607, 611, 628, 631
quark commands: \space . . . . . . . . . . . . . . . . . 34, 39, 44, 201
\q_nil . . . . . . . . . . . . . . . . . . . . . . str commands:
70, 71, 199, 200, 253, 266, 777, 780, \c_backslash_str . . . . . . . . . . . . . . 78
783, 784, 786, 796, 799, 802, 803, 805 \c_colon_str . . . . . . . . . . . . . . 253, 266
\q_stop . . . . . . . . . . . . . . . . . . 385, 388 \str_case:nn . . . . . . . . . . . 72, 623, 639

142
\str_case:nnTF . . . . . . . . . . . . 202, 316 \tex_iffontchar:D . . . . . . . . . . . . . 46
\str_case_e:nnTF . . . . . . . . . . . . . 410 \textsc . . . . . . . . . . . . . . . . . . . . . . . . . 36
\str_if_eq:nnTF . 33, 46, 59, 87, 121, \textsf . . . . . . . . . . . . . . . . . . . . . . . . . 32
124, 139, 178, 179, 247, 373, 439, 552 \Theta . . . . . . . . . . . . . . . . . . . . . . . . . . 54
\str_if_eq_p:nn . . . . . . . . . . . . . . \tilde . . . . . . . . . . . . . . . . . . . . . . . . . . 21
. 572, 573, 584, 585, 606, 607, 782, 801 \title . . . . . . . . . . . . . . . . . . . . . . . . . . 31
\str_lowercase:n . . . . . . . . . . . 87, 121 tl commands:
\string . . . . . . . . . . . . . . . . 22, 60, 80, 100 \c_empty_tl . . . . . . . . . . . . . . . . . .
\strong . . . . . . . . . . . . . . . . . . . . . . 128, 72 . . . . . 65, 783, 784, 802, 803, 814, 815
\strongenv . . . . . . . . . . . . . . . . 128, 51, 72 \tl_build_begin:N . . . . . . . . . 461, 462
\strongfontdeclare . . . . . . . . . 128, 35, 79 \tl_build_end:N . . . . . . . . . . . 467, 468
\strongreset . . . . . . . . . . . . 128, 42, 68, 73 \tl_build_put_right:Nn . . . . . . . . 532
\suppressfontnotfounderror . . . . . . . . 11 \tl_clear:N . . . . . . . . . . . . . . . . . .
\swdefault . . . . 4, 11, 14, 341, 344, 629, 632 . 23, 24, 44, 128, 136, 297, 307, 357,
sys commands: 479, 751, 752, 753, 754, 767, 771, 772
\sys_if_engine_luatex:TF . . . . . . . . 3 \tl_clear_new:N . . . . . . . . . . 86, 87, 88
\sys_if_engine_xetex:TF . . . . . . . . 10 \tl_const:Nn . . . . . . 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 159, 160, 161, 162
T \tl_count:n . 474, 477, 498, 501, 788, 807
TEX and LATEX 2ε commands: \tl_gclear:N . . . 268, 755, 756, 764, 766
\@ . . . . . . . . . . . . . . . . . . . . . . . . . 31, 64 \tl_gput_right:Nn . . . . . . . . . 620, 712
\@filelist . . . . . . . . . . . . . . . . . . . . 50 \tl_gremove_all:Nn . . . . . . . . . . . . 721
\@ifpackageloaded . . . . . . . . . . . . \tl_gset:Nn . 44, 65, 93, 99, 100, 101,
. . 1, 6, 13, 14, 15, 96, 100, 101, 102, 128, 129, 130, 156, 171, 287, 289,
103, 104, 105, 106, 107, 108, 112, 311, 325, 350, 377, 392, 408, 607, 710
113, 114, 118, 119, 120, 121, 122, \tl_gset_eq:NN . 158, 171, 262, 273, 757
123, 124, 125, 126, 127, 128, 129, 130 \tl_if_empty:NTF . . . . . . . . 29, 46,
\@nomath . . . . . . . . . . . . . . . . . . . . . 53 50, 82, 96, 111, 116, 212, 244, 258,
\@onlypreamble . . . . . . . . 95, 96, 97, 98 258, 282, 327, 369, 390, 398, 402,
\@rmfamilyhook . . . . . . . . . . . . . . . 7, 9 415, 484, 497, 527, 546, 595, 636,
\@sffamilyhook . . . . . . . . . . . . . . . . 10 644, 663, 664, 666, 671, 672, 673, 732
\@tempa . . . . . . . . . . . . . . . . . . . 29, 30 \tl_if_empty:nTF . . . . . . 14, 18, 29,
\@ttfamilyhook . . . . . . . . . . . . . . . . 11 80, 137, 141, 161, 200, 365, 390, 413, 650
\add@unicode@accent . . . . . . . . . . . . 11 \tl_if_empty_p:N . . . . . . . . . . . . . 199
\color@ . . . . . . . . . . . . . . . . . . 469, 493 \tl_if_empty_p:n . . . . . . . 79, 129, 172
\curr@fontshape . . . . . . . 102, 159, 207 \tl_if_eq:NNTF . . . . . . . . 203, 515, 527
\define@antt@mathversions . . . . . . 98 \tl_if_eq:nnTF . . . . . . . . . . . . . 81, 175
\define@iwona@mathversions . . . . . 110 \tl_if_exist:NTF . . . . . . . . . . 146, 554
\define@kurier@mathversions . . . . 116 \tl_if_exist_p:N . . . . . . . . . . . . . . 24
\f@encoding . . . . . . . . 28, 201, 204, 205 \tl_if_in:NnTF . . . . . . 50, 63, 303, 356
\f@family . . . 3, 3, 28, 41, 44, 47, 48, \tl_if_in:nnTF . . . . . . . . . . . . . 80, 187
93, 95, 123, 138, 154, 155, 201, 204, 205 \tl_if_single:nTF . . . . . . . . . 129, 447
\f@series . . 28, 45, 56, 59, 201, 204, 205 \tl_new:N . . . . . . . . . . . . 83, 84, 85,
\f@shape . . . . . . . . . . . . . . . 24, 29, 195 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
\f@size . . . . . . . . . . . . . . . . 39, 102, 99, 100, 101, 102, 103, 104, 105, 106,
159, 161, 168, 207, 427, 428, 450, 563 107, 108, 109, 110, 111, 112, 113,
\reset@font . . . . . . . . . . . . . . . . . . . 74 114, 115, 116, 117, 118, 119, 120,
\two@digits . . . . . . . . . . . 244, 256, 257 121, 122, 123, 124, 125, 126, 127,
tex commands: 131, 132, 133, 134, 135, 136, 137,
\tex_font:D . . . . . . . . . . . . . . . . . . . 59 138, 139, 140, 141, 142, 143, 144,
\tex_hyphenchar:D . . . . . . . . . . . . . 54 146, 146, 147, 149, 150, 151, 152,

143
153, 154, 155, 156, 157, 158, 161, 234, 239, 240, 246, 255, 256, 262,
163, 164, 165, 166, 167, 168, 169, 170 263, 279, 280, 300, 302, 305, 306,
\tl_put_left:Nn . . . . . . . . . . . . . . . 46 317, 339, 345, 349, 356, 377, 384,
\tl_put_right:Nn . . . . . . . . . . . . . 385, 388, 392, 396, 400, 443, 460,
. . . . . . . . 9, 10, 11, 137, 431, 441, 453 485, 490, 501, 505, 520, 521, 525,
\tl_remove_all:Nn . . . . . 100, 108, 267 560, 685, 707, 711, 717, 720, 747, 795
\tl_remove_once:Nn . . . . . . . . . . . . . 66
\tl_replace_all:Nnn . . . 14, 16, 18, 358 U
\tl_set:Nn 21, 22, 22, 23, 23, 26, 28, 28, \UndeclareAccent . . . . . . . . . . . . . . . . . 55
34, 38, 39, 42, 45, 46, 47, 49, 53, 54, \UndeclareCommand . . . . . . . . . . . . . . . . 55
60, 67, 81, 86, 99, 102, 103, 104, 105, \UndeclareComposite . . . . . . . . . . . . . . 73
112, 117, 123, 124, 128, 129, 130,
\UndeclareSymbol . . . . . . . . . . . . . . . . . 55
145, 148, 150, 151, 155, 159, 160,
162, 165, 166, 169, 198, 207, 208, \UndeclareTextCommand . . . . . . . . 59, 65, 71
259, 263, 266, 275, 282, 285, 293, \unexpanded . . . . . . . . . . . . . . . . . 117, 126
307, 308, 322, 323, 327, 328, 342, \UnicodeEncodingName . . . . . . . . . . . . 5,
346, 347, 350, 355, 358, 363, 364, 11, 17, 23, 29, 48, 49, 53, 59, 65, 71, 78
375, 390, 390, 392, 398, 400, 402, \UnicodeFontFile . . . . . . . 38, 40, 42, 44, 46
406, 414, 418, 419, 424, 448, 449, \UnicodeFontTeXLigatures 38, 40, 42, 44, 46
475, 490, 499, 514, 520, 529, 532, \Upsilon . . . . . . . . . . . . . . . . . . . . . . . . 59
542, 546, 581, 598, 639, 658, 661, 759 \url . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
\tl_set_eq:NN . . . . . . . . . . 9, 10, 31, use commands:
32, 34, 44, 45, 47, 48, 48, 49, 51, 52, \use:N . . . . . . . . . . . . . . . . . . . 103, 109
53, 55, 56, 57, 58, 60, 89, 90, 91, 147, \use:n . . . . . . . . 105, 158, 192, 250, 482
159, 172, 177, 195, 306, 356, 463, \use_i:nnn . . . . . . . . . . . . . . . . . . . 312
480, 641, 649, 663, 671, 768, 769, 770 \use_ii:nnn . . . . . . . . . . . . . . . . . . 312
\tl_tail:n . . . . . . . . . . . . . . . . 725, 739 \use_iii:nnn . . . . . . . . . . . . . . . . . 298
\tl_to_str:N . . . . . . . . . . . . . . . . . . 23 \use_none:nn . . 88, 89, 90, 91, 92, 93, 94
\tl_to_str:n . . . . . . . . . . . . . . . 78, 188 \UTFencname . . . . . . . . . . . . . . . . . . 49, 86
\tl_trim_spaces:N . . . . . . . . . . . . . 55
\tl_trim_spaces:n . . . . . . . . . . 15, 17 X
\tl_use:N . . . . . . . . . . . . . . . . . 29, 555 \XeLaTeX . . . . . . . . . . . . . . . . . . . . . . . . 33
\tmpa . . . . . . . . . . . . . . . . . . . . . . . . 27, 28 \XeTeXcountvariations . . . . . . . . . . . . 391
token commands: \XeTeXfeaturename . . . . . . . . . . . . . . . . 28
\token_to_str:N . . . . . . . . 78, 469, 493 \XeTeXfonttype . . . . . . . . . . . . . . . . . . 384
\ttdefault . . . . . . . . . . 47, 57, 59, 101, 130 \XeTeXisexclusivefeature . . . . . . . . . . 32
\ttfamily . . . . . . . . . . . . . . . . . . . . . . . . 7 \XeTeXOTcountfeatures . . . . . . . . . . . . 185
\typeout . . . . . . . . . . . . . . . . . . . . . . 3, \XeTeXOTcountlanguages . . . . . . . . . . . 136
5, 12, 25, 26, 29, 30, 31, 43, 44, 49, \XeTeXOTcountscripts . . . . . . . . . . . . . . 85
55, 59, 62, 64, 64, 65, 65, 75, 75, 83, \XeTeXOTfeaturetag . . . . . . . . . . . . . . 191
91, 98, 104, 108, 112, 117, 125, 126, \XeTeXOTlanguagetag . . . . . . . . . . . . . 142
141, 149, 149, 155, 156, 157, 158, \XeTeXOTscripttag . . . . . . . . . . . . . . . . 90
164, 176, 182, 185, 186, 197, 202, \XeTeXselectorname . . . . . . . . . . 34, 39, 44
206, 209, 213, 214, 222, 230, 231, \Xi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

144

You might also like