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

[idea] hashing for data comparison #261

Open
typoman opened this issue Oct 12, 2019 · 4 comments
Open

[idea] hashing for data comparison #261

typoman opened this issue Oct 12, 2019 · 4 comments

Comments

@typoman
Copy link

typoman commented Oct 12, 2019

I understand that since glyphs and data inside a ufo are mutable, the idea of hashing is counter-intuitive. But I was wondering if there was a way to make a hash of a glyph to compare if it has changed, then it's possible to reduce the compile time in ufo2ft by not compiling all the glyphs or even not all the binary tables. When a hash method is called, the glyph data is converted into tuples and then its hash is returned. This could also be used in more places to make sure if a part of the font has been changed on disk.

I've been doing a similar thing to create a JIT compiler but it does not use hashes. instead, I use the notifications to make changes to the binary. Do you think if I start something like this, is any PR acceptable or the idea is not sensible?

@adrientetar
Copy link
Contributor

FYI Adobe ufoTools uses the HashPointPen to store a hash and not rehint an outline that hasn't changed.

@typoman
Copy link
Author

typoman commented Oct 30, 2019

Thank you, my idea is actually based on that pen. I'm still not sure here was the right place to bring it up or I should take it to fontpens or ufo2ft. The only reason to talk about it here is to come up with a more universal solution than tool-based solutions. @LettError already gave me an idea that I built something upon it and it's by creating a md5 hash from digestPointPen data in fontpens package.

@typesupply
Copy link
Member

I recommend using a representation factory for this. The representation system will handle creation of the hash when called, store it internally for speed and destroy it when the glyph changes. Documentation on this is here.

@typoman
Copy link
Author

typoman commented Nov 14, 2019

Thank you Tal, seems super interesting! I will try to see how can I use that.

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

3 participants