googlefonts / glyphsLib

A bridge from Glyphs source files (.glyphs) to UFOs
Apache License 2.0
178 stars 51 forks source link

usCodePageRange Macintosh Character Set (US Roman) (bit 29) is not saved as an integer in the Glyphs source and causes an error #941

Closed kalapi closed 10 months ago

kalapi commented 10 months ago

I'm getting the following error when I try to run fontmake 3.7.1 on a Glyphs 3.1.2 (3151) source:

fontmake: Error: In '~/Meursault.glyphs': Loading Glyphs file failed: invalid literal for int() with base 10: 'bit 29'

A bit of a background

The codePageRanges custom parameter in Glyphs 2 did not include support for bit 29: Macintosh Character Set (US Roman). As a result, a trick to enable it was to open the source file in a text editor and add "bit 29" manually as a value in the codePageRanges key in the XML like so:

{
name = codePageRanges;
value = (
"1252",
"1250",
"1254",
"1257",
"1258",
"bit 29"
);
}

In Glyphs 3, support for the missing codepage has been added and it seems that for backward compatibility purposes instead of using an integer value, the value remains a string which raises:

File "~/testing_environments/FMake37/lib/python3.8/site-packages/glyphsLib/types.py", line 356, in _mutate_list
    l[i] = fn(l[i])
ValueError: invalid literal for int() with base 10: 'bit 29'

What would be the best way to handle this?

anthrotype commented 10 months ago

ugh... hi kalapi! thanks for the report. I think glyphsLib should take care of this for fontmake. I'll see if I can transfer the issue.

anthrotype commented 10 months ago

looks like this is a duplicate of https://github.com/googlefonts/glyphsLib/issues/530 and https://github.com/googlefonts/glyphsLib/issues/807