Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmallCapsFeatures parsing grows exponentially when interacting with SizeFeatures and friends #454

Open
2 of 4 tasks
RuixiZhang42 opened this issue Dec 12, 2021 · 0 comments

Comments

@RuixiZhang42
Copy link

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

  • Relevant for XeTeX
  • Relevant for LuaTeX (maybe?)
  • 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;"
  1. There are repetitions carried over from ALL previous size ranges.
  2. The 15- range is supposed to have no letter spacing small caps. But due to those repetitions we end up with letterspace=3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant