Merged
Conversation
This reverts commit f1f4691.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR greatly improves the subsetting of Typst. This should lead to decreased PDF files in nearly all cases, even more so when a Typst document contains many fonts. For many big CFF fonts, the file sizes will even be reduced from 1MB+ to just a few KBs.
See the READMEs in typst/subsetter#1 for how we are currently testing the subsetter to ensure that it is correct. Apart from the tests there, I also created a PDF document using typst containing many different fonts and a subset of glyphs. You can find it here:
typst.pdf
I tested it with all major PDF viewers and they all seem to display it fine.
Given this test file and also the tests in subsetter (as well as fuzzing), I do feel pretty confident about the correctness of the subsetter and hopefully there shouldn't be any major issues, but in the end we will only find out by actually trying it and maybe encourage people to especially check their PDF output when releasing the first release candidate. Some manual testing beforehand by volunteers would also be highly appreciated.
Fixes #895.
Merging is blocked by typst/subsetter#1 and typst/svg2pdf#76.
P.S.: The reason I had to split glyph sets and color glyph sets is that it is possible that for a color font, we use both, some glyphs for color fonts and some for normal text (I encountered this issue when fixing a test case with emojis and NZW). However, when subsetting we don't want to subset the glyphs that are only used as part of color fonts (since they will already be written as a type 3 font), and we also can't share the CMAP between the two fonts. This is why they had to be separated.