fontspec
fontspec copied to clipboard
`SmallCapsFeatures` parsing grows exponentially when interacting with `SizeFeatures` and friends
Description
I was setting up a commercial type family with 3 optical sizes, and I tried to follow the “strict hierarchy” as written by the manual:
UprightFeatures =
{
SizeFeatures =
{
{
Size = -10,
Font = ...,
SmallCapsFeatures = {...},
...
},
...
}
}
The idea is that letter spacing for small caps should be different at various sizes. But SmallCapsFeatures parsing produces a lot of junk repetitions, and these repetitions grow “exponentially” (and are definitely not intended).
Check/indicate
- [x] Relevant for XeTeX
- [ ] Relevant for LuaTeX (maybe?)
- [x] Issue tracker has been searched for similar issues?
- [ ] Links to <tex.stackexchange.com> discussion if appropriate
Minimal example demonstrating the issue
\documentclass{article}
\usepackage{fontspec}
\setmainfont{texgyretermes-regular.otf}[
UprightFeatures =
{
SizeFeatures =
{
{
Size = -8,
Font = texgyrepagella-regular.otf,
SmallCapsFeatures = {LetterSpace=8}
},
{
Size = 8-12,
SmallCapsFeatures = {LetterSpace=5}
},
{
Size = 12-15,
Font = texgyreadventor-regular.otf,
SmallCapsFeatures = {LetterSpace=3}
},
{
Size = 15-,
Font = texgyreadventor-regular.otf
% no letter spacing small caps for 15pt or larger
}
}
}
]
\begin{document}
hello
\end{document}
The relevant logs are alarming:
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) <-8>"[texgyrepagella-regular.otf]/OT:script=latn;languag
e=dflt;letterspace=8;+smcp;mapping=tex-text;"<8-12>"[texgyretermes-regular.otf]
/OT:script=latn;language=dflt;letterspace=8;letterspace=8;letterspace=5;+smcp;m
apping=tex-text;"<12-15>"[texgyreadventor-regular.otf]/OT:script=latn;language=
dflt;letterspace=8;letterspace=8;letterspace=5;letterspace=5;letterspace=3;+smc
p;mapping=tex-text;"<15->"[texgyreadventor-regular.otf]/OT:script=latn;language
=dflt;letterspace=8;letterspace=8;letterspace=5;letterspace=5;letterspace=3;let
terspace=3;+smcp;mapping=tex-text;"
- There are repetitions carried over from ALL previous size ranges.
- The
15-range is supposed to have no letter spacing small caps. But due to those repetitions we end up withletterspace=3.