Draft
Conversation
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.
Skrifa is a font parser that's part of fontations, a new Rust font handling stack being developed by Google. Its maintenance status is a lot clearer (ttf_parser is pretty dormant, whereas Skrifa is being used in Chrome), and it also supports hinting.
This is a proof-of-concept port that I did a while back and decided to submit as a PR in case others wanted to take a look at it. If nothing else, it serves as a good demonstration for integrating Skrifa into other projects.
Performance currently suffers. Commenting out all the drawing parts in the "layout & draw" benchmark, ttf_parser is around 55µs/iter, whereas Skrifa is at around 90µs/iter for CFF outlines (.otf) and 70µs/iter for TrueType outlines (.ttf). I've made some optimizations to Skrifa, and I think a lot more optimization work is being pursued as part of the HarfRust project. However, some of the performance difference may just be down to more thorough error checking or standards conformance (for example, the CFF charstring interpreter is supposed to store integers and fixed-point values separately, but ttf_parser converts them both to floats).
Some functionality is currently unimplemented: vertical metrics and variations. Vertical metrics are blocked on a Skrifa PR, and variations will require changing the API on the ab_glyph side, since Skrifa wants us to provide all variation coordinates at the same time whereas the current API has the user set them one-by-one.