![Usando o arquivo .fontspec com várias declarações defaultfontfeatures](https://rvso.com/image/399810/Usando%20o%20arquivo%20.fontspec%20com%20v%C3%A1rias%20declara%C3%A7%C3%B5es%20defaultfontfeatures.png)
Estou tentando criar um arquivo de definição fontspec para Minion3 que inclua todos os tamanhos ópticos. Eu faço funcionar quando defino tudo em uma única defaultfontfeatures
definição:
\defaultfontfeatures[Minion3]
{
UprightFont = Minion3-Regular,
BoldFont = Minion3-Bold,
ItalicFont = Minion3-Italic,
BoldItalicFont = Minion3-BoldItalic,
%Numbers = {Proportional,OldStyle},
Numbers = {Proportional},
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead},
{ Size = 25.9-, Font = Minion 3 Display},
},
BoldFeatures = {
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption Bold},
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead Bold},
{ Size = 25.9-, Font = Minion 3 Display Bold},
},
},
ItalicFeatures = {
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption Italic},
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead Italic},
{ Size = 25.9-, Font = Minion 3 Display Italic},
},
},
BoldItalicFeatures = {
SizeFeatures = {
{ Size = -9.9, Font = Minion 3 Caption Bold Italic},
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion 3 Subhead Bold Italic},
{ Size = 25.9-, Font = Minion 3 Display Bold Italic},
},
},
}
Porém, de acordo com o manual fontspec (página 12--13), devo poder ter no mesmo arquivo uma declaração para cada fonte Regular, Negrito, Itálico e BoldItálico, assim:
\defaultfontfeatures[Minion3]{
UprightFont = {Minion3R},
BoldFont = {Minion3B},
ItalicFont = {Minion3I},
BoldItalicFont = {Minion3BI},
%Numbers = {Proportional,OldStyle},
Numbers = {Proportional},
}
\defaultfontfeatures[Minion3R]{
Extension = .otf,
Font = Minion3-Regular,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-Regular },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-Regular},
{ Size = 25.9-, Font = Minion3Display-Regular},
},
}
\defaultfontfeatures[Minion3B]{
Font = Minion3-Bold,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-Bold },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-Bold},
{ Size = 25.9-, Font = Minion3Display-Bold},
},
}
\defaultfontfeatures[Minion3I]{
Font = Minion3-Italic,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-Italic },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-Italic},
{ Size = 25.9-, Font = Minion3Display-Italic},
},
}
\defaultfontfeatures[Minion3BI]{
Font = Minion3-BoldItalic,
SizeFeatures = {
{ Size = -9.9, Font = Minion3Caption-BoldItalic },
{ Size = 9.9-13.9 },
{ Size = 13.9-25.9, Font = Minion3Subhead-BoldItalic},
{ Size = 25.9-, Font = Minion3Display-BoldItalic},
},
}
Infelizmente a segunda versão não funciona e a compilação falha com o erro
! Erro fontspec do pacote: A fonte "Minion3R" não pode ser encontrada.
o arquivo de definição fontspec é chamado Minion3.fontspec
e um arquivo tex de teste para demonstrar os recursos é retirado dehttp://tex.stackexchange.com/q/126096/14066(https://bitbucket.org/phg/lua-la-tex-tests/src/default/latex/ltx-fontspec-optical-size-3.tex):
\documentclass [12pt] {article}
\usepackage {fontspec}
%% set your font here
%\setmainfont {Arno Pro}
\setmainfont{Minion3}
%% helper for extracting the font name name, please ignore
\def\fontinfo{%
\directlua {
local f = fonts.hashes.identifiers [font.current ()]
if f then
tex.sprint (f.fullname, " ", string.sub (tostring (f.size / 2^16), 1, 4), "pt")
end
}%
}
%% testing macro
\def\test#1{%
#1\section {\detokenize {#1}}
\begin {itemize}
\item {\rmfamily \upshape \fontinfo}
\item {\rmfamily \upshape \bfseries \fontinfo}
\item {\rmfamily \itshape \fontinfo}
\item {\rmfamily \itshape \bfseries \fontinfo}
\item {\rmfamily \scshape \fontinfo}
\end {itemize}
}
\begin {document}
testing family ``\rmdefault'' ...\par\vskip1cm
\test\tiny
\test\scriptsize
\test\small
\test\normalsize
\test\large
\test\Large
\test\LARGE
\test\Huge
\end {document}
Tenho certeza de que estou perdendo algo óbvio, mas não consigo descobrir o quê.
Editar:
Como isso não é um Minion3
problema e esta fonte é proprietária, pode ser difícil replicá-la. Atualmente, esse problema também pode ser reproduzido sem o SizeFeatures
, então adicionei um novo MyXCharter.fontspec
arquivo que reproduz o primeiro obstáculo com um conjunto de fontes que vem com o texlive:
\defaultfontfeatures[MyXCharter]{
UprightFont = {XCharterR},
BoldFont = {XCharterB},
ItalicFont = {XCharterI},
BoldItalicFont = {XCharterBI},
SlantedFont = {XCharterS},
BoldSlantedFont = {XCharterBS},
%Numbers = {Proportional,OldStyle},
Numbers = {Proportional},
}
\defaultfontfeatures[XCharterR]{
Extension = .otf,
Font = XCharter-Roman,
}
\defaultfontfeatures[XCharterB]{
Extension = .otf,
Font = XCharter-Bold,
}
\defaultfontfeatures[XCharterI]{
Extension = .otf,
Font = XCharter-Italic,
}
\defaultfontfeatures[XCharterBI]{
Extension = .otf,
Font = XCharter-BoldItalic,
}
\defaultfontfeatures[XCharterS]{
Extension = .otf,
Font = XCharter-Slanted,
}
\defaultfontfeatures[XCharterBS]{
Extension = .otf,
Font = XCharter-BoldSlanted,
}