-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
fontawesome.sty
80 lines (62 loc) · 2.76 KB
/
fontawesome.sty
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
%% start of file `fontawesome.sty'.
%% Copyright 2013-2016 Xavier Danaux ([email protected]).
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License version 1.3c,
% available at http://www.latex-project.org/lppl/.
%-------------------------------------------------------------------------------
% identification
%-------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{fontawesome}[2016/05/15 v4.6.3 font awesome icons]
%-------------------------------------------------------------------------------
% requirements
%-------------------------------------------------------------------------------
\RequirePackage{ifxetex,ifluatex}
\newif\iffontawesome@otf\fontawesome@otffalse
\ifxetex
\fontawesome@otftrue
\else
\ifluatex
\fontawesome@otftrue\fi\fi
%-------------------------------------------------------------------------------
% generic implementation
%-------------------------------------------------------------------------------
% generic command to display an icon by its name
\newcommand*{\faicon}[1]{%
{\csname faicon@#1\endcsname}}
% generic icon commands and aliases
\input{fontawesomesymbols-generic.tex}
%-------------------------------------------------------------------------------
% xe- and lualatex implementation
%-------------------------------------------------------------------------------
\iffontawesome@otf
\usepackage{fontspec}
% definition of \FA as a shortcut to load the Font Awesome font
\newfontfamily{\FA}[
Path = fonts/fontawesome/opentype/ ,
Scale = 0.85 ,
SmallCapsFont = *
]{FontAwesome}
% icon-specific commands
\input{fontawesomesymbols-xeluatex.tex}
%-------------------------------------------------------------------------------
% (pdf)latex implementation
%-------------------------------------------------------------------------------
\else
% definition of \FA... as a shortcut to load the Font Awesome font
\DeclareRobustCommand\FAone{\fontencoding{U}\fontfamily{fontawesomeone}\selectfont}
\DeclareRobustCommand\FAtwo{\fontencoding{U}\fontfamily{fontawesometwo}\selectfont}
\DeclareRobustCommand\FAthree{\fontencoding{U}\fontfamily{fontawesomethree}\selectfont}
% icon-specific commands
\input{fontawesomesymbols-pdftex.tex}
\fi
%-------------------------------------------------------------------------------
% fix for FontAwesome icon names containing numerals
%-------------------------------------------------------------------------------
\renewcommand{\faHourglass}[1][]{%
\faicon{hourglass\if\relax\detokenize{#1}\relax\else-#1\fi}}
\renewcommand{\faBattery}[1][4]{%
\faicon{battery-#1}}
\endinput
%% end of file `fontawesome.sty'.