TransWikia.com

how can I set Roboto Slab to italic using fontspec

TeX - LaTeX Asked on December 20, 2020

I am having the weird behaviour, that I cannot get a given font to be italic. Bold is no problem, but italic is.

RequirePackage{fontspec}
defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
setmainfont{Roboto Slab}[
        Ligatures={TeX},
        %ItalicFont=Roboto Slab Light, % I can set another font, but seem not to be able to find THIS font in italic.
]

when I now do

textsl{text} ... or ... itshape mytext

nothing happens.

How do I get the font to italic.

One Answer

Roboto Slab has no italic font, but you can use fontspec's fake slant feature:

documentclass{article}

usepackage{fontspec}
defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
setmainfont{Roboto Slab}[
  AutoFakeSlant=0.2,      
  Ligatures={TeX},
]

begin{document}
  textsl{text} ... or ... itshape mytext
end{document}

enter image description here

The result is really ugly. Better use Roboto or Roboto Condensed instead...

Correct answer by DG' on December 20, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP