3

I'm trying to use custom fonts, but I can't get it to work. Compiling with XeLaTex

\documentclass[a4paper]{article} 

\usepackage{fontspec}
\usepackage[T1]{fontenc} 
\usepackage[usenames,dvipsnames]{xcolor}

\definecolor{primary}{HTML}{2b2b2b}

\setmainfont[Color=primary, 
Path = fonts/lato/,
BoldItalicFont=Lato-RegIta,
BoldFont=Lato-Reg,
ItalicFont=Lato-LigIta]{Lato-Lig}

\begin{document}

Test example

\end{document}

Build Log Output:

LaTeX Font Warning: Font shape `T1/Lato-Lig(0)/m/n' undefined
(Font)              using `T1/cmr/m/n' instead on input line 13.

Folder Structure (ls -R)

fonts  test.tex   
./fonts: lato
./fonts/lato: Lato-BlaIta.ttf  Lato-Bol.ttf     Lato-LigIta.ttf  Lato-Reg.ttf Lato-Bla.ttf     Lato-HaiIta.ttf  Lato-Lig.ttf Lato-BolIta.ttf  Lato-Hai.ttf     Lato-RegIta.ttf
  • 1
    don't use fontenc with xetex just use fontspec – David Carlisle Dec 7 '14 at 20:56
  • @DavidCarlisle It seems to be sometimes necessary: see tex.stackexchange.com/q/115627/18401. – Denis Bitouzé Apr 20 '16 at 8:47
  • 1
    @DenisBitouzé well maybe I should have said don't use legacy 8bit text fonts with xetex. (hyphenation will be wrong if you set text in T1 encoding, for a start) – David Carlisle Apr 20 '16 at 13:33
  • @DavidCarlisle Same arguments as Joseph's ones, here :) – Denis Bitouzé Apr 20 '16 at 13:52
  • Are you intentionally trying to load Lato-Lig.ttf with the T1 encoding, rather than TU? If not, remove \usepackage{T1}[fontenc]. – Davislor Apr 13 at 22:00
0

Deedy Resume issue(s) as addressed in 2018 4Q. There may be some changes during the past 4 yrs to one or more of the relevant packages. To address related questions, I've had to edit the .cls file for (a) font access and (b) compiling, generally [e,g., there are two \\} that should be \\ } in the openfont .cls file].

Regarding font specific matters, using the openfont .cls file as an example, editing the .cls file by

  • (A) removing all Path = segments, and
  • (B) using the specific fontfilename, e.g., {Lato-Lig.ttf}, {Lato-Bol.ttf}, {Raleway-ExtraLight.otf}, and {Raleway-Medium.otf} with similar specifics in the fontface assignments, e.g., BoldItalicFont=Lato-RegIta.ttf,

then

  • (C) manually adding the font into the known texlive structure (if not already there) [it's good to put .ttf files in the truetype folder and .otf files in the opentype folder [followed, of course by mktexlsr and fc-cache -fv from the command line]],

rendered the .cls file productive. There's also a \custombold command that may be defined elsewhere. Replacing that with \bfseries works.

Yes, xelatex is supposed to have capability of finding the system's font files [/System/Library/Fonts and /Library/Fonts] (mac structure). xelatex also may still have a preference of "once and only once defined fonts," as well.

If the Deedy Resume activity was a phase, then this is an academic exercise. Where interest may (still) exist, the specific code can always be added.

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.