-
Notifications
You must be signed in to change notification settings - Fork 51
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
Support new codepage ranges syntax #530 #1061
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
thanks. Though I don't think the parser should import glyphsLib.builder or special-case those custom parameters every time it's parsing any object from a dict. I think what I wrote here still stands:
We could probably just remove glyphsLib/Lib/glyphsLib/classes.py Line 1367 in b0fc3bc
and then the parser will not attempt to force all elements into integers. When when the builder is converting to the equivalent UFO fontinfo property, the string values starting with "bit " prefix could be handlded specially. |
Thanks for quick replay. As I tested, if I simply passed the value, a problem occurred in next: # glyphsLib/Lib/glyphsLib/builder/custom_params.py
ufo.set_info_value("openTypeOS2CodePageRanges", sorted(ufo_codepage_bits)) Here, the codepage should be converted to a bit number list. |
Indeed, glyphsLib/builder/custom_params.py is a good place where that conversion can take place. The parser itself can simply parse the raw list as it is, with some integers and some strings. Does that make sense? |
Thank you |
8d565c2
to
8294347
Compare
I fixed it and it's definitely better. 👍 |
GSCustomParameter._CUSTOM_INTLIST_PARAMS also contains a "openTypeOS2CodePageRanges", I think it's a synonym of "codePageRanges" custom parameter so should be treated the same, i.e. remove it from that list so it doesn't get forced into a list of ints |
8294347
to
b3b9a2f
Compare
9ecec3a
to
1e16762
Compare
maybe don't make other unrelated changes within the same PR. You can do a follow up for those if you like. Do you mind also adding a test? Thanks |
When I run
Ok, I'll add the test to |
as long as the CI "lint" job passes, I don't really care. You can send a follow up PR to fix those if you like
thank you |
1e16762
to
740bff0
Compare
Currently the problem is occurring in the parser. #807
Therefore, pre-classify into
codePageRanges
andcodePageRangesUnsupportedBits
,glyphsLib/Lib/glyphsLib/builder/custom_params.py
Lines 467 to 502 in b0fc3bc
For
codePageRangesUnsupportedBits
, just use the number with thebit
prefix removed.glyphsLib/Lib/glyphsLib/builder/constants.py
Lines 157 to 196 in b0fc3bc
Note: The error occurs before handling
custom_params
, so it should be fixed in the parser.