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

Add font.compact() to Python API #4441

Merged
merged 1 commit into from
Sep 9, 2020

Conversation

ctrlcctrlv
Copy link
Member

Adds a function to the Python API that has the identical effect as «Encoding→Compact».

Type of change

  • Small new feature

@skef
Copy link
Contributor

skef commented Sep 8, 2020

A little bird pointed us to the existing SFReencode interface for this, which is to assign the string "compacted" to the encoding.

I don't have any strong opinions about whether to add this interface. (I do wish the python API wasn't so fixated on properties and assignments but it doesn't seem detrimental in this case.)

@ctrlcctrlv
Copy link
Member Author

Yeah the reason I'm adding this is because I made an icon font recently as mentioned at #4378 (comment) ... due to how most icon fonts are expected to work, the icons are always going to be way off screen when opening SFD. I suppose a Custom encoding is usable, but trying to set font.encoding = Custom didn't go so well without a way to compact out the empty blocks, I just got the flood of red question marks.

I'll take a look at SFReencode when I get a chance if you think it's better for adding this function. :-)

@ctrlcctrlv
Copy link
Member Author

@skef
Copy link
Contributor

skef commented Sep 8, 2020

@ctrlcctrlv I think the suggestion is to try (with the existing code) a) opening the font in python, b) do fnt.encoding = 'UnicodeFull', and then c) do fnt.encoding = 'compacted' .

I just tried it and it seems to work.

@ctrlcctrlv
Copy link
Member Author

@skef Force pushed, this is now a documentation-only change. Thanks.

Copy link
Contributor

@skef skef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

ctrlcctrlv added a commit to MFEK/glif that referenced this pull request Sep 9, 2020
@ctrlcctrlv ctrlcctrlv merged commit c3468cb into fontforge:master Sep 9, 2020
ctrlcctrlv added a commit to MFEK/glif that referenced this pull request Sep 12, 2020
Omnikron13 pushed a commit to Omnikron13/fontforge that referenced this pull request May 31, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants