summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/combofont/combofont.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/luatex/latex/combofont/combofont.sty
Initial commit
Diffstat (limited to 'macros/luatex/latex/combofont/combofont.sty')
-rw-r--r--macros/luatex/latex/combofont/combofont.sty106
1 files changed, 106 insertions, 0 deletions
diff --git a/macros/luatex/latex/combofont/combofont.sty b/macros/luatex/latex/combofont/combofont.sty
new file mode 100644
index 0000000000..24572b1f77
--- /dev/null
+++ b/macros/luatex/latex/combofont/combofont.sty
@@ -0,0 +1,106 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+%28.05.2018
+\def\UlrikeFischer@package@ufcombofont@date{2019/06/08}\def\UlrikeFischer@package@ufcombofont@version{0.3}
+
+\RequirePackage{xparse}
+\ProvidesExplPackage {combofont} {\UlrikeFischer@package@ufcombofont@date}{\UlrikeFischer@package@ufcombofont@version}
+ {An EXPERIMENTAL package to add nfss-declaration of combo fonts to a luaLaTeX document}
+% highly experimental! Comments to Ulrike Fischer. fischer@troubleshooting-tex.de
+\prop_if_exist:NT \g_msg_module_name_prop
+ {
+ \prop_gput:Nnn \g_msg_module_name_prop { ufcombo }{ combofont }
+ }
+
+\msg_new:nnn {ufcombo} {need-luatex}
+ {
+ The~ combofont~package~requires~LuaLaTeX.~Quitting.
+ }
+
+\msg_new:nnn {ufcombo} {combofont-already-exists}
+ {
+ The~combofont~#1~has~already~been~set~up.~I~won't~overwrite~it
+ }
+
+\sys_if_engine_luatex:F
+ {
+ \msg_fatal:nn {ufcombo} {need-luatex}
+ \endinput
+ }
+
+\RequirePackage{xfp}
+
+\cs_generate_variant:Nn \seq_set_split:Nnn {cnV}
+
+\NewDocumentCommand\setupcombofont { m m m } %name, basefonts, combofont declaration
+ {
+ \tl_set:Nn\l_tmpa_tl { #2 }
+ \regex_replace_all:nnN {\#1} {\c{f@size}} \l_tmpa_tl
+ % \tl_show:N\l_tmpa_tl
+ \seq_if_exist:cTF { l__ufcombo_#1_basefonts_seq }
+ {
+ \msg_warning:nnn { ufcombo} {combofont-already-exists} { #1 }
+ }
+ {
+ \seq_new:c { l__ufcombo_#1_basefonts_seq }
+ \seq_set_split:cnV { l__ufcombo_#1_basefonts_seq } { , }\l_tmpa_tl
+ %%\seq_show:c {l__ufcombo_#1_basefonts_seq }
+ \seq_new:c { l__ufcombo_#1_combodesc_seq }
+ \seq_set_from_clist:cn { l__ufcombo_#1_combodesc_seq } { #3 }
+ %%\seq_show:c { l__ufcombo_#1_combodesc_seq }
+ \__ufcombo_build_combodesc:n { #1 }
+ }
+ }
+
+
+\cs_new:Nn \__ufcombo_call_basefonts:n
+ {
+ \int_zero:N \l_tmpa_int
+ \seq_map_inline:cn {l__ufcombo_#1_basefonts_seq}
+ {
+ \int_incr:N \l_tmpa_int
+ \exp_args:Nc \font { l__ufcombo_tmpfont_\int_to_roman:n{\l_tmpa_int}_tl } = ##1
+ }
+ }
+
+
+
+
+
+
+\cs_new:Nn \__ufcombo_build_combodesc:n
+ {
+ \tl_new:c { l__ufcombo_#1_combodesc_tl }
+ \tl_set:cx { l__ufcombo_#1_combodesc_tl } { \tl_to_str:n { " } combo \tl_to_str:n { : }~ }
+ \int_step_inline:nnnn { 1 } { 1 } { \seq_count:c { l__ufcombo_#1_basefonts_seq } }
+ {
+ \tl_put_right:cn { l__ufcombo_#1_combodesc_tl } { ##1~->~\fontid }
+ \exp_args:Nnc \tl_put_right:cn { l__ufcombo_#1_combodesc_tl }
+ {
+ l__ufcombo_tmpfont_\int_to_roman:n{##1}_tl
+ }
+ \tl_set:Nx\l_tmpa_tl { \seq_item:cn {l__ufcombo_#1_combodesc_seq } {##1} }
+ \tl_if_empty:NF \l_tmpa_tl
+ {
+ \tl_put_right:cx { l__ufcombo_#1_combodesc_tl}
+ {
+ ,~ \seq_item:cn {l__ufcombo_#1_combodesc_seq } {##1}
+ }
+ }
+ \tl_put_right:cx { l__ufcombo_#1_combodesc_tl} {\tl_to_str:n{;}}
+ }
+ \tl_put_right:cx { l__ufcombo_#1_combodesc_tl } { \tl_to_str:n { " } }
+ %% \tl_show:c { l__ufcombo_#1_combodesc_tl }
+ }
+
+\DeclareSizeFunction{combo}{\__ufcombo_sfcnt:}
+
+\cs_new:Nn\__ufcombo_sfcnt:
+ {
+ % \tl_show:c {l__ufcombo_\use:c{mandatory@arg}_combodesc_tl}
+ \__ufcombo_call_basefonts:n { \mandatory@arg }
+ \tl_set_eq:Nc \external@font { l__ufcombo_\use:c{mandatory@arg}_combodesc_tl}
+ }%
+
+\tl_new:N\combodefaultfeat
+\tl_set:Nn\combodefaultfeat{mode=node;script=latn;language=DFLT;+tlig;}
+\endinput