3

I'm trying to use the Roboto Font Family with XeLaTeX (or LuaLaTeX).

When I'm writing a Document in XeLaTeX, no ligatures are used (but there are used on Android, so ligatures should be there).

otfinfo from the LCDF typetools shows with the option --features, that liga is available. I use MiKTeX on Windows 8.1.

Here is a minimal working example:

\documentclass[
  11pt,
  a4paper
]{scrartcl}

\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}

\setmainfont[
  ExternalLocation,
  Extension=.ttf,
  UprightFont=*-Regular,
  ItalicFont=*-Italic,
  BoldFont=*-Bold,
  BoldItalicFont=*-BoldItalic,
  Ligatures=Common
]{Roboto}


\begin{document}

fi

\end{document}
  • Welcome to TeX.SX! You don't have to sign with your name since it automatically appears in the lower right corner of your post. – Adam Liter Mar 18 '14 at 16:16
  • 1
    Compiling your code with MiKTeX on Win7, I do get the ligature. Have you made sure all packages are updated? – doncherry Mar 18 '14 at 16:25
  • I also get the ligature, compiling with TeX Live. Are you getting something different from this: s000.tinyupload.com/index.php?file_id=00396594967591076602 – Sverre Mar 18 '14 at 16:37
  • Thank you! This is interesting. In the Log the following Version of XeTeX is listed: This is XeTeX, Version 3.1415926-2.4-0.9998 (MiKTeX 2.9 64-bit) (preloaded format=xelatex 2014.1.11) 18 MAR 2014 17:57 entering extended mode. The MiKTeX Distribution was installed nearly a year ago. I try to update all packages. But I would like to add that adding RawFeature={+liga} to the \setmainfont defintion and compiling using Luatex gets the Ligatures to work. In this case the output looks exactly like yours, Sverre. – user48190 Mar 18 '14 at 16:59
  • But I'm wondering why it doesn't work using the minimal example above and just compiling with XeTeX. – user48190 Mar 18 '14 at 17:02
3

(More than a year has passed since the query was posted initially. However, the following answer may still be useful to some people.)

The key to getting this program to run under XeLaTeX appears to be to set the Path option correctly when issuing the instruction \setmainfont. The following, modified version of your code assumes that you use TeXLive2015 (or MacTeX2015); simply change the Path variable appropriately if the font is located some place other than /usr/local/texlive/2015/texmf-dist/fonts/truetype/google/roboto/.

enter image description here

\documentclass[11pt, a4paper]{scrartcl}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures={TeX,Common}}

\setmainfont[
     Path = /usr/local/texlive/2015/texmf-dist/fonts/truetype/google/roboto/,
     Extension      = .ttf,
     UprightFont    = *-Regular,
     ItalicFont     = *-RegularItalic,
     BoldFont       = *-Bold,
     BoldItalicFont = *-BoldItalic,
    ]{Roboto}

\begin{document}
Ligatures enabled: fi fl ffi ffl

Ligatures disabled: f\kern0pti f\kern0ptl f\kern0ptf\kern0pti f\kern0ptf\kern0ptl
\end{document}

In contrast, LuaLaTeX doesn't appear to need the Path option in order to "find" the font files. In fact, issuing the instruction

\setmainfont{Roboto}

appears to be all that's for the program to run correctly under LuaLaTeX.

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.