Debian Codegraph @

texmf-dist/source/latex/fontspec/fontspec-code-xfss.dtx

raw
1 %%^^A%% fontspec-code-xfss.dtx -- part of FONTSPEC <latex3.github.io/fontspec>
2
3 % \section{Changes/additions to the NFSS}
4 %
5 % \begin{function}{\strong, \strongenv}
6 % \begin{syntax}
7 % "\strong" \marg{text}
8 % "\begin{strongenv}" \meta{text} "\end{strongenv}"
9 % \end{syntax}
10 % Typesets text in the `strong' font. NFSS series equivalent to \cs{emph}. Can be nested.
11 % \end{function}
12 %
13 % \begin{function}{\strongfontdeclare}
14 % \begin{syntax}
15 % "\strongfontdeclare" \marg{comma-separated font switch declarations}
16 % \end{syntax}
17 % Define the behaviour of nested \cs{strong} commands.
18 % \end{function}
19 %
20 % \begin{function}{\strongreset}
21 % \begin{syntax}
22 % "\renewcommand \strongreset" \marg{font switch declarations}
23 % \end{syntax}
24 % Define the behaviour when a \cs{strong} command is nested deeper than the definitions provided by \cs{strongfontdeclare}.
25 % By default this is \meta{empty} --- i.e., bold on top of bold remains bold.
26 % In certain circumstances it may be appropriate to reset to a default state.
27 % \end{function}
28 %
29 %
30 % \section{Implementation}
31 %
32 % \begin{macrocode}
33 %<*fontspec>
34 % \end{macrocode}
35 %
36 %
37 % \subsection{Italic small caps and so on} \label{sec:sishape}
38 %
39 % \begin{macrocode}
40 \providecommand*\scitdefault{\scdefault\itdefault}
41 \providecommand*\scsldefault{\scdefault\sldefault}
42 \providecommand*\scswdefault{\scdefault\swdefault}
43 % \end{macrocode}
44 % \LaTeX's `shape' font axis needs to be overloaded to support italic small caps and slanted small caps.
45 % These are the combinations to support:
46 % \begin{macrocode}
47 \cs_new:Nn \@@_shape_merge:nn { c_@@_shape_#1_#2_tl }
48 \cs_new:Nn \@@_merge_default_shapes:
49 {
50 \tl_const:cn { \@@_shape_merge:nn \shapedefault\scdefault } {\scdefault}
51 \tl_const:cn { \@@_shape_merge:nn \itdefault \scdefault } {\scitdefault}
52 \tl_const:cn { \@@_shape_merge:nn \sldefault \scdefault } {\scsldefault}
53 \tl_const:cn { \@@_shape_merge:nn \swdefault \scdefault } {\scswdefault}
54 \tl_const:cn { \@@_shape_merge:nn \scdefault \itdefault } {\scitdefault}
55 \tl_const:cn { \@@_shape_merge:nn \scdefault \sldefault } {\scsldefault}
56 \tl_const:cn { \@@_shape_merge:nn \scdefault \swdefault } {\scswdefault}
57 \tl_const:cn { \@@_shape_merge:nn \scsldefault \itdefault } {\scitdefault}
58 \tl_const:cn { \@@_shape_merge:nn \scitdefault \sldefault } {\scsldefault}
59 \tl_const:cn { \@@_shape_merge:nn \scitdefault \shapedefault } {\scdefault}
60 \tl_const:cn { \@@_shape_merge:nn \scsldefault \shapedefault } {\scdefault}
61 }
62 \@@_merge_default_shapes:
63 % \end{macrocode}
64 %
65 % The following is rather specific; it only returns true if the merged shape exists,
66 % but more importantly also if the merged shape is defined for the current font.
67 % \begin{macrocode}
68 \prg_new_conditional:Nnn \@@_if_merge_shape:n {TF}
69 {
70 \bool_lazy_and:nnTF
71 { \tl_if_exist_p:c { \@@_shape_merge:nn {\f@shape} {#1} } }
72 {
73 \cs_if_exist_p:c
74 {
75 \f@encoding/\f@family/\f@series/
76 \tl_use:c { \@@_shape_merge:nn {\f@shape} {#1} }
77 }
78 }
79 \prg_return_true: \prg_return_false:
80 }
81 % \end{macrocode}
82 %
83 %
84 % \begin{macrocode}
85 \cs_set_eq:NN \emfontdeclare \DeclareEmphSequence
86 % \end{macrocode}
87 %
88 %
89 %
90 %
91 % \subsection{Strong emphasis}
92 %
93 % \begin{macro}{\strongfontdeclare}
94 % \begin{macrocode}
95 \cs_set_protected:Npn \strongfontdeclare #1
96 {
97 \prop_gclear:N \g_@@_strong_prop
98 \int_zero:N \l_@@_strongdef_int
99
100 \group_begin:
101 \normalfont
102 \clist_map_inline:nn {\strongreset,#1}
103 {
104 ##1
105 \prop_gput_if_not_in:NeV \g_@@_strong_prop { \f@series } { \l_@@_strongdef_int }
106 \prop_gput:Nen \g_@@_strong_prop { switch-\int_use:N \l_@@_strongdef_int } { ##1 }
107 \int_incr:N \l_@@_strongdef_int
108 }
109 \group_end:
110 }
111 % \end{macrocode}
112 % \end{macro}
113 %
114 % \begin{macro}{\strongenv}
115 % \begin{macrocode}
116 \DeclareRobustCommand \strongenv
117 {
118 \@nomath\strongenv
119
120 %<debug> \typeout{Strong~ level:~\int_use:N \l_@@_strong_int}
121 \prop_get:NeNT \g_@@_strong_prop { \f@series } \l_@@_strong_tmp_tl
122 {
123 \int_set:Nn \l_@@_strong_int { \l_@@_strong_tmp_tl }
124 %<debug> \typeout{Series~ (\f@series)~ detected;~ new~ level:~\int_use:N \l_@@_strong_int}
125 }
126
127 \int_incr:N \l_@@_strong_int
128
129 \prop_get:NeNTF \g_@@_strong_prop { switch-\int_use:N \l_@@_strong_int } \l_@@_strong_switch_tl
130 { \l_@@_strong_switch_tl }
131 {
132 \int_zero:N \l_@@_strong_int
133 \strongreset
134 }
135
136 }
137 % \end{macrocode}
138 % \end{macro}
139 %
140 % \begin{macro}{\strong}
141 % \begin{macrocode}
142 \DeclareTextFontCommand{\strong}{\strongenv}
143 % \end{macrocode}
144 % \end{macro}
145 %
146 % \begin{macro}{\strongreset}
147 % \begin{macrocode}
148 \cs_set:Npn \strongreset {}
149 % \end{macrocode}
150 % \end{macro}
151 %
152 % \begin{macro}[int]{\reset@font}
153 % Ensure nesting resets when necessary:
154 % \begin{macrocode}
155 \cs_set_protected:Npn \reset@font
156 {
157 \normalfont
158 \int_zero:N \l_@@_strong_int
159 }
160 % \end{macrocode}
161 % \end{macro}
162 %
163 % \subsection{Defaults}
164 %
165 % \begin{macrocode}
166 \strongfontdeclare{\bfseries}
167 % \end{macrocode}
168 %
169 % \begin{macrocode}
170 %</fontspec>
171 % \end{macrocode}
172
173
174 \endinput
175
176 % /©
177 % ------------------------------------------------
178 % The FONTSPEC package <latex3.github.io/fontspec>
179 % ------------------------------------------------
180 % Copyright 2022-2025 The LaTeX project, LPPL "maintainer"
181 % Copyright 2004-2022 Will Robertson
182 % Copyright 2009-2015 Khaled Hosny
183 % Copyright 2013 Philipp Gesang
184 % Copyright 2013-2016 Joseph Wright
185 % ------------------------------------------------
186 % This package is free software and may be redistributed and/or modified under
187 % the conditions of the LaTeX Project Public License, version 1.3c or higher
188 % (your choice): <http://www.latex-project.org/lppl/>.
189 % ------------------------------------------------
190 % ©/