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

[makeinstancesufo] wrong camelCasing in designspace attribute #1211

Closed
frankrolf opened this issue Aug 19, 2020 · 4 comments · Fixed by #1212 or #1228
Closed

[makeinstancesufo] wrong camelCasing in designspace attribute #1211

frankrolf opened this issue Aug 19, 2020 · 4 comments · Fixed by #1212 or #1228

Comments

@frankrolf
Copy link
Member

If an instance entry in a designspace file does not contain a PostScript font name attribute, makeinstancesufo complains in the following way:

WARNING:afdko.makeinstancesufo:Instance at index 0 has no 'postScriptFontName' attribute.

However, the ps font name needs to be indicated like this:

postscriptfontname="BlahBlah-Blah"

Note the casing being different in warning vs required.

@frankrolf
Copy link
Member Author

This change seems to have fallen on our feet (not sure how):
Generating from a normal .designspace, I get this output:

WARNING:afdko.makeinstancesufo:Instance at index 0 has no 'familyname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 0 has no 'postscriptfontname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 0 has no 'stylename' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 1 has no 'familyname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 1 has no 'postscriptfontname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 1 has no 'stylename' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 2 has no 'familyname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 2 has no 'postscriptfontname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 2 has no 'stylename' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 3 has no 'familyname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 3 has no 'postscriptfontname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 3 has no 'stylename' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 4 has no 'familyname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 4 has no 'postscriptfontname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 4 has no 'stylename' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 5 has no 'familyname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 5 has no 'postscriptfontname' attribute.
WARNING:afdko.makeinstancesufo:Instance at index 5 has no 'stylename' attribute.

All of those attributes exist.
Will investigate.

@frankrolf frankrolf reopened this Sep 16, 2020
@josh-hadley
Copy link
Collaborator

josh-hadley commented Sep 17, 2020

I had a look at this and it looks like the designspaceLib code reads the XML attribute as all lowercase (e.g. postscriptfontname), but uses camel-cased for the Python attribute (postScriptFontName), which is a bit confusing.

The fix here is to revert the checks in makeinstancesufo back to camel-cased (which is testing the Python attribute names, not XML), but keep the all-lowercase attribute names in the .designspace files.

@frankrolf
Copy link
Member Author

frankrolf commented Sep 17, 2020

Alright, thank you Josh! Perhaps the real solution to the problem I pointed out should be in this line:

from

                    f"Instance at index {i} has no '{attr_name}' attribute.")

to

                    f"Instance at index {i} has no '{attr_name.lower()}' attribute.")

Then there would not be any messing with the attribute names, and the indication would correspond to the attribute flags as required in the .designspace file.

@josh-hadley
Copy link
Collaborator

Having the error message use the XML (all-lowercase) attribute name seems sensible for communicating the problem to the user (in addition to reverting the actual check to use the Python/camel-cased names).

frankrolf added a commit that referenced this issue Sep 24, 2020
josh-hadley pushed a commit that referenced this issue Sep 24, 2020
1div0 pushed a commit to 1div0/afdko that referenced this issue Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants