-
Notifications
You must be signed in to change notification settings - Fork 764
add font.style_set_names attribute to Python API
#5354
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
add font.style_set_names attribute to Python API
#5354
Conversation
Also add test for language give as int, use FindFlagByName instead of loop, check if font is closed, improve error messages and fix small bug.
|
I tried to run your branch, but could see no data in Font Info -> StyleSet Names at all. Saved SFD font also has no entries for StyleSets. What is your system? EDIT: Sorry, missed something in your test script. It's ok now. |
|
The issue with "😀𝄞" is a bug in |
@iorsh Correct, but I'm not 100% sure if it's BTW I'm using Ubuntu 22.04.3 LTS with Python 3.10.12. |
I couldn't reproduce this. Could you please specify the exact course of action or script? |
@iorsh This works for me: import fontforge
style_set_names = (("English (British)", "ss20", "😀𝄞"),)
path = "/some/path/test.sfd" # change this
font = fontforge.font()
font.style_set_names = style_set_names
font.save(path)
font = fontforge.open(path)
assert font.style_set_names == style_set_namesThe sfd file includes the line The GUI shows |
|
Ah, you mean the assertion, which passes and indicates correctly loaded string. That's interesting, I'll take a look. |
|
If you add Overall, I think we are good to go with this PR. |
skef
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@iorsh do you have any further comment on the recent changes before I merge this? |
Looks good to me |
Closes #5263.
This PR adds the
style_set_namesattribute to thefonttype of the Python API to get and set the style set names (equivalent toElement->Font Info...->StyleSet Namesin the GUI), including input validation, a Python test and documentation.The last non-empty test case (name:
"😀𝄞") passes in the Python interface. But when generating an sfd and loading it with the GUI, the name shown in the GUI is different (턞). I am not sure if this is a bug in my PR or an issue withSFDDumpUTF7Str/SFDReadUTF7Stror the GUI.I would appreciate it if someone could double check this.
Type of change