Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Filter parsing #366

Open
moyogo opened this issue May 24, 2018 · 4 comments
Open

Fix Filter parsing #366

moyogo opened this issue May 24, 2018 · 4 comments

Comments

@moyogo
Copy link
Collaborator

moyogo commented May 24, 2018

As mentioned in googlefonts/ufo2ft#238:
We need to change the way filter strings are parsed in glyphLib. Width:+30, which should add 30 to the width, doesn’t mean the same asWidth:30 or Width:=30 or Width:=+30, which should set the width to 30.

Width:-30 should substract 30 from the width, while Width:=-30 should set to the width to 0 since width cannot be negative (RSB:=-30 and LSB:=-30 do set RSB and LSB to -30).

@moyogo moyogo changed the title Fix Filters Fix Filter parsing May 24, 2018
@anthrotype
Copy link
Member

the function glyphsLib.builder.filters.parse_glyphs_filter doesn't know how to deal with the equal sign.
Currently when it sees a string that looks like a number, it casts it to one, using this other function cast_to_number_or_bool.
In the case of a value that is prefixed with the equal sign, it keeps the value as a string.
Maybe that's ok. The ufo2ft Transformations filter can check if the value is a string and starts with an equal sign, then treat it accordingly.
WDYT?

@belluzj
Copy link
Collaborator

belluzj commented May 24, 2018

(not an answer to your question, sorry! In cast_to_number_or_bool:
https://github.com/googlei18n/glyphsLib/blob/60026c83af4d02b23470d770a66868092d97c1f3/Lib/glyphsLib/util.py#L66
This is another place where the glyph name "infinity" might become the float +Infinity)

@anthrotype
Copy link
Member

good catch

@davelab6
Copy link
Member

This is needed by Google Fonts for being able to generate "sibling families" using fontmake (described in #355 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants