![Font Awesome 不支持“Scale”功能](https://linux22.com/image/343191/Font%20Awesome%20%E4%B8%8D%E6%94%AF%E6%8C%81%E2%80%9CScale%E2%80%9D%E5%8A%9F%E8%83%BD.png)
我经常将“Open Sans”和“Font Awesome”与 LuaLaTeX 结合使用。我可以按预期缩放 Open Sans,但我不能缩放 Font Awesome:
\documentclass{article}
\usepackage[german]{babel}
\usepackage{fontawesome}
\usepackage{fontspec}
\usepackage{parskip}
\setmainfont[Scale=1.0]{Open Sans} % Scale works
\fontspec{FontAwesome}[Scale=3.0] % Scale DOES NOT work
\begin{document}
\makebox[1cm][l]{\faPhone} Test \\
\makebox[1cm][l]{\faExternalLink} Test \\
\makebox[1cm][l]{\faEnvelopeO} Test \\
\end{document}
如何缩放 Font Awesome?对我来说,最好的解决方案是为整个文档设置一个“缩放因子”。我可以这样做吗?
多谢!
问候
托尔斯滕
答案1
\fontspec 是错误的命令,它就像 \huge 或 \sffamily 一样,用于局部字体更改。如果要更改整个文档的字体,请更改底层字体系列:
\documentclass{article}
\usepackage[german]{babel}
\usepackage{fontawesome}
\usepackage{fontspec}
\setmainfont[Scale=1.0]{Open Sans} % Scale works
\newfontfamily{\FA}{FontAwesome}[Scale=3.0] % Scale DOES NOT work
\begin{document}
\makebox[1cm][l]{\faPhone} Test \\
\makebox[1cm][l]{\faExternalLink} Test \\
\makebox[1cm][l]{\faEnvelopeO} Test \\
\end{document}
答案2
scaled
添加一个选项相当容易fontawesome
,但是,遗憾的是,包的作者却没有这样做。
\documentclass{article}
\usepackage[german]{babel}
\usepackage{fontspec}
\usepackage{fontawesome}
\usepackage{letltxmacro}
\usepackage{etoolbox}
\makeatletter
\ifdefined\FA
% we're in XeLaTeX or LuaLaTeX
\LetLtxMacro\origFA\FA
\renewcommand{\FA}{\fontsize{\FAsize}{0}\origFA}
\else
% pdflatex
\preto\FAone{\fontsize{\FAsize}{0}}
\preto\FAtwo{\fontsize{\FAsize}{0}}
\preto\FAthree{\fontsize{\FAsize}{0}}
\fi
\newcommand{\FAsize}{30}% <---- set here the font size you want
\setmainfont[Scale=1.0]{Open Sans} % Scale works
\begin{document}
\makebox[1cm][l]{\faPhone} Test \\
\makebox[1cm][l]{\faExternalLink} Test \\
\makebox[1cm][l]{\faEnvelopeO} Test \\
\end{document}