Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Node / Text Rendering · guide

Text rendering (createText) — overview

Current Apexify.js 6.0.0 documentation for Text rendering (createText) — overview.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

await painter.createText(textPropsOrArray, canvasBuffer[, painterOpts]) draws styled Unicode strings onto an existing PNG canvasBuffer (from createCanvas, createImage, etc.). Each call returns a new Buffer.

On video: the same TextProperties shape powers createVideo({ addTextOverlay }) and videoPipeline().text() — see Text overlays and Video pipeline.

The runtime pipeline is TextCreator → EnhancedTextRenderer.renderText (lib-next/text/).


Arguments

ArgumentRole
textPropsOrArrayOne TextProperties or an array (processed in order: earlier entries paint underneath later ones).
canvasBufferBuffer or CanvasResults whose buffer field holds PNG (or compatible raster) bytes.
painterOptsOptional PainterAssetRefsOptions — same placeholder-resolution hooks as createImage when your props reference assets by ref.

Required on each object: text, x, y.


APIPurpose
await painter.measureText(textProps)Layout metrics without drawing (TextMetricsCreator — same font/spacing/wrap rules).
TextCreator.renderTextsOntoContext(ctx, texts)Paint onto an existing SKRSContext2D (used internally by SceneCreator for type: 'text' layers).

TextProperties: nested vs flat

Prefer grouped objects font, decorations, effects, layout, placement, and fill. Legacy flat fields (fontSize, color, maxWidth, …) still work.

Merge rule: when both nested and flat exist for the same concept, the nested value wins (resolveTextDecorations, resolveTextEffects, resolveTextLayout, resolveTextPlacement, resolveTextFill in apexify.js / types/text).


Guide map

#TopicWhat it covers
1Font & placementfont, decorations.bold/italic, placement (textAlign, textBaseline, rotation), custom font.path
2Wrapping & spacinglayout.maxWidth, maxHeight, lineHeight, letterSpacing, wordSpacing
3Colour & gradientsfill, gradient types (linear / radial / conic)
4Glow, shadow & strokeeffects.glow, effects.shadow, stroke
5Decorations & highlighteffects.highlight, underline / overline / strikethrough
6Circular arc texttextOnCurve (TextCurveConfig), layoutMode
7measureTextTextMetrics, includeCharMetrics, measurementCanvas
8Paint orderExact compositing order per line vs per arc glyph
9Field matrixFull TextProperties checklist

Minimal example

SOURCEtypescript
typescript
Studio
const { buffer } = await painter.createCanvas({ width: 800, height: 400 }); await painter.createText(  {    text: 'Apexify.js',    x: 400,    y: 220,    placement: { textAlign: 'center', textBaseline: 'middle' },    font: { size: 56, family: 'Arial' },    fill: { color: '#e2e8f0' },    stroke: { color: '#0f172a', width: 2 },  },  buffer);

Next steps