Skip to content

Conversation

@taj-p
Copy link
Collaborator

@taj-p taj-p commented Feb 7, 2026

  • TTC files are extracted to standalone fonts for each face used
  • Fonts are subsetted to include only the glyphs referenced in the scene (using [klippa]`)
  • Original glyph IDs are preserved (RETAIN_GIDS) - unused slots become empty
  • Fonts are stored as WOFF2

@taj-p taj-p requested a review from nicoburns February 7, 2026 20:03
Copy link
Contributor

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally excellent. I'm a little concerned that we're introducing the subsetting transformation using a fairly early-stage crate without much ability to test for regressions (we don't yet have a way to record complex scenes (e.g. webpages using Blitz).

My suggestion would be to mititgate the risk by making the subsetting transformation optional. This could be a write-only optionality (on the read side we just deal with whatever we're given). That way if we run into issues we can easily run it without the option enabled while we figure things out.

While we're at it, perhaps we could also make the woff compression optional? (although this seems less important). Again, I suggest an option on the writing side of things, and reading would just detect whether it's a woff or not, and decompress if it is.

})?;
Ok(FontData::new(
Blob::from(ttf),
// Since we've extracted all faces into standalone fonts, the index is always 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: could we move this comment to just above the Ok(.... Then 4 lines can become 1.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is now overcome by the refactor to use FontWriter with subsetting and woff2 features

serde_json = "1.0"
zip = { version = "2.1", default-features = false, features = ["deflate"] }
sha2 = "0.10"
klippa = { git = "https://github.com/googlefonts/fontations", rev = "41ec2bdd6dd8589b65eaaaf182b0a2e701d0d826" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klippa not being published is a bit of a problem. That will also prevent publishing of anyrender_serialize. We could ask fontations people to publish. But perhaps we'd be better off publishing our own fork? As I'm anticipating it being difficult to get fontations to publish klippa in lock-step with read-fonts, skrifa, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to publish a klippa fork? Is that the general workaround for things like this?

Comment on lines 451 to 455
&IntSet::empty(),
&IntSet::empty(),
&IntSet::empty(),
&IntSet::empty(),
&IntSet::empty(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How confident are you these IntSet::empty() parameters are correct? Looks like that will remove all of these items in the font. (I'm not whether we need them, but I'm not confident that we don't).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need them, but let me double check and get back to you

@taj-p
Copy link
Collaborator Author

taj-p commented Feb 8, 2026

This is generally excellent. I'm a little concerned that we're introducing the subsetting transformation using a fairly early-stage crate without much ability to test for regressions (we don't yet have a way to record complex scenes (e.g. webpages using Blitz).

My suggestion would be to mititgate the risk by making the subsetting transformation optional. This could be a write-only optionality (on the read side we just deal with whatever we're given). That way if we run into issues we can easily run it without the option enabled while we figure things out.

While we're at it, perhaps we could also make the woff compression optional? (although this seems less important). Again, I suggest an option on the writing side of things, and reading would just detect whether it's a woff or not, and decompress if it is.

Brilliant comment @nicoburns !!! Thank you! I've feature flagged subsetting and woff2 decompression. My feel is, as you suggest, we start off generating scenes without them and then regression test with them enabled. I'm happy to look into this over the coming week.

Copy link
Contributor

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had in mind runtime feature flags, but this'll do. Approved subject to CI passing.

@taj-p taj-p merged commit b672d74 into DioxusLabs:main Feb 8, 2026
9 checks passed
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