编辑:@cfr 说,在新版本 4.4.0 中这个错误已经修复。
我已经编写了一个小样本来测试,如果fontawesome 脚本(v. 4.3.0-1)可以根据我的需要缩放字体大小,但是却不行 :(
\documentclass{article}
\usepackage{fontawesome}
\begin{document}
{Normal \faAdjust}
{\Huge Huge \faAdjust}
\end{document}
我已经用 pdflatex 渲染了 tex 文件。
我是否遗漏了什么?
答案1
该 sty 的作者没有编写代码以使字体可以缩放。您可以对其进行调整:
\documentclass{article}
\usepackage{fontawesome}
\DeclareFontFamily{U}{fontawesomeOne}{}
\DeclareFontShape{U}{fontawesomeOne}{m}{n}
{<-> FontAwesome--fontawesomeone}{}
\DeclareRobustCommand\FAone{\fontencoding{U}\fontfamily{fontawesomeOne}\selectfont}
\begin{document}
{Normal \faAdjust}
{\Huge Huge \faAdjust}
\end{document}
您必须为\FAtwo
和写出类似的定义\FAthree
。
答案2
该fontawesome.sty
文件做了一件非常错误的事情。在它的结尾你会发现
%-------------------------------------------------------------------------------
% pdflatex implementation
%-------------------------------------------------------------------------------
\else
% definition of \FA... as a shortcut to load the Font Awesome font
\pdfmapline{+FontAwesome--fontawesomeone FontAwesome "fontawesomeone ReEncodeFont" <[fontawesomeone.enc <FontAwesome.pfb}
\font\FAone=FontAwesome--fontawesomeone.enc
\pdfmapline{+FontAwesome--fontawesometwo FontAwesome "fontawesometwo ReEncodeFont" <[fontawesometwo.enc <FontAwesome.pfb}
\font\FAtwo=FontAwesome--fontawesometwo.enc
\pdfmapline{+FontAwesome--fontawesomethree FontAwesome "fontawesomethree ReEncodeFont" <[fontawesomethree.enc <FontAwesome.pfb}
\font\FAthree=FontAwesome--fontawesomethree.enc
% icon-specific commands
\input{fontawesomesymbols-pdftex.tex}
\fi
众所周知,\font
在 LaTeX 中使用总是错误的。
您可以通过正确定义来修复它\FAone
,\FAtwo
并\FAthree
做正确的事情:
\documentclass{article}
\usepackage{fontawesome}
\DeclareFontFamily{U}{fontawesome1}{}
\DeclareFontShape{U}{fontawesome1}{m}{n}{<->FontAwesome--fontawesomeone}{}
\DeclareFontFamily{U}{fontawesome2}{}
\DeclareFontShape{U}{fontawesome2}{m}{n}{<->FontAwesome--fontawesometwo}{}
\DeclareFontFamily{U}{fontawesome3}{}
\DeclareFontShape{U}{fontawesome3}{m}{n}{<->FontAwesome--fontawesomethree}{}
\DeclareRobustCommand{\FAone}{\usefont{U}{fontawesome1}{m}{n}}
\DeclareRobustCommand{\FAtwo}{\usefont{U}{fontawesome2}{m}{n}}
\DeclareRobustCommand{\FAthree}{\usefont{U}{fontawesome3}{m}{n}}
\begin{document}
{Normal \faAdjust}
{\Huge Huge \faAdjust}
\end{document}
包中的正确代码应该是
%-------------------------------------------------------------------------------
% pdflatex implementation
%-------------------------------------------------------------------------------
\else
% definition of \FA... as a shortcut to load the Font Awesome font
\pdfmapline{+FontAwesome--fontawesomeone FontAwesome "fontawesomeone ReEncodeFont" <[fontawesomeone.enc <FontAwesome.pfb}
\pdfmapline{+FontAwesome--fontawesometwo FontAwesome "fontawesometwo ReEncodeFont" <[fontawesometwo.enc <FontAwesome.pfb}
\pdfmapline{+FontAwesome--fontawesomethree FontAwesome "fontawesomethree ReEncodeFont" <[fontawesomethree.enc <FontAwesome.pfb}
\DeclareFontFamily{U}{fontawesome1}{}
\DeclareFontShape{U}{fontawesome1}{m}{n}{<->FontAwesome--fontawesomeone}{}
\DeclareFontFamily{U}{fontawesome2}{}
\DeclareFontShape{U}{fontawesome2}{m}{n}{<->FontAwesome--fontawesometwo}{}
\DeclareFontFamily{U}{fontawesome3}{}
\DeclareFontShape{U}{fontawesome3}{m}{n}{<->FontAwesome--fontawesomethree}{}
\DeclareRobustCommand{\FAone}{\usefont{U}{fontawesome1}{m}{n}}
\DeclareRobustCommand{\FAtwo}{\usefont{U}{fontawesome2}{m}{n}}
\DeclareRobustCommand{\FAthree}{\usefont{U}{fontawesome3}{m}{n}}
% icon-specific commands
\input{fontawesomesymbols-pdftex.tex}
\fi
答案3
答案4
作为Ulrike Fischer 表示,该软件包没有为 pdfLaTeX 正确设置字体。因此,无法使用普通的字体大小调整命令缩放它们。这是特定于 pdfLaTeX 的使用,并不影响 XeLaTeX/LuaLaTeX。
在我写答案的时候,Ulrike Fischer 发布了她的答案。由于我的答案包含更完整的配置,我希望她不会介意我发布它。
\documentclass{article}
\usepackage{fontawesome}
\DeclareFontFamily{U}{FontAwesomeOne}{}
\DeclareFontShape{U}{FontAwesomeOne}{m}{n}{<-> FontAwesome--fontawesomeone}{}
\DeclareRobustCommand\FAone{\fontencoding{U}\fontfamily{FontAwesomeOne}\fontseries{m}\fontshape{n}\selectfont}
\DeclareFontFamily{U}{FontAwesomeTwo}{}
\DeclareFontShape{U}{FontAwesomeTwo}{m}{n}{<-> FontAwesome--fontawesometwo}{}
\DeclareRobustCommand\FAtwo{\fontencoding{U}\fontfamily{FontAwesomeTwo}\fontseries{m}\fontshape{n}\selectfont}
\DeclareFontFamily{U}{FontAwesomeThree}{}
\DeclareFontShape{U}{FontAwesomeThree}{m}{n}{<-> FontAwesome--fontawesomethree}{}
\DeclareRobustCommand\FAthree{\fontencoding{U}\fontfamily{FontAwesomeThree}\fontseries{m}\fontshape{n}\selectfont}
\begin{document}
{Normal \faAdjust}
{\Huge Huge \faAdjust}
\end{document}
还值得注意的是,除了软件包作者的决定之外,没有任何理由不能将这些字体用于常规 TeX 引擎。但是,据我所知,目前对 pdfLaTeX 的支持有限,对 LaTeX 的支持则完全没有。