Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hackathon: Browser integration of Fontations Rust font stack #46

Open
drott opened this issue Mar 19, 2025 · 5 comments
Open

Hackathon: Browser integration of Fontations Rust font stack #46

drott opened this issue Mar 19, 2025 · 5 comments

Comments

@drott
Copy link

drott commented Mar 19, 2025

Facilitator(s)

@drott

Summary

In Chrome we've started to ship the new open-source Rust font stack based on Fontations and Skia. I volunteer to host a hackathon to experiment with integration of Fontations into Servo and Firefox and consult with build system integration, foreign-function-interface design and API questions on Fontations.

Potential initial milestones:

  • Servo: Integrate Fontations to perform font metrics parsing, COLRv0/COLRv1 support? Other?
  • Firefox: Introduce Fontations dependency, metrics parsing COLRv0/COLRv1 support? Other?

@mrobinson and @jfkthame have expressed interest from the Servo and Mozilla side respectively.

Type

Onsite

Other comments

I suggest for the length of this breakout session to be a longer session and for it to extend over the time of the event - availability of the participants permitting.

@drott
Copy link
Author

drott commented Mar 19, 2025

CC @foolip

@drott
Copy link
Author

drott commented Mar 19, 2025

CC @delan

@nicoburns
Copy link

nicoburns commented Mar 21, 2025

A Fontations (Skrifa) backend for WebRender (specifically wr_glyph_rasterizer) would be cool (and could be used by both Servo and Firefox). There is a fork of WebRender (https://github.com/declantsien/webrender/tree/emacs) that implements a Swash backend (https://github.com/declantsien/webrender/blob/emacs/wr_glyph_rasterizer/src/backend/swash/font.rs) (Skrifa being originally derived from Swash) which could likely be adapted.

There is one significant difference between Swash and Skrifa which is that Swash includes a vector rasterizer (based on Zeno) whereas Skrifa does Scaling/Hinting but leaves the rasterizeration to the caller. So a Skrifa backend for WebRender would need to combine Skrifa with a general purpose vector renderer such as Skia or Tiny-Skia.

I think Firefox already bundles Skia? So Skia might make sense there.

Servo doesn't so something "smaller and lighter" like Tiny-Skia would probably make sense. Tiny-Skia supports most of the necessary graphics operations, but is missing support for "sweep gradients" (aka conic gradients) which are needed for COLRv1 (porting those from Skia would potentially be fun smallish project in and of itself)

@drott
Copy link
Author

drott commented Mar 21, 2025

@nicoburns I am not super familiar with the web render capabilities: Does webrender itself contain a bezier curve rasterizer? Is it capable of rendering most of SVG on its own? If it can render curves, could webrender itself be used to render glyphs from paths?

Skrifa does provide glyph contours in OutlineGlyph::draw which could then be connected.

@nicoburns
Copy link

@nicoburns I am not super familiar with the web render capabilities: Does webrender itself contain a bezier curve rasterizer? Is it capable of rendering most of SVG on its own? If it can render curves, could webrender itself be used to render glyphs from paths?

@drott My understanding is that WebRender does not do vector rendering at all. I believe Firefox uses Moz2D for this. Servo only really supports vector rendering for Canvas2D for which is currently uses raqote (but raqote is both slow and unmaintained, so it is not seen as long term solution and I suspect it would be better to bring in something else rather than use raqote).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants