Skip to content

Replace ttf-parser with skrifa - #4

Open
mkorje wants to merge 1 commit into
typst:mainfrom
mkorje:skrifa
Open

Replace ttf-parser with skrifa#4
mkorje wants to merge 1 commit into
typst:mainfrom
mkorje:skrifa

Conversation

@mkorje

@mkorje mkorje commented Apr 27, 2026

Copy link
Copy Markdown

See typst/typst#8172.

I think I've done this all right. Please double-check though.

One difference I noticed:
ttf-parser supports the tables gvar, glyf, CFF, CFF2 in that order.
skrifa priorities glyf, CFF2, CCF in that order.

Another thing:
The second commit might be worse performance wise, because we just end up doing the drawing twice. Here's the relevant skrifa code:
https://github.com/googlefonts/fontations/blob/fd0178ce4ea48301a7f06b35a6fce9879c102292/skrifa/src/metrics.rs#L348-L368
https://github.com/googlefonts/fontations/blob/fd0178ce4ea48301a7f06b35a6fce9879c102292/skrifa/src/metrics.rs#L384-L393
Here's the corresponding ttf-parser code:
https://github.com/harfbuzz/ttf-parser/blob/6e75b3c539ef6bfbacb020aaa3226414ddea7ce5/src/lib.rs#L2115-L2196

@laurmaedje laurmaedje left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to test this a bit more, but am leaving these comments already anyway.

Comment thread src/lib.rs Outdated
Comment thread src/lib.rs Outdated
@mkorje
mkorje force-pushed the skrifa branch 2 times, most recently from 6245d90 to 8bb3d77 Compare April 29, 2026 02:02
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