summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontawesome5/fontawesome5.sty
blob: 90b5e3b9d009fc3089c340fff657d39c82c00ff0 (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
% Copyright 2018 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
%
\RequirePackage{expl3}
\ProvidesExplPackage{fontawesome5}{2018/08/28}{5.3.0}{Font Awesome 5}

\RequirePackage{l3keys2e}

\keys_define:nn{fontawesome5}
{
  pro .value_forbidden:n = true,
  pro .tl_set:N = \c__fontawesome_kind_tl,
  pro .default:n = pro,
  free .value_forbidden:n = true,
  free .tl_set:N = \c__fontawesome_kind_tl,
  free .default:n = free
}
\keys_set:nn{fontawesome5}{free}

\ProcessKeysOptions{fontawesome5}

\RequirePackage{xparse}

\str_new:N\l_fontawesome_style_str

\str_case:onTF\c_sys_engine_str{
  {luatex}{}
  {xetex}{}
}{
  \RequirePackage{fontawesome5-utex-helper}
}{
  \RequirePackage{fontawesome5-generic-helper}
}

\msg_new:nnnn{fontawesome5}{icon-not-found}
  {The~requested~icon~#1~was~not~found.}
  {Maybe~you~mistyped~the~icon~name~or~you~are~using~the~wrong~version~of~Font~Awesome~5.~
    Please~check~the~Font~Awesome~Cheatsheet~to~verify~the~spelling~of~#1.~
    If~you~want~to~use~a~Pro~icon,~you~need~to~have~Font~Awesome~5~Pro~installed~and~
    use~XeLaTeX~or~LuaLaTeX.~Then~you~can~activate~Pro~with~the~[pro]~option.~
    If~you~use~XeLaTeX~or~LuaLaTeX,~you~can~also~try~updating~the~Font~Awesome~5~font~files~
    to~make~icons~of~newer~versions~of~Font~Awesome~available.}
\msg_new:nnnn{fontawesome5}{style-substitution}
  {The~requested~icon~#1~has~been~replaced~by~the~solid~version}
  {The~icon~#1~is~not~available~in~the~style~#2.~The~solid~version~will~be~used~instead.~
    To~use~a~#2~style~#1~icon,~you~probably~need~Font~Awesome~5~Pro.~
    To~use~Pro,~you~need~to~have~Font~Awesome~5~Pro~installed~and~
    use~XeLaTeX~or~LuaLaTeX.~Then~you~can~activate~Pro~with~the~[pro]~option.}

\NewDocumentCommand\faPreselectedIcon{m s O{\str_use:N\l_fontawesome_style_str}}{
  \fontawesome_use_icon:nn{#3}{#1\IfBooleanT{#2}{-alt}}
}
\NewDocumentCommand\faIcon{s O{\str_use:N\l_fontawesome_style_str} m}{
  \fontawesome_use_icon:nn{#2}{#3\IfBooleanT{#1}{-alt}}
}
\cs_new:Npn\fontawesome_set_style:n{
  \str_set:Nn\l_fontawesome_style_str
}

\NewDocumentCommand\faStyle{m}{
  \fontawesome_set_style:n{#1}
}

\cs_new_eq:cc{c__fontawesome_slot_stop_tl}{c__fontawesome_slot_square_tl}
\cs_new:Npn\faStop{\faPreselectedIcon{square}}
\cs_new:Npn\faH#1{\faPreselectedIcon{h#1}}
\NewDocumentCommand\faRepeat{t{1}}{
  \faPreselectedIcon{repeat\IfBooleanT{#1}{-1}}
}

% The following list is special: These are icons, which are *not* part of the free version,
% but their -alt version is free.
\cs_set:Npn\faArrows{\faPreselectedIcon{arrows}}
\cs_set:Npn\faCloudDownload{\faPreselectedIcon{cloud-download}}
\cs_set:Npn\faCloudUpload{\faPreselectedIcon{cloud-upload}}
\cs_set:Npn\faExchange{\faPreselectedIcon{exchange}}
\cs_set:Npn\faExpandArrows{\faPreselectedIcon{expand-arrows}}
\cs_set:Npn\faExternalLink{\faPreselectedIcon{external-link}}
\cs_set:Npn\faExternalLinkSquare{\faPreselectedIcon{external-link-square}}
\cs_set:Npn\faLevelDown{\faPreselectedIcon{level-down}}
\cs_set:Npn\faLevelUp{\faPreselectedIcon{level-up}}
\cs_set:Npn\faPencil{\faPreselectedIcon{pencil}}
\cs_set:Npn\faShield{\faPreselectedIcon{shield}}
\cs_set:Npn\faSignIn{\faPreselectedIcon{sign-in}}
\cs_set:Npn\faSignOut{\faPreselectedIcon{sign-out}}
\cs_set:Npn\faTachometer{\faPreselectedIcon{tachometer}}
\cs_set:Npn\faTicket{\faPreselectedIcon{ticket}}

\fontawesome_set_style:n{solid}