Skip to content

feat: add SSR support via setMeasureContext#126

Open
bg-l2norm wants to merge 2 commits intochenglou:mainfrom
bg-l2norm:main
Open

feat: add SSR support via setMeasureContext#126
bg-l2norm wants to merge 2 commits intochenglou:mainfrom
bg-l2norm:main

Conversation

@bg-l2norm
Copy link
Copy Markdown
Contributor

@bg-l2norm bg-l2norm commented Apr 12, 2026

This adds an exported function setMeasureContext that enables Server-Side Rendering (SSR) support. It allows developers using Node.js or NextJS to use the canvas package and inject its measurement context. Previously, pretext required document or OffscreenCanvas to exist.

Closes #123.

bg-l2norm and others added 2 commits April 12, 2026 14:25
Adds `setMeasureContext` function to allow injecting custom canvas context
for text measurement in SSR environments like Node.js or NextJS where DOM
and OffscreenCanvas are not globally available. Also updates the README
with an SSR integration guide.
…6201

feat: add SSR support via setMeasureContext
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.

Server Side Rendering (SSR) support

1 participant