| 1 |
%%^^A%% fontspec-code-api.dtx -- part of FONTSPEC <latex3.github.io/fontspec> |
| 2 |
|
| 3 |
% \iffalse |
| 4 |
% \begin{macrocode} |
| 5 |
%<*fontspec> |
| 6 |
% \end{macrocode} |
| 7 |
% \fi |
| 8 |
% |
| 9 |
% \section{Programmer's interface} |
| 10 |
% |
| 11 |
% These functions are not used directly by fontspec when defining fonts; |
| 12 |
% they are designed to be used by other packages who wish to do font-related |
| 13 |
% things on top of fontspec itself. |
| 14 |
% |
| 15 |
% Because I haven't fully explored how these functions will behave in |
| 16 |
% practise, I am not giving them user-level names. As it becomes more clear |
| 17 |
% which of these should be accessible by document writers, I'll open them up |
| 18 |
% a little more. |
| 19 |
% |
| 20 |
% All functions are defined assuming that the font to be queried is |
| 21 |
% currently selected as a fontspec font. (I.e., via \verb|\fontspec| or |
| 22 |
% from a \verb|\newfontfamily| macro or from \verb|\setmainfont| and so on.) |
| 23 |
% |
| 24 |
% \section{Overview} |
| 25 |
% |
| 26 |
% \subsection{Commands} |
| 27 |
% |
| 28 |
% \begin{function}{\fontspec_gset_family:Nnn,\fontspec_set_family:Nnn} |
| 29 |
% \begin{syntax} |
| 30 |
% \verb|\fontspec_set_family:Nnn| \meta{family} \Arg{features} \Arg{font name} |
| 31 |
% \end{syntax} |
| 32 |
% Defines a new NFSS font family from given \meta{features} and \meta{font}, |
| 33 |
% and stores the name in the token list variable \meta{family}. |
| 34 |
% See the standard \pkg{fontspec} user commands for applications of this |
| 35 |
% function. |
| 36 |
% \end{function} |
| 37 |
% |
| 38 |
% \begin{function}{\fontspec_gset_fontface:NNnn,\fontspec_set_fontface:NNnn} |
| 39 |
% \begin{syntax} |
| 40 |
% \verb|\fontspec_set_fontface:NNnn| \meta{face} \meta{family} \Arg{features} \Arg{font name} |
| 41 |
% \end{syntax} |
| 42 |
% As for |\fontspec_set_family:Nnn| but with a single font face only. |
| 43 |
% (E.g., no bold, italic shapes, etc.) |
| 44 |
% The control sequence \meta{face} is a primitive \TeX\ font command. |
| 45 |
% \end{function} |
| 46 |
% |
| 47 |
% \subsection{Conditionals} |
| 48 |
% |
| 49 |
% \begin{function}[TF]{\fontspec_font_if_exist:n} |
| 50 |
% \begin{syntax} |
| 51 |
% \verb|\fontspec_font_if_exist:nTF| \Arg{font name} Arg{true code} \Arg{false code} |
| 52 |
% \end{syntax} |
| 53 |
% Does this font exist? The font name can refer to the `logical' name or to a filename with known font extension. |
| 54 |
% \end{function} |
| 55 |
% |
| 56 |
% \begin{function}[TF]{\fontspec_if_fontspec_font:} |
| 57 |
% \begin{syntax} |
| 58 |
% \verb|\fontspec_if_fontspec_font:TF| \Arg{true code} \Arg{false code} |
| 59 |
% \end{syntax} |
| 60 |
% \end{function} |
| 61 |
% |
| 62 |
% \begin{function}[TF]{\fontspec_if_aat_feature:nn} |
| 63 |
% \begin{syntax} |
| 64 |
% \verb|\fontspec_if_aat_feature:nnTF| \Arg{true code} \Arg{false code} |
| 65 |
% \end{syntax} |
| 66 |
% \end{function} |
| 67 |
% |
| 68 |
% \begin{function}[TF]{\fontspec_if_opentype:} |
| 69 |
% \begin{syntax} |
| 70 |
% \verb|\fontspec_if_opentype:TF| \Arg{true code} \Arg{false code} |
| 71 |
% \end{syntax} |
| 72 |
% \end{function} |
| 73 |
% |
| 74 |
% \begin{function}[TF]{\fontspec_if_feature:n} |
| 75 |
% \begin{syntax} |
| 76 |
% \verb|\fontspec_if_feature:nTF| \Arg{feat tag} \Arg{true code} \Arg{false code} |
| 77 |
% \end{syntax} |
| 78 |
% Check if the raw OpenType \meta{feature tag} is available in the current font with |
| 79 |
% script and language settings as set up when the font was loaded. |
| 80 |
% \end{function} |
| 81 |
% |
| 82 |
% \begin{function}[TF]{\fontspec_if_feature:nnn} |
| 83 |
% \begin{syntax} |
| 84 |
% \verb|\fontspec_if_feature:nnnTF| \Arg{script tag} \Arg{lang tag} \Arg{feat tag} \Arg{true code} \Arg{false code}\\ |
| 85 |
% |\fontspec_if_feature:nTF {latn} {ROM} {pnum} {True} {False}| |
| 86 |
% \end{syntax} |
| 87 |
% Test whether the currently selected font with raw OpenType \meta{script tag} and |
| 88 |
% raw OpenType \meta{language tag} contains the raw OpenType \meta{feature tag}. |
| 89 |
% Returns false if the font is not loaded by fontspec or is not an OpenType |
| 90 |
% font. |
| 91 |
% \end{function} |
| 92 |
% |
| 93 |
% \begin{function}[TF]{\fontspec_if_script:n} |
| 94 |
% \begin{syntax} |
| 95 |
% \verb|\fontspec_if_script:nTF| \Arg{script tag} \Arg{true code} \Arg{false code}\\ |
| 96 |
% |\fontspec_if_script:nTF {latn} {True} {False}| |
| 97 |
% \end{syntax} |
| 98 |
% Test whether the currently selected font contains the raw OpenType |
| 99 |
% \meta{script tag}. |
| 100 |
% |
| 101 |
% Returns false if the font is not loaded by fontspec or is not an OpenType |
| 102 |
% font. |
| 103 |
% \end{function} |
| 104 |
% |
| 105 |
% \begin{function}[TF]{\fontspec_if_language:n} |
| 106 |
% \begin{syntax} |
| 107 |
% \verb|\fontspec_if_language:nTF| \Arg{lang tag} \Arg{true code} \Arg{false code}\\ |
| 108 |
% |\fontspec_if_language:nTF {ROM} {True} {False}| |
| 109 |
% \end{syntax} |
| 110 |
% Check if the raw OpenType \meta{language tag} is available in the current font with |
| 111 |
% script settings as set up when the font was loaded. |
| 112 |
% \end{function} |
| 113 |
% |
| 114 |
% \begin{function}[TF]{\fontspec_if_language:nn} |
| 115 |
% \begin{syntax} |
| 116 |
% \verb|\fontspec_if_language:nnTF| \Arg{script tag} \Arg{lang tag} \Arg{true code} \Arg{false code}\\ |
| 117 |
% |\fontspec_if_language:nnTF {cyrl} {SRB} {True} {False}| |
| 118 |
% \end{syntax} |
| 119 |
% Test whether the currently selected font contains the raw OpenType \meta{language |
| 120 |
% tag} in \meta{script tag}. |
| 121 |
% |
| 122 |
% Returns false if the font is not loaded by fontspec or is not an OpenType font. |
| 123 |
% \end{function} |
| 124 |
% |
| 125 |
% \begin{function}[TF]{\fontspec_if_current_script:n} |
| 126 |
% Test whether the currently loaded font has been loaded with the specified raw |
| 127 |
% OpenType \meta{script tag}. |
| 128 |
% \begin{syntax} |
| 129 |
% \verb|\fontspec_if_current_script:nTF| \Arg{script tag} \Arg{true code} \Arg{false code} |
| 130 |
% \end{syntax} |
| 131 |
% \end{function} |
| 132 |
% |
| 133 |
% \begin{function}[TF]{\fontspec_if_current_language:n} |
| 134 |
% Test whether the currently loaded font has been loaded with the specified raw |
| 135 |
% OpenType \meta{language tag}. |
| 136 |
% \begin{syntax} |
| 137 |
% \verb|\fontspec_if_current_language:nTF| \Arg{lang tag} \Arg{true code} \Arg{false code} |
| 138 |
% \end{syntax} |
| 139 |
% \end{function} |
| 140 |
% |
| 141 |
% \begin{function}[TF]{\fontspec_if_current_feature:n} |
| 142 |
% \begin{syntax} |
| 143 |
% \verb|\fontspec_if_current_feature:nTF| \Arg{feat tag} \Arg{true code} \Arg{false code} |
| 144 |
% \end{syntax} |
| 145 |
% Test whether the currently loaded font is using the specified raw |
| 146 |
% OpenType \meta{feature tag}. |
| 147 |
% \end{function} |
| 148 |
% |
| 149 |
% \begin{function}[TF]{\fontspec_if_small_caps:} |
| 150 |
% Test whether the current font has small caps available. |
| 151 |
% \begin{syntax} |
| 152 |
% \verb|\fontspec_if_small_caps:TF| \Arg{true code} \Arg{false code} |
| 153 |
% \end{syntax} |
| 154 |
% \end{function} |
| 155 |
% |
| 156 |
% |
| 157 |
% |
| 158 |
% \section{Implementation} |
| 159 |
% |
| 160 |
% \begin{macro}[TF]{\fontspec_if_fontspec_font:} |
| 161 |
% \begin{macrocode} |
| 162 |
\prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} |
| 163 |
{ |
| 164 |
\cs_if_exist:cTF {g_@@_fontinfo_ \f@family _prop} \prg_return_true: \prg_return_false: |
| 165 |
} |
| 166 |
% \end{macrocode} |
| 167 |
% \end{macro} |
| 168 |
% |
| 169 |
% |
| 170 |
% \begin{macro}[TF]{\fontspec_if_aat_feature:nn} |
| 171 |
% Conditional to test if the currently selected font contains the \AAT\ |
| 172 |
% feature (|#1|,|#2|). |
| 173 |
% \begin{macrocode} |
| 174 |
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} |
| 175 |
{ |
| 176 |
\fontspec_if_fontspec_font:TF |
| 177 |
{ |
| 178 |
\@@_set_font_type:N \font |
| 179 |
\bool_if:NTF \l_@@_atsui_bool |
| 180 |
{ |
| 181 |
\@@_make_AAT_feature_string:NnnTF \font {#1} {#2} |
| 182 |
\prg_return_true: \prg_return_false: |
| 183 |
} |
| 184 |
{ |
| 185 |
\prg_return_false: |
| 186 |
} |
| 187 |
} |
| 188 |
{ |
| 189 |
\prg_return_false: |
| 190 |
} |
| 191 |
} |
| 192 |
% \end{macrocode} |
| 193 |
% \end{macro} |
| 194 |
% |
| 195 |
% |
| 196 |
% \begin{macro}[TF]{\fontspec_if_opentype:} |
| 197 |
% Test whether the currently selected font is an OpenType font. |
| 198 |
% Always true for LuaTeX fonts. |
| 199 |
% \begin{macrocode} |
| 200 |
\prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} |
| 201 |
{ |
| 202 |
\fontspec_if_fontspec_font:TF |
| 203 |
{ |
| 204 |
\@@_set_font_type:N \font |
| 205 |
\bool_if:NTF \l_@@_ot_bool \prg_return_true: \prg_return_false: |
| 206 |
} |
| 207 |
{ |
| 208 |
\prg_return_false: |
| 209 |
} |
| 210 |
} |
| 211 |
% \end{macrocode} |
| 212 |
% \end{macro} |
| 213 |
% |
| 214 |
% \begin{macro}[TF]{\fontspec_if_feature:n} |
| 215 |
% Test whether the currently selected font contains the raw OpenType |
| 216 |
% feature |#1|. E.g.: |\fontspec_if_feature:nTF {pnum} {True} {False}| |
| 217 |
% Returns false if the font is not loaded by fontspec or is not an OpenType |
| 218 |
% font. |
| 219 |
% \begin{macrocode} |
| 220 |
\prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} |
| 221 |
{ |
| 222 |
\fontspec_if_fontspec_font:TF |
| 223 |
{ |
| 224 |
\@@_set_font_type:N \font |
| 225 |
\bool_if:NTF \l_@@_ot_bool |
| 226 |
{ |
| 227 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-num} \l_@@_tmp_tl |
| 228 |
\int_set:Nn \l_@@_script_int {\l_@@_tmp_tl} |
| 229 |
|
| 230 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-num} \l_@@_tmp_tl |
| 231 |
\int_set:Nn \l_@@_language_int {\l_@@_tmp_tl} |
| 232 |
|
| 233 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_script_tl |
| 234 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-tag} \l_@@_lang_tl |
| 235 |
|
| 236 |
\@@_check_ot_feat:NnnnTF \font {#1} {\l_@@_lang_tl} {\l_@@_script_tl} {\prg_return_true:} {\prg_return_false:} |
| 237 |
} |
| 238 |
{ |
| 239 |
\prg_return_false: |
| 240 |
} |
| 241 |
} |
| 242 |
{ |
| 243 |
\prg_return_false: |
| 244 |
} |
| 245 |
} |
| 246 |
% \end{macrocode} |
| 247 |
% \end{macro} |
| 248 |
% |
| 249 |
% \begin{macro}[TF]{\fontspec_if_feature:nnn} |
| 250 |
% \darg{script tag} |
| 251 |
% \darg{language tag} |
| 252 |
% \darg{feature tag} |
| 253 |
% \begin{macrocode} |
| 254 |
\prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} |
| 255 |
{ |
| 256 |
\fontspec_if_fontspec_font:TF |
| 257 |
{ |
| 258 |
\@@_set_font_type:N \font |
| 259 |
\bool_if:NTF \l_@@_ot_bool |
| 260 |
{ |
| 261 |
\@@_check_ot_feat:NnnnTF \font {#3} {#2} {#1} \prg_return_true: \prg_return_false: |
| 262 |
} |
| 263 |
{ \prg_return_false: } |
| 264 |
} |
| 265 |
{ \prg_return_false: } |
| 266 |
} |
| 267 |
% \end{macrocode} |
| 268 |
% \end{macro} |
| 269 |
% |
| 270 |
% \begin{macro}[TF]{\fontspec_if_script:n} |
| 271 |
% \darg{script tag} |
| 272 |
% \begin{macrocode} |
| 273 |
\prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} |
| 274 |
{ |
| 275 |
\fontspec_if_fontspec_font:TF |
| 276 |
{ |
| 277 |
\@@_set_font_type:N \font |
| 278 |
\bool_if:NTF \l_@@_ot_bool |
| 279 |
{ |
| 280 |
\@@_check_script:NnTF \font {#1} \prg_return_true: \prg_return_false: |
| 281 |
} |
| 282 |
{ \prg_return_false: } |
| 283 |
} |
| 284 |
{ \prg_return_false: } |
| 285 |
} |
| 286 |
% \end{macrocode} |
| 287 |
% \end{macro} |
| 288 |
% |
| 289 |
% \begin{macro}[TF]{\fontspec_if_language:n} |
| 290 |
% \darg{lang tag} |
| 291 |
% \begin{macrocode} |
| 292 |
\prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} |
| 293 |
{ |
| 294 |
\fontspec_if_fontspec_font:TF |
| 295 |
{ |
| 296 |
\@@_set_font_type:N \font |
| 297 |
\bool_if:NTF \l_@@_ot_bool |
| 298 |
{ |
| 299 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-num} \l_@@_tmp_tl |
| 300 |
\int_set:Nn \l_@@_script_int {\l_@@_tmp_tl} |
| 301 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_script_tl |
| 302 |
|
| 303 |
\@@_check_lang:NnTF \font {#1} \prg_return_true: \prg_return_false: |
| 304 |
} |
| 305 |
{ \prg_return_false: } |
| 306 |
} |
| 307 |
{ \prg_return_false: } |
| 308 |
} |
| 309 |
% \end{macrocode} |
| 310 |
% \end{macro} |
| 311 |
% |
| 312 |
% \begin{macro}[TF]{\fontspec_if_language:nn} |
| 313 |
% \darg{script tag} |
| 314 |
% \darg{lang tag} |
| 315 |
% \begin{macrocode} |
| 316 |
\prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} |
| 317 |
{ |
| 318 |
\fontspec_if_fontspec_font:TF |
| 319 |
{ |
| 320 |
\@@_set_font_type:N \font |
| 321 |
\bool_if:NTF \l_@@_ot_bool |
| 322 |
{ |
| 323 |
\@@_check_lang:NnnTF \font {#2} {#1} \prg_return_true: \prg_return_false: |
| 324 |
} |
| 325 |
{ \prg_return_false: } |
| 326 |
} |
| 327 |
{ \prg_return_false: } |
| 328 |
} |
| 329 |
% \end{macrocode} |
| 330 |
% \end{macro} |
| 331 |
% |
| 332 |
% |
| 333 |
% \begin{macro}[TF]{\fontspec_if_current_script:n} |
| 334 |
% \darg{script tag} |
| 335 |
% \begin{macrocode} |
| 336 |
\prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} |
| 337 |
{ |
| 338 |
\fontspec_if_fontspec_font:TF |
| 339 |
{ |
| 340 |
\@@_set_font_type:N \font |
| 341 |
\bool_if:NTF \l_@@_ot_bool |
| 342 |
{ |
| 343 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {script-tag} \l_@@_tmp_tl |
| 344 |
\str_if_eq:nVTF {#1} \l_@@_tmp_tl |
| 345 |
{\prg_return_true:} {\prg_return_false:} |
| 346 |
} |
| 347 |
{ \prg_return_false: } |
| 348 |
} |
| 349 |
{ \prg_return_false: } |
| 350 |
} |
| 351 |
% \end{macrocode} |
| 352 |
% \end{macro} |
| 353 |
% |
| 354 |
% \begin{macro}[TF]{\fontspec_if_current_language:n} |
| 355 |
% \darg{lang tag} |
| 356 |
% \begin{macrocode} |
| 357 |
\prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} |
| 358 |
{ |
| 359 |
\fontspec_if_fontspec_font:TF |
| 360 |
{ |
| 361 |
\@@_set_font_type:N \font |
| 362 |
\bool_if:NTF \l_@@_ot_bool |
| 363 |
{ |
| 364 |
\prop_get:cnN {g_@@_fontinfo_ \f@family _prop} {lang-tag} \l_@@_tmp_tl |
| 365 |
\str_if_eq:nVTF {#1} \l_@@_tmp_tl |
| 366 |
{\prg_return_true:} {\prg_return_false:} |
| 367 |
} |
| 368 |
{ \prg_return_false: } |
| 369 |
} |
| 370 |
{ \prg_return_false: } |
| 371 |
} |
| 372 |
% \end{macrocode} |
| 373 |
% \end{macro} |
| 374 |
% |
| 375 |
% |
| 376 |
% \begin{macro}{\fontspec_gset_family:Nnn,\fontspec_set_family:Nnn} |
| 377 |
% \darg{family} |
| 378 |
% \darg{fontspec features} |
| 379 |
% \darg{font} |
| 380 |
% \begin{macrocode} |
| 381 |
\cs_new:Nn \@@_tl_new_if_free:N { \tl_if_exist:NF #1 { \tl_new:N #1 } } |
| 382 |
\cs_new:Nn \@@_set_family:NnnN |
| 383 |
{ |
| 384 |
%<debug>\typeout{::::::~fontspec_set_family:Nnn} |
| 385 |
\tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset |
| 386 |
\tl_set:Nn \l_@@_family_label_tl {#1} |
| 387 |
\@@_select_font_family:nn {#2} {#3} |
| 388 |
\@@_tl_new_if_free:N #1 |
| 389 |
#4 #1 \l_fontspec_family_tl |
| 390 |
\tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset |
| 391 |
%<debug>\typeout{::::::~END~fontspec_set_family:Nnn} |
| 392 |
} |
| 393 |
\cs_new:Nn \fontspec_gset_family:Nnn { \@@_set_family:NnnN #1 {#2} {#3} \tl_gset_eq:NN } |
| 394 |
\cs_new:Nn \fontspec_set_family:Nnn { \@@_set_family:NnnN #1 {#2} {#3} \tl_set_eq:NN } |
| 395 |
% \end{macrocode} |
| 396 |
% |
| 397 |
% \begin{macrocode} |
| 398 |
\cs_generate_variant:Nn \fontspec_set_family:Nnn {c} |
| 399 |
% \end{macrocode} |
| 400 |
% \end{macro} |
| 401 |
% |
| 402 |
% |
| 403 |
% \begin{macro}{\fontspec_gset_fontface:NNnn,\fontspec_set_fontface:NNnn} |
| 404 |
% TODO: the round-about approach of using \cs{fontname} |
| 405 |
% means that settings such as fontdimens will be lost. |
| 406 |
% (Discovered in unicode-math.) Investigate! |
| 407 |
% \begin{macrocode} |
| 408 |
\tl_new:N \l_@@_fontface_cs_tl |
| 409 |
\tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} |
| 410 |
\cs_new:Nn \@@_set_fontface:NNnnN |
| 411 |
{ |
| 412 |
\tl_set:Nn \l_@@_fontface_cs_tl {#1} |
| 413 |
\tl_set:Nn \l_@@_family_label_tl {#2} |
| 414 |
\@@_select_font_family:nn {#3} {#4} |
| 415 |
#5 #2 \l_fontspec_family_tl |
| 416 |
\tl_set:Nn \l_@@_fontface_cs_tl {\l_fontspec_font} % reset |
| 417 |
} |
| 418 |
\cs_new:Nn \fontspec_gset_fontface:NNnn { \@@_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_gset_eq:NN } |
| 419 |
\cs_new:Nn \fontspec_set_fontface:NNnn { \@@_set_fontface:NNnnN #1 #2 {#3} {#4} \tl_set_eq:NN } |
| 420 |
% \end{macrocode} |
| 421 |
% \end{macro} |
| 422 |
% |
| 423 |
% |
| 424 |
% |
| 425 |
% \begin{macro}[TF]{\fontspec_font_if_exist:n} |
| 426 |
% \begin{macrocode} |
| 427 |
\prg_new_conditional:Nnn \fontspec_font_if_exist:n {TF,T,F} |
| 428 |
{ |
| 429 |
\group_begin: |
| 430 |
\@@_init: |
| 431 |
\@@_if_detect_external:nT {#1} { \@@_font_is_file: } |
| 432 |
\@@_primitive_font_if_exist:nTF { \@@_construct_font_call:nn {#1} {} } |
| 433 |
{ \group_end: \prg_return_true: } |
| 434 |
{ \group_end: \prg_return_false: } |
| 435 |
} |
| 436 |
% \end{macrocode} |
| 437 |
% |
| 438 |
% \begin{macrocode} |
| 439 |
\cs_set_eq:NN \IfFontExistsTF \fontspec_font_if_exist:nTF |
| 440 |
% \end{macrocode} |
| 441 |
% \end{macro} |
| 442 |
|
| 443 |
% \begin{macro}[TF]{\fontspec_if_current_feature:n} |
| 444 |
% \darg{feat tag} |
| 445 |
% \begin{macrocode} |
| 446 |
\prg_new_conditional:Nnn \fontspec_if_current_feature:n {TF,T,F} |
| 447 |
{ |
| 448 |
%<debug>\typeout{::~fontspec_if_current_feature:n~{#1}} |
| 449 |
%<debug>\typeout{::::~primitive_font_current_name:~=~\@@_primitive_font_current_name:} |
| 450 |
\exp_args:Nxx \tl_if_in:nnTF |
| 451 |
{ \@@_primitive_font_current_name: } { \tl_to_str:n {#1} } |
| 452 |
{ \prg_return_true: } { \prg_return_false: } |
| 453 |
} |
| 454 |
% \end{macrocode} |
| 455 |
% \end{macro} |
| 456 |
% |
| 457 |
% \begin{macro}[TF]{\fontspec_if_small_caps:} |
| 458 |
% \begin{macrocode} |
| 459 |
\prg_new_conditional:Nnn \fontspec_if_small_caps: {TF,T,F} |
| 460 |
{ |
| 461 |
\@@_if_merge_shape:nTF {sc} |
| 462 |
{ |
| 463 |
\tl_set_eq:Nc \l_@@_smcp_shape_tl { \@@_shape_merge:nn {\f@shape} {sc} } |
| 464 |
} |
| 465 |
{ |
| 466 |
\tl_set:Nn \l_@@_smcp_shape_tl {sc} |
| 467 |
} |
| 468 |
|
| 469 |
\cs_if_exist:cTF { \f@encoding/\f@family/\f@series/\l_@@_smcp_shape_tl } |
| 470 |
{ |
| 471 |
\tl_if_eq:ccTF |
| 472 |
{ \f@encoding/\f@family/\f@series/\l_@@_smcp_shape_tl } |
| 473 |
{ \f@encoding/\f@family/\f@series/\shapedefault } |
| 474 |
{ \prg_return_false: } |
| 475 |
{ \prg_return_true: } |
| 476 |
} |
| 477 |
{ \prg_return_false: } |
| 478 |
} |
| 479 |
% \end{macrocode} |
| 480 |
% \end{macro} |
| 481 |
% |
| 482 |
% \iffalse |
| 483 |
% \begin{macrocode} |
| 484 |
%</fontspec> |
| 485 |
% \end{macrocode} |
| 486 |
% \fi |
| 487 |
|
| 488 |
|
| 489 |
\endinput |
| 490 |
|
| 491 |
% /© |
| 492 |
% ------------------------------------------------ |
| 493 |
% The FONTSPEC package <latex3.github.io/fontspec> |
| 494 |
% ------------------------------------------------ |
| 495 |
% Copyright 2022-2025 The LaTeX project, LPPL "maintainer" |
| 496 |
% Copyright 2004-2022 Will Robertson |
| 497 |
% Copyright 2009-2015 Khaled Hosny |
| 498 |
% Copyright 2013 Philipp Gesang |
| 499 |
% Copyright 2013-2016 Joseph Wright |
| 500 |
% ------------------------------------------------ |
| 501 |
% This package is free software and may be redistributed and/or modified under |
| 502 |
% the conditions of the LaTeX Project Public License, version 1.3c or higher |
| 503 |
% (your choice): <http://www.latex-project.org/lppl/>. |
| 504 |
% ------------------------------------------------ |
| 505 |
% ©/ |