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.

ERROR Failed with KeyError: 'slnt'

See original GitHub issue

Observed Behavior

After making jost[slnt,wght].ttf in with fontmake as below

fontmake -g source/jost.glyphs -o variable --round-instances -a --output-path source/vf/jost[slnt,wght].ttf

When I put output jost[slnt,wght].ttf through fontbakery I get the following error

💔 ERROR: Check variable font instances have correct coordinate values
com.google.fonts/check/varfontinstancecoordinates

💔 ERROR Failed with KeyError: 'slnt'

Expected Behavior

Should not have an issue with 'slnt"

Others have experienced this as well

@thundernixon had a similar error with his ‘mono’ axis

 >> com.google.fonts/check/varfont_instance_coordinates
   Check variable font instances have correct coordinate values
   with font_betas/recursive-MONO_CASL_wght_slnt_ital--full_gsub--2019_11_19-19_44.ttf

   * ERROR: Failed with KeyError: 'MONO'
          File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontbakery/checkrunner.py", line 344, in
_exec_check
            for sub_result in result:  # Might raise.
          File "/Users/stephennixon/type-repos/recursive/venv/lib/python3.7/site-packages/fontbakery/profiles/googlefonts.py", lin
e 3974, in com_google_fonts_check_varfont_instance_coordinates
            if instance.coordinates[axis] != expected_instance.coordinates[axis]:

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
m4rc1ecommented, Feb 13, 2020

I’m partway through refactoring these checks. I’ve used @arialcrime’s family as a reference.

The updated VF instance checks will do the following:

  • Submit a warn if instance names are not fully parsable. It will also output the unparsable tokens.
  • Submit a fail if instance coordinates are incorrect for known axes
  • Submit a fail if the fvar contains known axes and they’re not mentioned in instance names.
  • Submit a fail if instance names is incorrectly ordered
  • If any fail or warn occurs, output a hint to study the GF spec (wip)
    * WARN: Instance "144 G100 Thin": contains the following unparsable tokens "['144', 'G100']"
    * FAIL: Instance "144 G100 Thin": does not contain "opsz" token.
    * WARN: Instance "144 G100 Light": contains the following unparsable tokens "['144', 'G100']"
    * FAIL: Instance "144 G100 Light": does not contain "opsz" token.
    * WARN: Instance "144 G100 Regular": contains the following unparsable tokens "['144', 'G100']"
    * FAIL: Instance "144 G100 Regular": does not contain "opsz" token.
    ...
    * WARN: Instances may be incorrect. See our spec for further info ...
4reactions
thundernixoncommented, Nov 22, 2019

As far as I can tell, it seems that the problem is with fontbakery’s instance_parse() function, which appears to set up expected instance axis values based on the instance name … BUT only includes values for opsz, wght, and wdth.

https://github.com/googlefonts/fontbakery/blob/d78810411152f449b1d302f7401d4e3e2c2bd775/Lib/fontbakery/parse.py#L183-L194

We (probably) can’t really predict the values of other axes, like slnt or MONO. So basically, I think we just need something that only checks the name based on the axes that are in the instance parse, but doesn’t try to check for axes that aren’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix KeyError Exceptions in Python - Rollbar
The Python KeyError is an exception that occurs when an attempt is made to access an item in a dictionary that does not...
Read more >
Python KeyError Exceptions and How to Handle Them
In this tutorial, you'll learn how to handle Python KeyError exceptions. They are often caused by a bad key lookup in a dictionary,...
Read more >
python - AWS sagemaker training data returns ...
I am trying to learn AWS by following tutorial on AWS website. I followed each step but step 4c where I train model...
Read more >
How to fix Python KeyError Exceptions in simple steps?
Know about Python KeyError Exception. And learn how to handle exceptions in Python. A detailed guide to Errors and Exceptions in Python.
Read more >
What is KeyError in Python? Dictionary and Handling Them
Here I am trying to access a key called “D” which is not present in the dictionary. Hence, the error is thrown as...
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