
Gostaria de usar a fonte Gill Sans, que está instalada no /Library/Fonts/GillSans.ttc
meu Mac. De acordo com a fontspec
documentação, devo poder usar coleções TrueType especificando o índice da fonte. A documentação afirma que isso deve funcionar com o LuaTeX, mas estou tendo problemas para fazê-lo funcionar.
O suporte para coleções TrueType só foi testado no XeTeX, mas também deve funcionar com uma versão atualizada do LuaTeX e do
luaotfload
pacote.
O documento mínimo a seguir funciona na medida em que usa Gill Sans, e parece possível até usar pesos/formas específicas da fonte definindo uma nova família de fontes, mas não funciona \setmainfont
e pode usar comandos como \textbf{}
,,\textit{}
etc., como pode ser visto na captura de tela da saída da compilação deste documento.
\documentclass{article}
\usepackage{fontspec}
\setmainfont[
Ligatures=TeX,
Extension=.ttc,
UprightFeatures={FontIndex=0},
BoldFeatures={FontIndex=4},
ItalicFeatures={FontIndex=2},
BoldItalicFeatures={FontIndex=5}]{GillSans}
\newfontfamily\SemiBold[
Ligatures=TeX,
Extension=.ttc,
UprightFeatures={FontIndex=4}]{GillSans}
\begin{document}
\textbf{asdf}
\textit{asdf}
asdf
\textbf{\textit{asdf}}
{\SemiBold asdf}
\end{document}
Alguém sabe qual pode ser o problema e como resolvê-lo? O log mostra o seguinte:
LaTeX Font Warning: Font shape `TU/GillSans(0)/b/n' undefined
(Font) using `TU/GillSans(0)/m/n' instead on input line 18.
LaTeX Font Warning: Font shape `TU/GillSans(0)/m/it' undefined
(Font) using `TU/GillSans(0)/m/n' instead on input line 19.
LaTeX Font Warning: Font shape `TU/GillSans(0)/b/it' undefined
(Font) using `TU/GillSans(0)/b/n' instead on input line 21.
Além disso, executando o seguinte comando em um shell
luaotfload-tool --find 'Gill Sans SemiBold' -i
retorna o seguinte, o que sugere que o documento acima deve funcionar para escolher a fonte seminegrito como BoldFont por meio do índice 4:
luaotfload | resolve : Font "Gill Sans SemiBold" found!
luaotfload | resolve : Resolved file name "/Library/Fonts/GillSans.ttc", subfont nr. 4
** 1 Gill Sans SemiBold ********************************************************
ascender: 1487
averagewidth: 1154
boundingbox: <table>
1: -1162
2: -512
3: 2279
4: 1931
capheight: 1397
defaultvheight: 0
descender: -561
family: Gill Sans
fontname: GillSans-SemiBold
fullname: Gill Sans SemiBold
italicangle: 0.0
monospaced: false
panoseweight: demi
panosewidth: normal
pfmweight: 600
pfmwidth: 5
platformnames: <table>
macintosh: <table>
family: Gill Sans
fullname: Gill Sans SemiBold
postscriptname: GillSans-SemiBold
subfamily: SemiBold
windows: <table>
family: Gill Sans
fullname: Gill Sans SemiBold
postscriptname: GillSans-SemiBold
subfamily: SemiBold
subfamily: SemiBold
subfontindex: 4
units: 2048
version: 13.0d1e4
weight: semibold
width: normal
xheight: 934
Estou usando o MacTeX 2020, v3.14/2020-05-06 do luaotfload-tool
e v2.7i do fontspec
.
Responder1
Ao trabalhar com arquivos ttc, você não deve usar, Extension
mas adicionar .ttc
diretamente ao nome, caso contrário ele será detectado tarde demais e você terá que definir ItalicFont
/ BoldFont
/ BoldItalicFont
manualmente:
\documentclass{article}
\usepackage{fontspec}
\setmainfont[
Ligatures=TeX,
UprightFeatures={FontIndex=0},
BoldFeatures={FontIndex=4},
ItalicFeatures={FontIndex=2},
BoldItalicFeatures={FontIndex=5}]{GillSans.ttc}
\newfontfamily\SemiBold[
Ligatures=TeX,
Extension=.ttc,
UprightFeatures={FontIndex=4}]{GillSans}
\begin{document}
\textbf{asdf}
\textit{asdf}
asdf
\textbf{\textit{asdf}}
{\SemiBold asdf}
\end{document}