| 1 |
% !Mode:: "TeX:DE:UTF-8:Main" |
| 2 |
%28.05.2018 |
| 3 |
\def\UlrikeFischer@package@ufcombofont@date{2019/06/08}\def\UlrikeFischer@package@ufcombofont@version{0.3} |
| 4 |
|
| 5 |
\RequirePackage{xparse} |
| 6 |
\ProvidesExplPackage {combofont} {\UlrikeFischer@package@ufcombofont@date}{\UlrikeFischer@package@ufcombofont@version} |
| 7 |
{An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document} |
| 8 |
% highly experimental! Comments to Ulrike Fischer. [email protected] |
| 9 |
\prop_if_exist:NT \g_msg_module_name_prop |
| 10 |
{ |
| 11 |
\prop_gput:Nnn \g_msg_module_name_prop { ufcombo }{ combofont } |
| 12 |
} |
| 13 |
|
| 14 |
\msg_new:nnn {ufcombo} {need-luatex} |
| 15 |
{ |
| 16 |
The~ combofont~package~requires~LuaLaTeX.~Quitting. |
| 17 |
} |
| 18 |
|
| 19 |
\msg_new:nnn {ufcombo} {combofont-already-exists} |
| 20 |
{ |
| 21 |
The~combofont~#1~has~already~been~set~up.~I~won't~overwrite~it |
| 22 |
} |
| 23 |
|
| 24 |
\sys_if_engine_luatex:F |
| 25 |
{ |
| 26 |
\msg_fatal:nn {ufcombo} {need-luatex} |
| 27 |
\endinput |
| 28 |
} |
| 29 |
|
| 30 |
\RequirePackage{xfp} |
| 31 |
|
| 32 |
\cs_generate_variant:Nn \seq_set_split:Nnn {cnV} |
| 33 |
|
| 34 |
\NewDocumentCommand\setupcombofont { m m m } %name, basefonts, combofont declaration |
| 35 |
{ |
| 36 |
\tl_set:Nn\l_tmpa_tl { #2 } |
| 37 |
\regex_replace_all:nnN {\#1} {\c{f@size}} \l_tmpa_tl |
| 38 |
% \tl_show:N\l_tmpa_tl |
| 39 |
\seq_if_exist:cTF { l__ufcombo_#1_basefonts_seq } |
| 40 |
{ |
| 41 |
\msg_warning:nnn { ufcombo} {combofont-already-exists} { #1 } |
| 42 |
} |
| 43 |
{ |
| 44 |
\seq_new:c { l__ufcombo_#1_basefonts_seq } |
| 45 |
\seq_set_split:cnV { l__ufcombo_#1_basefonts_seq } { , }\l_tmpa_tl |
| 46 |
%%\seq_show:c {l__ufcombo_#1_basefonts_seq } |
| 47 |
\seq_new:c { l__ufcombo_#1_combodesc_seq } |
| 48 |
\seq_set_from_clist:cn { l__ufcombo_#1_combodesc_seq } { #3 } |
| 49 |
%%\seq_show:c { l__ufcombo_#1_combodesc_seq } |
| 50 |
\__ufcombo_build_combodesc:n { #1 } |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
\cs_new:Nn \__ufcombo_call_basefonts:n |
| 56 |
{ |
| 57 |
\int_zero:N \l_tmpa_int |
| 58 |
\seq_map_inline:cn {l__ufcombo_#1_basefonts_seq} |
| 59 |
{ |
| 60 |
\int_incr:N \l_tmpa_int |
| 61 |
\exp_args:Nc \font { l__ufcombo_tmpfont_\int_to_roman:n{\l_tmpa_int}_tl } = ##1 |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
\cs_new:Nn \__ufcombo_build_combodesc:n |
| 71 |
{ |
| 72 |
\tl_new:c { l__ufcombo_#1_combodesc_tl } |
| 73 |
\tl_set:cx { l__ufcombo_#1_combodesc_tl } { \tl_to_str:n { " } combo \tl_to_str:n { : }~ } |
| 74 |
\int_step_inline:nnnn { 1 } { 1 } { \seq_count:c { l__ufcombo_#1_basefonts_seq } } |
| 75 |
{ |
| 76 |
\tl_put_right:cn { l__ufcombo_#1_combodesc_tl } { ##1~->~\fontid } |
| 77 |
\exp_args:Nnc \tl_put_right:cn { l__ufcombo_#1_combodesc_tl } |
| 78 |
{ |
| 79 |
l__ufcombo_tmpfont_\int_to_roman:n{##1}_tl |
| 80 |
} |
| 81 |
\tl_set:Nx\l_tmpa_tl { \seq_item:cn {l__ufcombo_#1_combodesc_seq } {##1} } |
| 82 |
\tl_if_empty:NF \l_tmpa_tl |
| 83 |
{ |
| 84 |
\tl_put_right:cx { l__ufcombo_#1_combodesc_tl} |
| 85 |
{ |
| 86 |
,~ \seq_item:cn {l__ufcombo_#1_combodesc_seq } {##1} |
| 87 |
} |
| 88 |
} |
| 89 |
\tl_put_right:cx { l__ufcombo_#1_combodesc_tl} {\tl_to_str:n{;}} |
| 90 |
} |
| 91 |
\tl_put_right:cx { l__ufcombo_#1_combodesc_tl } { \tl_to_str:n { " } } |
| 92 |
%% \tl_show:c { l__ufcombo_#1_combodesc_tl } |
| 93 |
} |
| 94 |
|
| 95 |
\DeclareSizeFunction{combo}{\__ufcombo_sfcnt:} |
| 96 |
|
| 97 |
\cs_new:Nn\__ufcombo_sfcnt: |
| 98 |
{ |
| 99 |
% \tl_show:c {l__ufcombo_\use:c{mandatory@arg}_combodesc_tl} |
| 100 |
\__ufcombo_call_basefonts:n { \mandatory@arg } |
| 101 |
\tl_set_eq:Nc \external@font { l__ufcombo_\use:c{mandatory@arg}_combodesc_tl} |
| 102 |
}% |
| 103 |
|
| 104 |
\tl_new:N\combodefaultfeat |
| 105 |
\tl_set:Nn\combodefaultfeat{mode=node;script=latn;language=DFLT;+tlig;} |
| 106 |
\endinput |