| 1 |
%%^^A%% fontspec-code-graphite.dtx -- part of FONTSPEC <latex3.github.io/fontspec> |
| 2 |
|
| 3 |
% \section{Graphite/AAT code} |
| 4 |
% |
| 5 |
% \iffalse |
| 6 |
% \begin{macrocode} |
| 7 |
%<*fontspec&XE> |
| 8 |
% \end{macrocode} |
| 9 |
% \fi |
| 10 |
% |
| 11 |
|
| 12 |
|
| 13 |
% \begin{macro}{\@@_define_aat_feature_group:n} |
| 14 |
% \begin{macrocode} |
| 15 |
\cs_new:Nn \@@_define_aat_feature_group:n |
| 16 |
{ |
| 17 |
\keys_define:nn {fontspec-aat} { #1 .multichoice: } |
| 18 |
} |
| 19 |
% \end{macrocode} |
| 20 |
% \end{macro} |
| 21 |
% |
| 22 |
% \begin{macro}{\@@_define_aat_feature:nnnn} |
| 23 |
% \begin{macrocode} |
| 24 |
\cs_new:Nn \@@_define_aat_feature:nnnn |
| 25 |
{ |
| 26 |
\keys_define:nn {fontspec-aat} |
| 27 |
{ |
| 28 |
#1/#2 .code:n = { \@@_make_AAT_feature:nn {#3}{#4} } |
| 29 |
} |
| 30 |
} |
| 31 |
% \end{macrocode} |
| 32 |
% \end{macro} |
| 33 |
|
| 34 |
% \begin{macro}{\@@_make_AAT_feature:nn} |
| 35 |
% \begin{macrocode} |
| 36 |
\cs_new:Nn \@@_make_AAT_feature:nn |
| 37 |
{ |
| 38 |
\tl_if_empty:nTF {#1} |
| 39 |
{ \@@_warning:n {aat-feature-not-exist} } |
| 40 |
{ |
| 41 |
\exp_args:No \@@_make_AAT_feature_string:NnnTF \l_@@_fontface_cs_tl {#1} {#2} |
| 42 |
{ |
| 43 |
\@@_update_featstr:n {\l_fontspec_feature_string_tl} |
| 44 |
} |
| 45 |
{ |
| 46 |
\@@_warning:nx {aat-feature-not-exist-in-font} {#1,#2} |
| 47 |
} |
| 48 |
} |
| 49 |
} |
| 50 |
% \end{macrocode} |
| 51 |
% \end{macro} |
| 52 |
% |
| 53 |
% \begin{macro}{\@@_make_AAT_feature_string:NnnTF} |
| 54 |
% This macro takes the numerical codes for a font feature and |
| 55 |
% creates a specified macro containing the string required in the |
| 56 |
% font definition to turn that feature on or off. Used primarily in |
| 57 |
% [...], but also used to check if small caps |
| 58 |
% exists in the requested font (see page~\pageref{mac:makesmallcaps}). |
| 59 |
% |
| 60 |
% For exclusive selectors, it's easy; just grab the string: |
| 61 |
% For \emph{non}-exclusive selectors, it's a little more complex. |
| 62 |
% If the selector is even, it corresponds to switching the feature on. |
| 63 |
% If the selector is \emph{odd}, it corresponds to switching the feature off. |
| 64 |
% But \XeTeX\ doesn't return a selector string for this number, since the |
| 65 |
% feature is defined for the `switching on' value. So we need to check the |
| 66 |
% selector of the previous number, and then prefix the feature string with |!| |
| 67 |
% to denote the switch. |
| 68 |
% |
| 69 |
% Finally, save out the complete feature string in \cmd\l_fontspec_feature_string_tl. |
| 70 |
% \begin{macrocode} |
| 71 |
\prg_new_conditional:Nnn \@@_make_AAT_feature_string:Nnn {TF,T,F} |
| 72 |
{ |
| 73 |
\tl_set:Nx \l_@@_tmpa_tl { \XeTeXfeaturename #1 #2 } |
| 74 |
\tl_if_empty:NTF \l_@@_tmpa_tl |
| 75 |
{ \prg_return_false: } |
| 76 |
{ |
| 77 |
\int_compare:nTF { \XeTeXisexclusivefeature #1 #2 > 0 } |
| 78 |
{ |
| 79 |
\tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3} |
| 80 |
} |
| 81 |
{ |
| 82 |
\int_if_even:nTF {#3} |
| 83 |
{ |
| 84 |
\tl_set:Nx \l_@@_tmpb_tl {\XeTeXselectorname #1 #2\space #3} |
| 85 |
} |
| 86 |
{ |
| 87 |
\tl_set:Nx \l_@@_tmpb_tl |
| 88 |
{ |
| 89 |
\XeTeXselectorname #1 #2\space \numexpr#3-1\relax |
| 90 |
} |
| 91 |
\tl_if_empty:NF \l_@@_tmpb_tl { \tl_put_left:Nn \l_@@_tmpb_tl {!} } |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
\tl_if_empty:NTF \l_@@_tmpb_tl |
| 96 |
{ \prg_return_false: } |
| 97 |
{ |
| 98 |
\tl_set:Nx \l_fontspec_feature_string_tl { \l_@@_tmpa_tl = \l_@@_tmpb_tl } |
| 99 |
\prg_return_true: |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
% \end{macrocode} |
| 104 |
% \end{macro} |
| 105 |
% |
| 106 |
% \iffalse |
| 107 |
% \begin{macrocode} |
| 108 |
%</fontspec&XE> |
| 109 |
% \end{macrocode} |
| 110 |
% \fi |
| 111 |
|
| 112 |
|
| 113 |
\endinput |
| 114 |
|
| 115 |
% /© |
| 116 |
% ------------------------------------------------ |
| 117 |
% The FONTSPEC package <latex3.github.io/fontspec> |
| 118 |
% ------------------------------------------------ |
| 119 |
% Copyright 2022-2025 The LaTeX project, LPPL "maintainer" |
| 120 |
% Copyright 2004-2022 Will Robertson |
| 121 |
% Copyright 2009-2015 Khaled Hosny |
| 122 |
% Copyright 2013 Philipp Gesang |
| 123 |
% Copyright 2013-2016 Joseph Wright |
| 124 |
% ------------------------------------------------ |
| 125 |
% This package is free software and may be redistributed and/or modified under |
| 126 |
% the conditions of the LaTeX Project Public License, version 1.3c or higher |
| 127 |
% (your choice): <http://www.latex-project.org/lppl/>. |
| 128 |
% ------------------------------------------------ |
| 129 |
% ©/ |