89 lines
3.5 KiB
TeX
89 lines
3.5 KiB
TeX
%% start of file `fontawesome.sty'.
|
|||
|
|
%% Copyright 2013-2016 Xavier Danaux (xdanaux@gmail.com).
|
||
|
|
%
|
||
|
|
% 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.1 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}{FontAwesome})。
|
||
|
|
% 原写法按**字体名**去找系统字体,只在装过 fontawesome 宏包+字体的
|
||
|
|
% TeX 发行版里成立;本仓库要求"字体只有一份来源",所以显式给路径。
|
||
|
|
% Path 相对**编译时的工作目录**,也就是本模板目录(简历/)。
|
||
|
|
% 字体文件:../fonts/fontawesome/FontAwesome.otf
|
||
|
|
%
|
||
|
|
% ⚠️ 是 ../fonts 不是 ../../fonts。模板目录与 fonts/ 同在仓库根下,
|
||
|
|
% 只隔一层。写成 ../../ 时 fontspec 报的错是
|
||
|
|
% Package fontspec Error: The font "FontAwesome" cannot be found.
|
||
|
|
% 看起来像"字体名不对",实际是路径根本不存在 —— 排查时别被
|
||
|
|
% 错误信息误导,先 ls 一下路径。
|
||
|
|
\newfontfamily{\FA}[Path=../fonts/fontawesome/,Extension=.otf]{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'.
|