# How change the default font size of a particular font mid document?

I am using XeLaTeX(fontspec) and I have the following problem. I am using a lot of differents fonts in the preamble like

\setmainfont{GFSDidot}
\newfontfamily{\greekfont}{CMU Serif}
\newfontfamily{\greekfontsf}{CMU Sans Serif}
\newfontfamily{\hebrewfont}{Linux Libertine O}[Scale=MatchUppercase]


and I use stackengine package to stack differents fonts. I would like to change locally the font size for one particular font without affecting the size of the other fonts that are used together in the stack process. I am afraid that the command \addfontfeatures[Scale=..] will affect the size of any font in the stack! So my question is: Is it possible to change the font size of a particular font locally (without the need to define a new \newfontfamily for this particular font and with the desired size)? Something like {\addfontfeatures{\hebrewfont}[Scale=..] ....} ? You could use the following minimal example:

\documentclass[letterpaper, 12pt]{article}
\usepackage[no-math]{fontspec}
\usepackage{stackengine}
\usepackage{polyglossia}
\usepackage{newunicodechar}
\setmainfont{Arial}
\newfontfamily{\hebrewfont}{Linux Libertine O}
\newunicodechar{ǎ}{\accent\string"02C7 a}
\newunicodechar{א}{{\hebrewfont{א}}}
\newunicodechar{ע}{{\hebrewfont{ע}}}
\begin{document}
\stackengine{\Lstackgap}{ǎ}{א}{O}{c}{F}{\useanchorwidth}{L}\\
\end{document}


Also I have the same problem when I tried to define a "scaled" command something like \newcommand\hebr[1]{\fontspec{Linux Libertine O}\addfontfeature{Scale=#1}} Then the output of {\hebr{0.3}ǎא } is not the expected one!!

• So in this case you want to make א smaller but leave ǎ the same size? – David Carlisle Nov 8 '15 at 14:16
• @David Carlisle Yes! I would like to make small font size changes in a particular font inside a particular stack! Thanks! – kornaros Nov 8 '15 at 14:20
• I can't persuade your code to compile, by the way. Nothing but errors. – cfr Nov 9 '15 at 4:19
• @cfr! Yes, indeed. The code before \fontspec{\hebrewfont} is indeed OK. The problem exists after that. I think that \fontspec has some problems. You cannt pick a font using \fontspec{\hebrewfont} . You have to use explicitly its name Linux Libertine Oafter \fontspec... The problem is irerevalent with stackengine package! Thanks for your interest! – kornaros Nov 9 '15 at 13:51
• You're not supposed to say \fontspec{\hebrewfont}, though, so it isn't surprising it doesn't work. At least, that is not how it usually is used. Do you see something in the manual which suggests this should work? The point of saying \newfontfamily\fontfamilyname, as I understand it, is that you can then say \fontfamilyname without calling \fontspec explicitly. In the case of Polyglossia, defining \hebrewfont enables automatic switching to the appropriate font when Hebrew is active. But your code doesn't enable support for Hebrew. – cfr Nov 9 '15 at 23:33

If the font to be scaled always appears at the same level in the stack (for example, always on the top), then one can set up a macro, here \mystackon, that scales the upper element of the stack.

\documentclass[letterpaper, 12pt]{article}
\usepackage[no-math]{fontspec}
\usepackage{stackengine}
\usepackage{polyglossia}
\usepackage{newunicodechar}
\setmainfont{Arial}
\newfontfamily{\hebrewfont}{Linux Libertine O}
\newunicodechar{ǎ}{\accent\string"02C7 a}
\newunicodechar{א}{{\hebrewfont{א}}}
\newunicodechar{ע}{{\hebrewfont{ע}}}
\newcommand\mystackon[2]{%
\stackengine{\Lstackgap}{#1}{\scalebox{.8}{#2}}{O}{c}{F}{\useanchorwidth}{L}%
}
\begin{document}
Unaltered:
\stackengine{\Lstackgap}{ǎ}{א}{O}{c}{F}{\useanchorwidth}{L}
Revised:
\mystackon{ǎ}{א} \mystackon{b}{ע}
\end{document}


On the other hand, if one needed the smaller font on demand, in arbitrary locations, one could create the macros \smallhebrew and \normalhebrew as directives on changing the font size. This is accomplished through a redefinition of \hebrewfont to include (or not) a scaling.

\documentclass[letterpaper, 12pt]{article}
\usepackage[no-math]{fontspec}
\usepackage{stackengine}
\usepackage{polyglossia}
\usepackage{newunicodechar}
\setmainfont{Arial}
\newfontfamily{\hebrewfont}{Linux Libertine O}
\newunicodechar{ǎ}{\accent\string"02C7 a}
\newunicodechar{א}{{\hebrewfont{א}}}
\newunicodechar{ע}{{\hebrewfont{ע}}}
\let\svhebrewfont\hebrewfont
\newcommand\normalhebrew{\let\hebrewfont\svhebrewfont}
\begin{document}
normal: \stackengine{\Lstackgap}{ǎ}{א}{O}{c}{F}{\useanchorwidth}{L}
\stackengine{\Lstackgap}{ע}{ǎ}{O}{c}{F}{\useanchorwidth}{L}
%
small: \smallhebrew%
\stackengine{\Lstackgap}{ǎ}{א}{O}{c}{F}{\useanchorwidth}{L}
\stackengine{\Lstackgap}{ע}{ǎ}{O}{c}{F}{\useanchorwidth}{L}
%
back to normal: \normalhebrew%
\stackengine{\Lstackgap}{ǎ}{א}{O}{c}{F}{\useanchorwidth}{L}
\stackengine{\Lstackgap}{ע}{ǎ}{O}{c}{F}{\useanchorwidth}{L}
\end{document}


• My compliments for your works with LaTeX. Hi. – Sebastiano Feb 15 '17 at 18:22