8

When using the Lato font (e.g., Google fonts or Lato fonts), I get completely overlapping text:

enter image description here

When I view the PDF in Google Chrome's PDF viewer, it looks fine on the screen:

enter image description here

but it still prints like the bad version, and I am really only concerned with the printed output for this document.

This is what I'm using to produce the above:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Baskerville}
\newfontfamily\kgtitlefont[Scale=2]{Lato}
\begin{document}
{\kgtitlefont{This would make a good title}}\\
This would make good text.
\end{document}

I know that this is XeTeX-specific because if I use LuaTeX (through TeXworks or TeXShop in both cases), the Lato looks fine, but LuaTeX can't find Baskerville:

luaotfload | Updating the font names database:
luaotfload | Scanning TEXMF fonts...
luaotfload | Scanning OS fonts...
luaotfload | Font names database saved: %s 
: /Users/kayhan/Library/texlive/2012/texmf-var/luatex-cache/generic/names/otfl-
names.lua

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
./testroboto.tex:3: fontspec error: "font-not-found"
! 
! The font "Baskerville" cannot be found.
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.3 \setmainfont{Baskerville}

I would rather fix Lato in XeTeX, but would be okay with fixing Baskerville in LuaTeX.

I am fairly experienced with LaTeX on Linux, but am relatively new to XeTeX, fontspec, and Mac OS X.

Update: I have TeX Live 2012 Version beta-0.70.2-2012062819 (TeX Live 2012) and the baskerville font I have is a ttc, so that this may be the problem. The XeLaTeX problem appears in adobe acroreader and preview. It does not appear in chrome, though. I will try to update TeX Live on my 10.8.5 system and see what happens. It will take a little time to download this. I'll report back when done.

Update 2: After installing TeX Live 2013 (thank you BitTorrent!), I can get the document to work with Lua(La)TeX (i.e., get LuaTeX to find and use the Baskerville .ttc font I have), but with XeTeX, the font spacing is still messed up. Note that the Scale=2 option does not change anything. The following also produces illegible font spacing with XeTeX:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Baskerville}
\newfontfamily\kgtitlefont{Lato}
\begin{document}
{\kgtitlefont{This would make a good title}}\\
This would make good text.
\end{document}

So I have a good work-around (Use LuaTeX instead of XeTeX), I am still interested in getting it to work with XeTeX, if only to understand better how it works.

Update 3: After reading @Nils L.'s comment, here is an even more minimal working example:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Lato}
\begin{document}
This is even more minimal.
\end{document}

which produces the following:

enter image description here

Note that in some PDF viewers (TeXWorks, Google Chrome) it looks fine on the screen, but with most PDF viewers (acroread, preview, safari) it looks awful on the screen. For all PDF viewers it prints incorrectly.

Update 4: When changing \setmainfont{Lato} to \setmainfont{Lato-Reg.ttf}, it works correctly. I don't understand why this makes a difference, but I guess I have a lot to learn about fontspec.

David Carlisle
  • 757,742
kayhan
  • 81
  • 2
  • 2
    What TeX distribution are you using? TeX Live (MacTeX) prior to the 2013 release disallowed using .ttc system fonts with LuaLaTeX. I can't confirm the bad appearance of the XeLaTeX version as I don't have Chrome. – egreg Oct 13 '13 at 16:15
  • I run MacTeX2013 on a MacBook running MacOSX 10.7.5. When running your MWE under LuaLaTeX, I experience no difficulty of the sort that you describe, viz., "LuaTeX can't find Baskerville". Which version of MacTeX and MacOSX do you run? – Mico Oct 13 '13 at 16:22
  • 1
    Prematurely hit enter.... I have TeX Live 2012 This is LuaTeX, Version beta-0.70.2-2012062819 (TeX Live 2012) and the baskerville font I have is a ttc, so that this may be the problem. The XeLaTeX problem appears in adobe acroreader and preview. It does not appear in chrome, though. I will try to update TeX Live on my 10.8.5 system and see what happens. – kayhan Oct 13 '13 at 16:29
  • @user38215: Please edit your question to include new information instead of including it in comments. – Martin Schröder Oct 13 '13 at 16:36
  • @user38215 There is no need to download Lato, it's already in TeX Live 2013. – egreg Oct 13 '13 at 16:36
  • NB (@MartinSchröder): edited tags & title to avoid confusion. What's wrong with the type in the example is not the kerning (although it might be wrong as well), but the letters' spacing (as in: all letters are uniformly spaced wrong, as opposed to: a few paris are wrongly kerned). – Nils L Oct 13 '13 at 16:41
  • @user38215: the role of Baskerville still isn't clear to me. All I know is the problem disappears when you switch to Lua, but then Baskerville can't be found. Could you elaborate on this? Do you get the problems you're talking about only when that specific Baskerville is active? The thing is we don't know which of the two dozens Baskerville renditions you're using, and even if we did, we may not necessarily have it available on our machines. Try to make your example more mimimal by excluding Baskerville altogether: \setmainfont{Lato}. Also, what about that scale thing? – Nils L Oct 13 '13 at 17:05
  • @NilsL - Baskerville is a system font on MacOS; the reason the OP is having a problem with LuaTeX could be related to the fact that thru MacTeX2012 Baskerville erroneously was on a blacklist of "bad" fonts; see also using Hoefler Text font under lualatex and MacOSX. Anyway, the blacklist stuff was resolved long ago and should definitely no longer be a factor once the OP upgrades his/her TeX distribution to MacTeX2013. – Mico Oct 13 '13 at 18:58
  • 2
    Re your third update: What happens if you specify \setmainfont{Lato-Reg.ttf} rather than \setmainfont{Lato} and compile under XeLaTeX? – Mico Oct 13 '13 at 19:07
  • 5
    This is the same as http://tex.stackexchange.com/a/134244/729, just use the TTF version of the font. – خالد حسني Oct 13 '13 at 21:27

0 Answers0