mekkablue / Glyphs-Scripts

Python scripts for the Glyphs font editor
http://glyphsapp.com/
Apache License 2.0
387 stars 103 forks source link

Instance Cooker will not accept non-integer values #288

Closed clauseggers closed 1 year ago

clauseggers commented 1 year ago

When specifying a value as eg. 87.5 for a semi-condensed width, the script will output:

Instance Cooker Report for Playfair
/Users/claus/Git/clauseggers/Playfair/sources/Playfair-2_1-Roman.glyphs

Instance Cooker Error: invalid literal for int() with base 10: '87.5'
Traceback (most recent call last):
  File "Instance Cooker.py", line 391, in InstanceCookerMain
    recipeDict = parseAxes(recipe)
  File "Instance Cooker.py", line 111, in parseAxes
    positions = tuple([int(x.strip()) for x in axisPosition.split(">")][:2])
  File "Instance Cooker.py", line 111, in <listcomp>
    positions = tuple([int(x.strip()) for x in axisPosition.split(">")][:2])
ValueError: invalid literal for int() with base 10: '87.5'

The 87.5 and 112.5 values are from the CSS specification. Should you change the script, or do I bump the values to nearest integer?

clauseggers commented 1 year ago

I also see that running the Instance Cooker does in fact not delete the existing Variable Fonts in Exports.

mekkablue commented 1 year ago

Thanks for your patience, I’ll have a look at the decimals.

I also see that running the Instance Cooker does in fact not delete the existing Variable Fonts in Exports.

It shouldn’t. It is just about the instances.

clauseggers commented 1 year ago

Perhaps this is an old snippet that I have in my files?: Executing this script will delete all existing instances (save for the VF instances). is what I have in my recipe.

Anyhoot, sorry about the decimal thing, but that is the CSS spec. I have just rounded to nearest integer.

clauseggers commented 1 year ago

Doesn’t work. I used the values '87.5' and '112.5' as you can see, but it looks like part of your script still expects integers?

Instance Cooker Report for Playfair
/Users/claus/Git/clauseggers/Playfair/sources/Playfair-2_1-Roman.glyphs

Instance Cooker Error: invalid literal for int() with base 10: '87.5'
Traceback (most recent call last):
  File "Instance Cooker.py", line 391, in InstanceCookerMain
    recipeDict = parseAxes(recipe)
  File "Instance Cooker.py", line 111, in parseAxes
    positions = tuple([int(x.strip()) for x in axisPosition.split(">")][:2])
  File "Instance Cooker.py", line 111, in <listcomp>
    positions = tuple([int(x.strip()) for x in axisPosition.split(">")][:2])
ValueError: invalid literal for int() with base 10: '87.5'