0

I got some problems loading .otf fonts with fontspec in lualatex. What I don't get is the following: Let's suppose I have several .ttf font styles. Then I will just specify them succesively for my main font styles.

\setmainfont{SourceSansPro-Light}[
    Path = fonts/, 
    BoldFont = SourceSansPro-Regular, 
    ItalicFont = SourceSansPro-LightIt]
}

However, I have only one SourceSansPro-Regular.otf file containing the bold and the italic style as well. If I specify this file exclusively, the other styles don't get loaded. So how do I include the other styles? It's probably an easy task, but I don't really understand the documentation...

EDIT: SourceSansPro is supposed to be an example; it could be any other font.

  • Why dont you \usepackage[light]{sourcesanspro}? – Alain Merigot Sep 29 at 22:23
  • because my actual font isn't sourcesanspro. It was supposed to be an example. – Ultimate Trick Sep 29 at 22:27
  • @UltimateTrick The question can't really be answered without saying how the actual font is implemented. Normally a font file contains only one font, e.g. SourceSansPro-Regular.otf and SourceSansPro-It.otf are different files. So the only way I would know about how this would work would be a ttc file (basically a collection of multiple fonts, you just have to specify the index) or a Variable Font (these are mostly used for different widths and weights though and currently are not implmented in luaotfload) – Marcel Krüger Sep 29 at 22:38
  • Hm okay. In this specific case my font ist Myriad Pro, stored only under MyriadPro-Regular.otf. And in MS Word I can switch to italics or bold. Perhaps, these are just MS Word generated?! – Ultimate Trick Sep 29 at 22:43
  • 2
    @UltimateTrick Right, normally Myriad Pro also has separate font files for italic/bold fonts, but you might have to pay for them separatly. Otherwise Word probably uses fake bold/fake italic fonts. fontspec can do the same (look at AutoFakeBold AutoFakeSlant in the manual) but you get way better results with the real variants. – Marcel Krüger Sep 29 at 22:52
0

As pointed out in the comments, I was just confused by MS Word's fake bold/fake italic: An .otf font file contains only one font.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.