diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontawesome5/fontawesome5-utex-helper.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/fontawesome5/fontawesome5-utex-helper.sty | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/latex/fontawesome5/fontawesome5-utex-helper.sty b/Master/texmf-dist/tex/latex/fontawesome5/fontawesome5-utex-helper.sty index c33c8f0dd66..8ab66fa8820 100644 --- a/Master/texmf-dist/tex/latex/fontawesome5/fontawesome5-utex-helper.sty +++ b/Master/texmf-dist/tex/latex/fontawesome5/fontawesome5-utex-helper.sty @@ -1,4 +1,4 @@ -% Copyright 2018--2019 Marcel Krueger +% Copyright 2018--2020 Marcel Krueger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -24,7 +24,7 @@ \endinput } -\ProvidesExplPackage{fontawesome5-utex-helper}{2019/06/07}{5.9.0}{uTeX helper for fontawesome5} +\ProvidesExplPackage{fontawesome5-utex-helper}{2020/01/15}{5.12.0}{uTeX helper for fontawesome5} \sys_if_engine_luatex:TF{ \RequirePackage{luatexbase} @@ -33,17 +33,17 @@ \cs_new:Nn\__fontawesome_analyze_font:nn{ \group_begin: \usefont{TU}{fontawesome#1}{#2}{n} - \lua_now_x:n{fontawesome5_analyze_current_font(\luatex_fontid:D\tex_font:D)} + \lua_now:e{fontawesome5_analyze_current_font(\tex_fontid:D\tex_font:D)} \group_end: } - \cs_set:Nn\__fontawesome_glyphindex:n{ - \lua_now_x:n{tex.sprint(font.getfont(font.current()).resources.unicodes["\lua_escape_x:n{#1}"]~or~0)} + \cs_set:Npn \__fontawesome_glyphindex:n { + \lua_now:e{tex.sprint(font.getfont(font.current()).resources.unicodes[token.scan_string()]~or~0)} } \cs_set_eq:NN\__fontawesome_glyph:w\tex_char:D }{ \seq_set_from_clist:Nn\c__fontawesome_invalid_tokens_seq{\fa,\faH,\faRepeat,\faWifi,\faSignal,\faSignalAlt,\faDiceD} \regex_const:Nn\c__fontawesome_alt_regex{-alt\Z} - \cs_generate_variant:Nn\regex_match:NnF{NVF} + \cs_generate_variant:Nn \regex_match:NnF { NVF } \cs_new:Nn\__fontawesome_analyze_font:nn{ \group_begin: \usefont{TU}{fontawesome#1}{#2}{n} @@ -62,13 +62,17 @@ \group_end: } \cs_set:Nn\__fontawesome_glyphindex:n{ - \the\xetex_glyphindex:D"#1"\scan_stop: + \the\tex_glyphindex:D"#1"\scan_stop: } - \cs_set_eq:NN\__fontawesome_glyph:w\xetex_glyph:D + \cs_set_eq:NN\__fontawesome_glyph:w\tex_glyph:D } \__fontawesome_analyze_font:nn{\c__fontawesome_kind_tl}{solid} \__fontawesome_analyze_font:nn{brands}{regular} +\bool_new:N \l__fontawesome_duotone_bool +\tl_new:N \l_fontawesome_duotone_secondary_style_tl +\tl_set:Nn \l_fontawesome_duotone_secondary_style_tl { \color{gray} } + \cs_new:Nn\fontawesome_use_icon:nn{ \group_begin: \usefont @@ -76,10 +80,19 @@ {fontawesome\c__fontawesome_kind_tl} {#1} {n} - \int_set:Nn\l_tmpa_int{\__fontawesome_glyphindex:n{#2}} + \bool_set:Nn \l__fontawesome_duotone_bool { + \str_if_eq_p:ee {#1} {duotone} + } + \int_set:Nn\l_tmpa_int{ + \__fontawesome_glyphindex:n{ + #2 + \bool_if:NT \l__fontawesome_duotone_bool { -primary } + } + } \int_compare:nNnT{\l_tmpa_int}={0}{ \fontseries{solid} \selectfont + \bool_set_false:N \l__fontawesome_duotone_bool \int_set:Nn\l_tmpa_int{\__fontawesome_glyphindex:n{#2}} \int_compare:nNnTF{\l_tmpa_int}={0}{ \fontfamily{fontawesomebrands} @@ -99,7 +112,27 @@ \use:n } { - \__fontawesome_glyph:w\l_tmpa_int + \bool_if:NTF \l__fontawesome_duotone_bool { + \__fontawesome_glyph:w \l_tmpa_int + \int_set:Nn\l_tmpa_int{ \__fontawesome_glyphindex:n{ #2-secondary } } + \int_compare:nNnF { \l_tmpa_int } = { 0 } { + \llap { + \l_fontawesome_duotone_secondary_style_tl + { \__fontawesome_glyph:w \l_tmpa_int } + } + } + % \ooalign { + % \hss \__fontawesome_glyph:w \l_tmpa_int \hss \cr + % \hss + % \int_set:Nn\l_tmpa_int{ \__fontawesome_glyphindex:n{ #2-secondary } } + % \int_compare:nNnF { \l_tmpa_int } = { 0 } { + % \color{gray}\__fontawesome_glyph:w \l_tmpa_int + % } + % \hss \cr + % } + } { + \__fontawesome_glyph:w \l_tmpa_int + } } \group_end: } |