Open twardoch opened 7 years ago
@twardoch thanks for the detailed bug report.
About the parser error issue with the custom userData, the issue should go away if you wrap the string value with quotes com.adobe.type.autohint = "<ICA8aGludFNldExp..>"
.
The glyphsLib parser accepts any character if it is between double quotes (the quote character iteself has to be escaped with backslash); whereas if it is outside of quotes, it only accepts characters [-_./$A-Za-z0-9]+
.
Here is the regex used:
https://github.com/googlei18n/glyphsLib/blob/700d96cd9c546c20208606123f34806bb6156a79/Lib/glyphsLib/parser.py#L29
I wonder how that piece of data was written into the glyphs source file? Did Glyphs write it there, or some external tool?
the last traceback, TypeError: int() argument must be a string or a number, not 'list'
, has to do with the fact that your glyphs file contains color
definitions such as:
color = (255,153,153,1);
But glyphsLib is expecting color definitions to be integers:
The inline comment says that this attribute is undocumented, and indeed I couldn't find any references to it in https://github.com/schriftgestalt/GlyphsSDK/blob/master/GlyphsFileFormat.md
maybe @schriftgestalt could tell us how glyphs' colors should be encoded in the source file?
I just tried to set the color of a glyph, saved the file and opened it up in a text editor, and the color is encoded as a decimal integer.
Could it be that the tuple variant was produced by earlier versions of Glyphs?
@twardoch can you tell us how that unquoted string com.adobe.type.autohint = <ICA8aGludFNldExp..>
was written in the glyphs source file? If it was written by Glyphs.app itself, then we will need to adapt the glyphsLib parser to somehow accept such notation.
@schriftgestalt may I ask again how should glyph colors be encoded? As integers (like glyphsLib expects) or as (RGBA?) tuples like in Adam's .glyphs file?
Was this glyphs file generated with fl6? 😂
On Feb 11, 2017 1:14 PM, "Cosimo Lupo" notifications@github.com wrote:
@twardoch https://github.com/twardoch can you tell us how that unquoted string com.adobe.type.autohint =
was written in the glyphs source file? If it was written by Glyphs.app itself, then we will need to adapt the glyphsLib parser to somehow accept such notation. @schriftgestalt https://github.com/schriftgestalt may I ask again how should glyph colors be encoded? As integers (like glyphsLib expects) or as (RGBA?) tuples like in Adam's .glyphs file?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/googlei18n/fontmake/issues/247#issuecomment-279164802, or mute the thread https://github.com/notifications/unsubscribe-auth/AAP9y0m-wq2MdrHtwj0EwhHyI-UH7_MUks5rbfp4gaJpZM4L3cMy .
Color can be encoded as integer or as RGBA tupel.
The color and autohint info most likely comes from a .ufo file that was opened in Glyphs. The RGBA storage is mostly to be able to round trip .ufo.
I see, thanks Georg.
But shouldn't Glyphs.app wrap those userData strings with quotes "
?
glyphsLib parser is choking because it only recognizes as a valid "value" token a string comprised of one or more [-_./$A-Za-z0-9]
characters, unless that string is included in quotes, in which case .*
anything matches.
value_re = r'(".*?(?<!\\)"|[-_./$A-Za-z0-9]+)'
If this is not correct, then we should modify the parser.
the value in com.adobe.type.autohint
is stored as data and that is enclosed in <>
. So it is not a string that needs to be enclosed in quotes.
Ok thanks. So it looks like the glyphsLib parser does not properly support binary data values in ASCII plist:
NSData Binary data is enclosed in angle brackets and encoded in hexadecimal ASCII. Spaces are ignored. > For example:
<0fbd777 1c2735ae>
I'll file a separate issue over there.
@davelab6 asked:
Was this glyphs file generated with fl6? 😂
I wrote in my report:
Configuration:
- Mac OS X 10.12.3
- Glyphs 2.4.1 (965)
- Homebrew-installed Python 2.7.13
Ps. I shall add that the .glyphs
file did indeed originate from opening UFO files which were generated with vfb2ufo
from a VFB saved in FontLab Studio 5. I used FontLab VI at an earlier stage. The folder list should give you an idea about the sequence of steps involved.
I’ve run into a number of problems with
glyphsLib
andfontmake
when trying to build Schticks Text, a 2-axis variable font based on the STIX Two Text fonts (OFL). The fonts I’m talking about are in the https://github.com/twardoch/schticks-fonts-ofl,Schticks/Sources/25-gly-mm-width1
subfolder.Configuration
I've just installed the devel
fontmake
by running in the repo:so I had:
I also did it via:
So I had:
In both configurations, when running fontmake like this:
on the SchticksText-MM.glyphs font in 25-gly-mm-width1/bak font from my https://github.com/twardoch/schticks-fonts-ofl repo, I get a number of problems.
Spurious illegal names
fontmake
reports one illegal glyph name but such a glyph name is not in the font.com.adobe.type.autohint data
The glyphs contain a custom
com.adobe.type.autohint
entry which makesglyphsLib
fail. Stuff inuserData
that cannot be parsed should be ignored.Traceback
Non-integer underline position
The font contains a weird entry:
which makes
glyphsLib
fail. I don't know why this entry is there but glyphsLib should round, not fail.Traceback
TypeError: int() argument must be a string or a number, not 'list'
After I manually cleaned the offending portions in the
.glyphs
files using a text editor, and stored the font in 25-gly-mm-width1, then runfontmake
on it, I get:I have no idea what to do with this, so I cannot proceed any further.
Traceback