2

XeLaTeX

How can I set different font for all italic in the document?

\setromanfont[StylisticSet=2,
 ItalicFont={Phenomena Light},
{Cormorant Medium}  % Основной шрифт текста

It's work. But I can't set ItalicFont size

\setromanfont[StylisticSet=2,
    ItalicFont={Phenomena Light},
    ItalicFeatures={FontSize=11pt}]
    {Cormorant Medium}  % Основной шрифт текста

Don't work, get an error.

The size of the main text 12pt. The font for italics is slightly higher than the main text.

enter image description here

2
  • 1
    Please tell us what the default document font size is. 10pt? 12pt? Something else? Please also tell us what you're trying to achieve here. E.g., are you trying to equate the x-heights of the upright and italic font faces? (If so, there's a much better way than to specify an absolute font size.) Incidentally, \setromanfont is deprecated; use \setmainfont instead.
    – Mico
    Jul 25, 2018 at 9:32
  • 1
    @Mico, Thanks. I have not decided yet. For today it would be great if you could tell how to level the X-height of the font. Jul 25, 2018 at 9:57

2 Answers 2

3

I would use the \defaultfontfeatures directive to match the x-heights of all fonts automatically. E.g.,

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont[ItalicFont={Times New Roman Italic}]{Arial}

\begin{document}
The \textit{quick} brown \textit{fox} jumps \textit{over} the \textit{lazy} dog.
\end{document} 

where I've substituted in two fonts which happen to be available on my system. The result is:

enter image description here

For comparison, this is what one gets without the \defaultfontfeatures directive -- observe the vastly different x-heights of the main and italic font:

enter image description here

1
3

Use Scale. In the example I use Scale=2 just by way of example; you may want to use

Scale=MatchUppercase

or

Scale=MatchLowercase

instead of an explicit factor.

\documentclass{article}
\usepackage{fontspec}

\setmainfont{TeX Gyre Termes}[
  ItalicFont={TeX Gyre Heros Italic},
  ItalicFeatures={Scale=2},
]

\begin{document}

Upright text and \textit{italic}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .