Repository navigation
Done
Labels
A-content/domInteracting with the DOM from web contentA-platform/fontsA-workersWorkers, SharedWorkers, and ServiceWorkers.B-feature-trackingThis issue tracks a particular high-level featureC-assignedThere is someone working on resolving the issue
Description
Part of #29376.
Known issues:
| [Exposed=(Window /*, Worker */), Pref="dom_fontface_enabled"] // TODO: Add support for FontFace in Workers. |
| let window = global.as_window(); // TODO: Support calling FontFace APIs from Worker |
servo/components/script/dom/css/fontface.rs
Lines 723 to 724 in 366d327
| // TODO: FontFaceSet is not supported on Workers yet. The `as_window` call below should be | |
| // replaced when we do support it. |
| [Exposed=(Window /*, Worker */)] |
| // FIXME: Figure out what to do for worker scopes. |
| // This will need adjustments once FontFaceSet is exposed to workers. |
Metadata
Metadata
Assignees
Labels
A-content/domInteracting with the DOM from web contentA-platform/fontsA-workersWorkers, SharedWorkers, and ServiceWorkers.B-feature-trackingThis issue tracks a particular high-level featureC-assignedThere is someone working on resolving the issue
Activity
jdm commentedon Nov 13, 2026
This makes tests like tests/wpt/tests/html/canvas/offscreen/manual/the-offscreen-canvas/offscreencanvas-worker-font-load-crash.html have errors/time out right now.
rogerkorantenng commentedon Nov 14, 2026
@jdm I tried this locally.
FontFaceandself.fontsdon't exist in workers yet. Separately, an OffscreenCanvas without a<canvas>element ignoresctx.font, which covers every OffscreenCanvas in a worker. The font just stays "10px sans-serif":I just saw that's already filed as #49890, which @mwja is working on. FontFace in workers can still be added without it, but a worker's canvas won't draw with a loaded font until #49890 is fixed.
One more thing: workers share the page's font storage right now (
worker.rspasses the page's font context), so fonts added in a worker would need to be kept separate from the page's.jdm commentedon Nov 14, 2026
Yeah, I linked the webidl snippets where the worker exposure is commented out. Good point about the shared storage!
servo-highfive commentedon Nov 14, 2026
Hey @rogerkoranteng-afrilotto! Thanks for your interest in working on this issue. It's now assigned to you!
servo-highfive commentedon Nov 14, 2026
It looks like this has already been assigned to someone. I'll leave the decision to a core contributor.
rogerkorantenng commentedon Nov 18, 2026
@jdm I split this into two PRs:
FontFace,FontFaceSetandself.fontsto workers. Workers use their own URL as the base, like Firefox. It doesn't store loaded fonts yet.The first one is mostly small changes from window-only code to code that works for any global, and it fixes
offscreencanvas-worker-font-load-crash.html. The second changes how workers are set up, so I kept it separate. The first doesn't store worker fonts, so nothing leaks into the page while only that one is merged.script: Expose FontFace and FontFaceSet to workers (servo#50046)
fonts: Give workers their own font context (servo#50049)
TimvdLippe commentedon Nov 25, 2026
Given the PRs have merged, I think we can close this as implemented?