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
fontencwithxetexjust usefontspec– David Carlisle Dec 07 '14 at 20:56Lato-Lig.ttfwith the T1 encoding, rather than TU? If not, remove\usepackage{T1}[fontenc]. – Davislor Apr 13 '19 at 22:00XeLaTeXcannot pick out bold, italic etc. from the file name. There might be a way to specify it explicitly, but I don't know how. This happened to me: I usedRalewayas a collection of.ttfs on one computer and a variable-font file on another, and it wouldn't compile bold/italic on the latter. – gsarret Mar 31 '22 at 12:51