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

Support full instancing of variable fonts #169

Merged
merged 3 commits into from
Apr 8, 2023
Merged

Conversation

papandreou
Copy link
Collaborator

Create full instances of variable fonts when every variation axis only has one value. Uses the hb_subset_input_pin_axis_location api that landed in Harfbuzz 6 (via papandreou/subset-font#21).

It's behind an experimental --instance flag for now, as it relies on us tracing font-variation-settings correctly and getting a bunch of stuff related to the standard variation axes right.

Makes for some nice extra savings:

$ subfont -o foo testdata/subsetFonts/variable-font-that-can-be-fully-instanced/index.html 
[...]
testdata/subsetFonts/variable-font-that-can-be-fully-instanced/index.html: 1 font (1 variant) in use, 1.65 MB total. Created subsets: 18.5 kB total
  RobotoVariable:
    normal : 10/827 codepoints used, 1.65 MB (ttf) => 18.5 kB (woff2)
$ subfont --instance -o foo testdata/subsetFonts/variable-font-that-can-be-fully-instanced/index.html 
[...]
testdata/subsetFonts/variable-font-that-can-be-fully-instanced/index.html: 1 font (1 variant) in use, 1.65 MB total. Created subsets: 1.24 kB total
  RobotoVariable:
    normal : 10/827 codepoints used, fully instanced, 1.65 MB (ttf) => 1.24 kB (woff2)

We can add support for partial instancing when the support lands in Harfbuzz.

@papandreou papandreou self-assigned this Apr 8, 2023
@papandreou papandreou force-pushed the tech/fullInstancing branch from 32198e0 to 510dde1 Compare April 8, 2023 08:23
@coveralls
Copy link

coveralls commented Apr 8, 2023

Pull Request Test Coverage Report for Build 4644256980

  • 38 of 41 (92.68%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 89.964%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/subfont.js 1 2 50.0%
lib/subsetFonts.js 37 39 94.87%
Totals Coverage Status
Change from base Build 4633529333: -0.1%
Covered Lines: 1145
Relevant Lines: 1213

💛 - Coveralls

@papandreou papandreou merged commit beac3ee into master Apr 8, 2023
@papandreou papandreou deleted the tech/fullInstancing branch April 8, 2023 08:40
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