Skip to content

@remotion/web-renderer: Support more text Canvas properties#6871

Merged
JonnyBurger merged 3 commits intomainfrom
web-renderer-font-feature-settings
Mar 19, 2026
Merged

@remotion/web-renderer: Support more text Canvas properties#6871
JonnyBurger merged 3 commits intomainfrom
web-renderer-font-feature-settings

Conversation

@JonnyBurger
Copy link
Copy Markdown
Member

Summary

  • Pass through additional Canvas text drawing style properties from computed CSS: fontVariantCaps, fontKerning, fontStretch, textRendering, and wordSpacing
  • CSS font-feature-settings like "smcp" (small caps) now render correctly via the Canvas API's fontVariantCaps property
  • Added test fixture for font variant caps

Closes #6869

Test plan

  • Verify fontVariantCaps: 'small-caps' renders correctly in web renderer
  • Verify fontFeatureSettings: '"smcp"' renders as small caps
  • Verify fontKerning, fontStretch, textRendering, and wordSpacing pass through correctly
  • Run existing text rendering tests to ensure no regressions

🤖 Generated with Claude Code

…, text rendering, and word spacing

Pass through additional Canvas text drawing style properties from computed
CSS styles: fontVariantCaps, fontKerning, fontStretch, textRendering, and
wordSpacing. This enables CSS font-feature-settings like small-caps to
render correctly via the Canvas API's corresponding properties.

Closes #6869

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment Mar 19, 2026 1:25pm
remotion Ready Ready Preview, Comment Mar 19, 2026 1:25pm

Request Review

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

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

Review: @remotion/web-renderer: Support fontFeatureSettings

The code changes look correct and well-implemented. A few issues need addressing before merging.

1. font-feature-settings case in fixture will not render correctly

The fixture includes a test case using fontFeatureSettings: '"smcp"' (packages/web-renderer/src/test/fixtures/text/font-variant-caps.tsx:23-29). However, the Canvas 2D API does not have a fontFeatureSettings context property. Unlike fontVariantCaps, fontKerning, fontStretch, and textRendering which have direct Canvas context equivalents, font-feature-settings cannot be passed through to the Canvas API this way.

This test case will silently fail to render as small caps. You have two options:

  • Remove the font-feature-settings case from the fixture (since it's out of scope for this PR), or
  • Embed the font-feature-settings into the ctx.font string using the CSS font shorthand syntax

2. Fixture is not registered in the test suite

The new fixture font-variant-caps is not imported in Root.tsx or text.test.tsx. The other text fixtures (letterSpacing, fontStyle, etc.) each have a corresponding visual regression test in text.test.tsx. Without a test, the fixture won't be validated by CI and could silently break.

3. PR description conflates font-variant-caps with font-feature-settings

The summary states "CSS font-feature-settings like \"smcp\" now render correctly via the Canvas API's fontVariantCaps property" — but font-feature-settings and font-variant-caps are distinct CSS properties. The Canvas 2D fontVariantCaps property handles font-variant-caps: small-caps, not font-feature-settings: "smcp". The PR correctly implements the former; the latter is not handled.

4. Minor: missing margin in fixture

The font-feature-settings paragraph in the fixture is missing marginBottom: 10, causing inconsistent vertical spacing compared to the other paragraphs.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow runpullfrog.com𝕏

>
Font feature settings smcp: The quick brown fox jumps over the lazy
dog.
</p>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This font-feature-settings case will not render as small caps in the web renderer. The Canvas 2D API has no fontFeatureSettings context property (unlike fontVariantCaps/fontKerning/fontStretch/textRendering which do). Either remove this test case or implement support by encoding the font feature into the ctx.font string.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JonnyBurger JonnyBurger changed the title @remotion/web-renderer: Support fontFeatureSettings @remotion/web-renderer: Support more text Canvas properties Mar 19, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JonnyBurger JonnyBurger merged commit 0554386 into main Mar 19, 2026
18 checks passed
@JonnyBurger JonnyBurger deleted the web-renderer-font-feature-settings branch March 19, 2026 14:34
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.

Web Renderer: fontFeatureSettings are not supported

1 participant