Skip to content

Transition to Skia-based Rendering Engine (CanvasKit) + Typography Enhancements #230

@canboyedits

Description

@canboyedits

Hi @suikadev and community,

First off, thank you for the amazing work on Suika — it’s one of the cleanest, most modular HTML5 vector editors out there. 🙌 Its separation of core, rendering, and UI makes it incredibly approachable and extensible.

I'm working on a production-grade desktop web application that relies heavily on Suika’s canvas engine, and I’m reaching out to propose/discuss:

🚀 Proposal Summary

Rendering Engine: Transition Suika’s canvas renderer to CanvasKit (Skia via WebAssembly) for GPU-accelerated performance.

Typography: Add advanced typographic support, including:

Multi-column layout

Inline font styles (bold, italic, underline, spans)

Ligatures and kerning

Text wrapping around vector shapes (especially images)

🔥 Why Skia / CanvasKit?

Right now, Suika redraws the entire scene graph using the HTML5 Canvas 2D API, which is conceptually simple but has performance issues for:

Larger documents (e.g. 3000+ words, multiple high-res images)

Frequent pan/zoom/redraw

Collaborative editing with live shape deltas

CanvasKit offers:

Hardware-accelerated drawing (via WebGL2/WebGPU)

Real subpixel font rendering and native ligature/kerning support

True retained-mode vector compositing

Better performance on low-end machines

Native support for paragraph layout (ParagraphBuilder) and rich text

This would be a huge step forward for rendering efficiency and visual fidelity.

📝 Why Typography Enhancements?

A number of professional/editorial workflows need more than flat text:

Text columns: Required in layout design (magazines, newspapers, blogs)

Text wrapping: Essential for aligning text around images or shapes

Mixed styles: Per-span styling (bold, italics, font changes) within one text block

Typography control: Letter spacing, line height, kerning, ligatures, etc.

Right now, Suika only supports basic text blocks with uniform styling. Canvas 2D offers no native support for the above — but Skia does.

🧩 Proposed Architectural Approach
This could be tackled incrementally:

Phase 1: Pluggable Renderer
Abstract the renderer behind a clean interface (IRenderer)

Keep existing Canvas2D renderer for fallback

Add new CanvasKitRenderer via @canvaskit/canvaskit-wasm

Ensure shape drawing (Rect, Text, Path, Group, etc.) maps to CanvasKit API

Phase 2: Rich Text Model
Update text node structure to support:

ts
Copy
Edit

type TextRun = { text: string, style: { font, bold, italic, color, ... } }
interface RichText {
runs: TextRun[];
layout?: 'column' | 'wrap';
frame?: Rect;
}
UI updates to handle inline formatting tools

Phase 3: Typographic Layout
Use CanvasKit’s ParagraphBuilder for rendering styled text with line breaks

Add optional text-shape exclusion logic for wrapping (collision/contour)

Columns: Calculate sub-frames inside a text container and layout text across

Phase 4: Collaboration-aware Optimizations
Cache paragraph layout results in memory

Load/render text blocks only when visible (virtualized editing)

Redis or IndexedDB for real-time canvas object sync + local edit buffer

🧠 Open Questions

Would Suika be open to exposing a renderer abstraction layer?

Any prior considerations/discussions about CanvasKit adoption?

Preferred method for integrating a pluggable rendering backend?

✅ Benefits

Massive performance boost for complex documents

Full desktop-publishing typography features

More competitive with tools like Figma, Canva, Scribus, InDesign

Foundation for PDF export fidelity, print layouts, and WYSIWYG output

Would love to hear your thoughts, and happy to help with prototyping or submitting PRs where useful.

Thanks again for building Suika! 🎨

Tags: enhancement, performance, typography, canvaskit, text, collaboration, rendering-engine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions