0

When I try to use the Lato-Regular ttf font and Lato-Bold ttf font XeLaTeX produces a pdf in which some of the characters are set on top of each other, but when using eg. Lato-Italic, Lato-BoldItalic, Lato-Black, Lato-BlackItalic the characters are typeset as one would expect.

A minimal working example

\documentclass[a4paper]{article}
\usepackage{fontspec}
\newfontfamily\fontLato[
  Mapping=tex-text,
  UprightFont=*-Regular,
  ItalicFont=*-Italic,
  BoldFont=*-Bold,
  BoldItalicFont=*-BoldItalic,
]{Lato}

\newfontfamily\fontLatoHeavy[
  Mapping=tex-text,
  UprightFont=*-Bold,
  ItalicFont=*-BoldItalic,
  BoldFont=*-Black,
  BoldItalicFont=*-BlackItalic,
]{Lato}

\begin{document}
default font:\par
Test\par
Lato-Regular:\par
{\fontLato Test}\par
Lato-Bold:\par
{\fontLato \bfseries Test}\par
Lato-Italic:\par
{\fontLato \itshape Test}\par
Lato-BoldItalic:\par
{\fontLato \bfseries \itshape Test}\par
Lato-Black:\par
{\fontLatoHeavy \bfseries Test}\par
Lato-BlackItalic:\par
{\fontLatoHeavy \bfseries \itshape Test}\par
\end{document}

produces the following output with xelatex

enter image description here

Does anyone have an idea for how I get xelatex to typeset Lato Regular and Lato Bold correctly?


Bit of background

I just recently installed of a new version of Debian (upgraded my hard drive), that means my font directory are newly installed. In connection with the Debian install I also went from TexLive 2017 (XeTeX 3.14159265-2.6-0.99998 with fontspec 2017/11/09 v2.6g) on my old machine to TexLive 2018 (also XeTeX 3.14159265-2.6-0.99999, but with fontspec 2019/02/12 v2.7b). Before this install I had no problem with any of the Lato fonts.

When I list my available fonts I see no difference between the kind of files available for the fonts working and those, that don't:

>>fc-list | grep 'Lato-Regular'
/usr/local/texlive/2018/texmf-dist/fonts/type1/typoland/lato/Lato-Regular.pfb: Lato:style=Regular
/usr/share/fonts/truetype/lato/Lato-Regular.ttf: Lato:style=Regular
/usr/local/texlive/2018/texmf-dist/fonts/truetype/typoland/lato/Lato-Regular.ttf: Lato:style=Regular

>>fc-list | grep 'Lato-Black\.'
/usr/local/texlive/2018/texmf-dist/fonts/truetype/typoland/lato/Lato-Black.ttf: Lato,Lato Black:style=Black,Regular
/usr/share/fonts/truetype/lato/Lato-Black.ttf: Lato,Lato Black:style=Black,Regular
/usr/local/texlive/2018/texmf-dist/fonts/type1/typoland/lato/Lato-Black.pfb: Lato Black:style=Regular

But when I compare the output that fonspec writes to the log file for some the the documents I produced with xelatex on my old system there are slight differences (that I have found, probably also some that I have not found). Here an excerpt from the log-file of my CV, that was produced on the old system and where I use the Lato fonts defined in the same way as done in the mwe above:

.................................................
. fontspec info: "defining-font"
.
. Font family 'Lato(0)' created for font 'Lato' with options
. [Mapping=tex-text,UprightFont=*-Regular,ItalicFont=*-Italic,BoldFont=*-Bold,BoldItalicFont=*-BoldItalic].
.
.  This font family consists of the following NFSS series/shapes:
.
. - 'normal' (m/n) with NFSS spec.:
. <->"Lato-Regular/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'small caps'  (m/sc) with NFSS spec.:
. - 'bold' (bx/n) with NFSS spec.:
. <->"Lato-Bold/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold small caps'  (bx/sc) with NFSS spec.:
. - 'italic' (m/it) with NFSS spec.:
. <->"Lato-Italic/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'italic small caps'  (m/itsc) with NFSS spec.:
. - 'bold italic' (bx/it) with NFSS spec.:
. <->"Lato-BoldItalic/OT:script=latn;language=DFLT;mapping=tex-text;"
. - 'bold italic small caps'  (bx/itsc) with NFSS spec.:
.................................................

Here is the output from the log file from the mwe

Package fontspec Info: Font family 'Lato(0)' created for font 'Lato' with
(fontspec)             options
(fontspec)             [Mapping=tex-text,UprightFont=*-Regular,ItalicFont=*-Italic,BoldFont=*-Bold,BoldItalicFont=*-BoldItalic].
(fontspec)
(fontspec)              This font family consists of the following NFSS
(fontspec)             series/shapes:
(fontspec)
(fontspec)             - 'normal' (m/n) with NFSS spec.:
(fontspec)             <->"Lato-Regular/OT:mapping=tex-text;"
(fontspec)             - 'small caps'  (m/sc) with NFSS spec.:
(fontspec)             - 'bold' (bx/n) with NFSS spec.:
(fontspec)             <->"Lato-Bold/OT:mapping=tex-text;"
(fontspec)             - 'bold small caps'  (bx/sc) with NFSS spec.:
(fontspec)             - 'italic' (m/it) with NFSS spec.:
(fontspec)             <->"Lato-Italic/OT:mapping=tex-text;"
(fontspec)             - 'italic small caps'  (m/itsc) with NFSS spec.:
(fontspec)             - 'bold italic' (bx/it) with NFSS spec.:
(fontspec)             <->"Lato-BoldItalic/OT:mapping=tex-text;"
(fontspec)             - 'bold italic small caps'  (bx/itsc) with NFSS spec.:

Beside that the output layout is a bit different, as I can see the only difference is that the for the mwe (in which lato regular and lato bold fails) the strings "/OT:mapping=tex-text;" omits the additional settings "/OT:script=latn;language=DFLT;mapping=tex-text;" which are present in the log from the CV (where all the lato fonts are typeset correctly).

BUT this is missing both for the fonts that are typeset incorrectly as well as for the correctly set fonts. I guess OT is short for OpenType settings, but from the fontspec manual it seems that one should only set the script and language for OpenType fonts (.otf) and not for .ttf as Lato. Also if I try to set the script in the mwe I get a warning and it is ignored.

Added: I also tried using the Lato fonts in LibreOffice (and tried to export a pdf from LibreOffice). In this case no problems.

4
  • You can explicitly choose the script by adding Script=Latin. I can't reproduce this on macOS.
    – egreg
    Apr 26, 2019 at 9:54
  • You seem to have both a pfb and and ttf version of the font - that's often a source for troubles. Select the fonts by filename and explicitly add the extension. Apr 26, 2019 at 9:59
  • Thanks Ulrike!! Adding Extension=.ttf to the newfontfamily definition does the job. If you'll make your comment an answer, then it is the solution
    – Daniel
    Apr 26, 2019 at 10:11
  • @UlrikeFischer But do you have an idea why it is a problem for Regular and Bold, but not eg Italic or Black - there are pfb files for these as well. In the fc-list the pfb file appears first for the regular font, but this is not the case for the bold font, which also fails
    – Daniel
    Apr 26, 2019 at 10:20

1 Answer 1

1

You seem to have both a pfb and and ttf version of the font - that's often a source for troubles: depending on the internal font names and random effects like which on is found first xetex can use the (wrong) pfb.

Select the fonts by filename and explicitly add the extension.

You must log in to answer this question.

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