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

Assign alternate unicode values for duplicate glyphs #9

Open
kanou-h opened this issue Feb 12, 2020 · 1 comment
Open

Assign alternate unicode values for duplicate glyphs #9

kanou-h opened this issue Feb 12, 2020 · 1 comment

Comments

@kanou-h
Copy link

kanou-h commented Feb 12, 2020

Assigning multiple Unicode values to each unique glyph image will decrease the size of the font file.

Possibly lines 62-71 of forge_font.py can be rewritten as:

other = other - set(care.values())
if len(other) > 0:
glyph.altuni = [ ord(o) for o in other ]

And I suggest the use of glyph.simplify() to remove redundant points
from each glyph.

@LingDong-
Copy link
Owner

Thanks so much for the suggestion!
I managed to reduce the size of qiji.ttf by 20% by assigning multiple unicode values to glyphs!

There is a 5% further improvement by using glyph.simplify(), but since it's hard to evaluate how much it modifies the shape I didn't want to risk it. I did add both optimizations to qiji-fallback.ttf, since they're randomly generated anyways.

The woff2 files didn't see much of a reduction though (5.2MB -> 5.1MB)

But still, pretty neat! Thanks for bringing this up. I've updated the releases, and committed 055a5dc

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

2 participants