In my opinion, fontawesome5
should have a scale
option.Here's what you get normally
Unfortunately, the other given answer is not really good (see at the end for a comparison).
The idea can work, but in a different way. Here the scaling is 80% than the default size in all font sizes. You may want to experiment with the factor.
\RequirePackage{fix-cm}% if you use Computer Modern fonts\documentclass{article}\usepackage{fontawesome5}\makeatletter\AddToHook{cmd/faIcon/before}{% \begingroup\fontsize{\fpeval{\f@size*0.8}}{0}\selectfont}\AddToHook{cmd/faIcon/after}{\endgroup}\makeatother\begin{document}{\Huge X\faIcon{youtube}Y\par}some text before \faIcon{youtube} some text after...\end{document}
Comparison with the other answer
\documentclass{article}\usepackage{fontawesome5}\AddToHook{cmd/faIcon/before}{\begingroup\small}\AddToHook{cmd/faIcon/after}{\endgroup}\begin{document}{\Huge X\faIcon{youtube}Y\par}some text before \faIcon{youtube} some text after...\end{document}
With \Huge
it's exaggerated, but you'd get similar bad result in every font size.