+
Skip to content

[config] Add OPTIMIZE_FONT_SPEED #3784

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

Merged
merged 5 commits into from
Feb 27, 2025
Merged

[config] Add OPTIMIZE_FONT_SPEED #3784

merged 5 commits into from
Feb 27, 2025

Conversation

behdad
Copy link
Member

@behdad behdad commented Feb 27, 2025

Use it for compiling faster-to-load glyf/gvar/VARC.

Use it for compiling faster-to-load glyf/gvar/VARC.
@behdad behdad requested a review from anthrotype February 27, 2025 06:55
@anthrotype
Copy link
Member

out of curiosity, I tried to compile a glyf+gvar heavy font like Google Sans Flex with OPTIMIZE_FONT_SPEED=True, and the resulting ttf is 1,065,644 bytes bigger (4,823,984 vs 3,758,340) as expected, but interestingly when compressing both fonts with WOFF2, the speed-optimized font is actually 41,932 bytes smaller than the normal font which is supposed to be the size-optimized one.

@anthrotype
Copy link
Member

how is VARC compilation specifically affected by this?

I see VarComponent.compile calls TupleVariation.compileDeltaValues_ but I don't see the new flag being used in there:
https://github.com/fonttools/fonttools/blob/c93b45bc3a4fb6d61a45976fee8f692457619e0a/Lib/fontTools/ttLib/tables/otTables.py#L261C32-L261C51

instead of using a string. DRY and prevents typos. Also has side-effect of importing fontTools.config module where options get registered globally directly from fontTools.ttLib so it is available throughout the package
@behdad
Copy link
Member Author

behdad commented Feb 27, 2025

how is VARC compilation specifically affected by this?

I see VarComponent.compile calls TupleVariation.compileDeltaValues_ but I don't see the new flag being used in there: https://github.com/fonttools/fonttools/blob/c93b45bc3a4fb6d61a45976fee8f692457619e0a/Lib/fontTools/ttLib/tables/otTables.py#L261C32-L261C51

Good catch.

@behdad
Copy link
Member Author

behdad commented Feb 27, 2025

how is VARC compilation specifically affected by this?

Mostly by change in TupleValues compilation. But I fixed the one you pointed out either.

@behdad behdad merged commit 3f77988 into main Feb 27, 2025
11 checks passed
@behdad behdad deleted the OPTIMIZE_FONT_SPEED branch February 27, 2025 17:01
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.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载