question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[varLib.featureVars] Buggy

See original GitHub issue

From Just:

from pprint import pprint
from fontTools.varLib.featureVars import overlayFeatureVariations

rules = [
    ([{'abcd': (4, 9)}], {0: 0}),
    ([{'abcd': (5, 10)}], {1: 1}),
    ([{'abcd': (0, 8)}], {2: 2}),
    ([{'abcd': (3, 7)}], {3: 3}),
]

pprint(overlayFeatureVariations(rules))

-->

[({'abcd': (5, 7)}, [{0: 0}, {1: 1}, {2: 2}, {3: 3}]),
 ({'abcd': (7, 8)}, [{0: 0}, {1: 1}, {2: 2}]),
 ({'abcd': (4, 5)}, [{0: 0}, {2: 2}, {3: 3}]),
 ({'abcd': (3, 7)}, [{2: 2}, {3: 3}]),
 ({'abcd': (8, 9)}, [{0: 0}, {1: 1}]),
 ({'abcd': (8, 10)}, [{1: 1}])]

There is no rule vor (0, 3) in the overlayed ruleset.

Here’s another one:

rules = [
    ([{'abcd': (1, 9)}], {0: 0}),
    ([{'abcd': (8, 10)}], {1: 1}),
    ([{'abcd': (3, 4)}], {2: 2}),
    ([{'abcd': (1, 10)}], {3: 3}),
]

pprint(overlayFeatureVariations(rules))

-->

[({'abcd': (3, 4)}, [{0: 0}, {2: 2}, {3: 3}]),
 ({'abcd': (8, 9)}, [{0: 0}, {1: 1}, {3: 3}]),
 ({'abcd': (8, 10)}, [{1: 1}, {3: 3}]),
 ({'abcd': (4, 8)}, [{0: 0}, {3: 3}]),
 ({'abcd': (1, 10)}, [{3: 3}])]

For an axis value of 2, both {0: 0} and {3: 3} should trigger, but only {3: 3} ends up in the overlayed list.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
behdadcommented, Dec 8, 2018

I see the difference. What you are doing is to create one lookup per changeset. Whereas in the code, Just originally decided, to generate one lookup per input changeset and reference multiple lookups from each region. This is typically beneficial by not duplicating the lookup content multiple times. But in your case, combining is more compact. Let me think, we can probably find out what the optimal combination is and produce that…

0reactions
behdadcommented, Dec 8, 2018

What I am doing is rather primitive. Instead of using lookups, I define the substitutions directly inside the feature variations.

I’m guessing that that just doesn’t do anything. Does it work?!

Read more comments on GitHub >

github_iconTop Results From Across the Web

addFeatureVariation doesn't work on a glyph that's also being ...
varLib.featureVars import addFeatureVariations inputTTF ... Any engine that only uses FeatureVariations with the rvrn feature is buggy.
Read more >
instancer — fontTools Documentation - Read the Docs
If the input location specifies all the axes, the resulting instance is no longer 'variable' (same as using fontools varLib.mutator):.
Read more >
NEWS.rst - platform/external/fonttools - Git at Google
[varLib] Improved error message when masters' glyph orders do not match (#1758,. #1759). - [featureVars] Allow to specify custom feature tag in ...
Read more >
fonttools [python-library] - Occam :: Details
[varLib.merger] Fixed bug where VarLibMergeError was raised with ... [featureVars] Raise better error message when a script is missing the required default ...
Read more >
python dataclass inheritance post init - elecbas.com
[featureVars] Added experimental module to build FeatureVariations #2734). ... [varLib.models] Fixed KeyError while sorting masters and there are no on-axis ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found