[Tex/LaTex] XeLaTeX and Roboto: No Ligatures

fontsligaturesopentypexetex

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}

Best Answer

(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.

Related Question