blob: c33c8f0dd66ad57563bf89420a0a152001f689d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
% Copyright 2018--2019 Marcel Krueger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Marcel Krueger
%
\@ifpackageloaded{fontawesome5}{}{\PackageError{fontawesome5-utex-helper}{This package should not be loaded individually. Load fontawesome5 instead.}{}}
\@ifpackagelater{expl3}{2017/05/26}{}{
\def\faV@extractversion#1 #2\|{#1}
\PackageError{fontawesome5}{expl3 package version too old}{%
The fontawesome5 package requires an up-to-date version of the\MessageBreak
package expl3, which is part of the l3kernel bundle. I could only\MessageBreak
find version \expandafter\expandafter\expandafter\faV@extractversion\csname ver@expl3.sty\endcsname{} \|, so I will exit now.
To fix this error,\MessageBreak you have to update l3kernel to version 2017-05-26 or later.
}
\endinput
}
\ProvidesExplPackage{fontawesome5-utex-helper}{2019/06/07}{5.9.0}{uTeX helper for fontawesome5}
\sys_if_engine_luatex:TF{
\RequirePackage{luatexbase}
\directlua{require('fontawesome5')}
\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)}
\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_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_new:Nn\__fontawesome_analyze_font:nn{
\group_begin:
\usefont{TU}{fontawesome#1}{#2}{n}
\int_step_inline:nnnn{67}1{\XeTeXcountglyphs\font-1}{
\tl_set:No\l_tmpa_tl{\XeTeXglyphname\font##1}
\regex_match:NVF\c__fontawesome_alt_regex\l_tmpa_tl{
\tl_set:NV\l_tmpb_tl\l_tmpa_tl
\tl_put_left:No\l_tmpb_tl{\char_generate:nn{92}{12}fa-}
\tl_replace_all:Nnn\l_tmpb_tl{-}{\str_upper_case:n}
\tl_set_rescan:Nnx\l_tmpb_tl{\ExplSyntaxOn}{\l_tmpb_tl}
\seq_if_in:NxF\c__fontawesome_invalid_tokens_seq{\tl_head:N\l_tmpb_tl}{
\exp_last_unbraced:NV\cs_gset:Npx\l_tmpb_tl{\exp_not:N\faPreselectedIcon{\l_tmpa_tl}}
}
}
}
\group_end:
}
\cs_set:Nn\__fontawesome_glyphindex:n{
\the\xetex_glyphindex:D"#1"\scan_stop:
}
\cs_set_eq:NN\__fontawesome_glyph:w\xetex_glyph:D
}
\__fontawesome_analyze_font:nn{\c__fontawesome_kind_tl}{solid}
\__fontawesome_analyze_font:nn{brands}{regular}
\cs_new:Nn\fontawesome_use_icon:nn{
\group_begin:
\usefont
{TU}
{fontawesome\c__fontawesome_kind_tl}
{#1}
{n}
\int_set:Nn\l_tmpa_int{\__fontawesome_glyphindex:n{#2}}
\int_compare:nNnT{\l_tmpa_int}={0}{
\fontseries{solid}
\selectfont
\int_set:Nn\l_tmpa_int{\__fontawesome_glyphindex:n{#2}}
\int_compare:nNnTF{\l_tmpa_int}={0}{
\fontfamily{fontawesomebrands}
\fontseries{regular}
\selectfont
\int_set:Nn\l_tmpa_int{\__fontawesome_glyphindex:n{#2}}
\int_compare:nNnT{\l_tmpa_int}={0}{
\msg_error:nnxx{fontawesome5}{icon-not-found}{#2}{#1}
}
}{
\msg_warning:nnxx{fontawesome5}{style-substitution}{#2}{#1}
}
}
\bool_if:NTF\c__fontawesome_fixed_bool{
\makebox[1.5em][c]
}{
\use:n
}
{
\__fontawesome_glyph:w\l_tmpa_int
}
\group_end:
}
|