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

Faster name visitor subset #3217

Merged
merged 2 commits into from
Jul 20, 2023
Merged

Faster name visitor subset #3217

merged 2 commits into from
Jul 20, 2023

Conversation

behdad
Copy link
Member

@behdad behdad commented Jul 20, 2023

@behdad behdad requested review from anthrotype and m4rc1e July 20, 2023 15:49
@behdad behdad force-pushed the faster-name-visitor-subset branch from 755818b to 321e608 Compare July 20, 2023 15:58
Don't visit large tables without any name records.
@behdad behdad force-pushed the faster-name-visitor-subset branch from 321e608 to e8105d2 Compare July 20, 2023 16:07
@anthrotype
Copy link
Member

it would be nice if @imran-iq could give this PR branch a try with their go-noto font build to confirm it is fast enough?

@behdad
Copy link
Member Author

behdad commented Jul 20, 2023

Here's a timing I observed:

$ time ./fonttools subset --gids=0-10000 --font-number=0 SourceHanNotoCJK.ttc --timing
Took 0.000s to load font
Took 0.000s to compile glyph list
Took 0.000s to load 'maxp'
Took 0.000s to prune 'maxp'
Took 0.041s to load 'cmap'
Took 0.000s to prune 'cmap'
Took 0.000s to load 'post'
Took 0.000s to prune 'post'
Took 0.000s to load 'CFF '
Took 0.017s to prune 'CFF '
Took 0.000s to load 'GPOS'
Took 0.009s to prune 'GPOS'
Took 0.000s to load 'GSUB'
Took 0.015s to prune 'GSUB'
Took 0.012s to close glyph list over 'cmap'
Took 0.068s to close glyph list over 'GSUB'
Took 1.175s to close glyph list over 'CFF '
Took 0.011s to subset 'cmap'
Took 0.000s to subset 'post'
Took 0.013s to subset 'CFF '
Took 0.000s to subset 'VORG'
Took 0.056s to subset 'hmtx'
Took 0.016s to subset 'vmtx'
Took 0.000s to subset 'GDEF'
Took 0.090s to subset 'GPOS'
Took 0.010s to subset 'GSUB'
Took 0.000s to subset GlyphOrder
Took 0.000s to prune 'head'
Took 2.202s to prune 'CFF '
Took 0.000s to prune 'GDEF'
Took 0.002s to prune 'GPOS'
Took 0.005s to prune 'GSUB'
Took 0.186s to prune 'name'
Took 1.160s to compile and save font
Took 5.102s to make one with everything (TOTAL TIME)

real	0m5.222s
user	0m5.147s
sys	0m0.059s

Without name closure it takes 4.925 (as in without this PR). The name pruning took 0.186s, which I think is acceptable.

With the previous approach this was taking minutes before I interrupted it...

@behdad behdad merged commit 530e409 into main Jul 20, 2023
10 checks passed
@behdad behdad deleted the faster-name-visitor-subset branch July 20, 2023 16:16
@imran-iq
Copy link

it would be nice if @imran-iq could give this PR branch a try with their go-noto font build to confirm it is fast enough?

Little late to the party, but running locally with these changes (just used main) it does not get stuck at the pyftsubset step like in #3213

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

3 participants