Skip to content

Comments

[WIP] Port to Skrifa#122

Draft
valadaptive wants to merge 1 commit intoalexheretic:mainfrom
valadaptive:skrifa
Draft

[WIP] Port to Skrifa#122
valadaptive wants to merge 1 commit intoalexheretic:mainfrom
valadaptive:skrifa

Conversation

@valadaptive
Copy link

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.

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.

1 participant