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

Node / Text Rendering · guide

Paint order & renderer structure

Current Apexify.js 6.0.0 documentation for Paint order & renderer structure.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

This page describes EnhancedTextRenderer.renderText (lib-next/text/enhanced-text-renderer.ts), which createText and renderTextsOntoContext rely on.


Outer scope

Each TextProperties layer wraps rendering in ctx.save() / ctx.restore().

StageFunctionNotes
Font fileregisterTextFontFromPathRuns when font.path (**or fontPath) present
Motion / alphaapplyTextTransformationsRotation around (x,y), then fill.opacity → globalAlpha
TypographysetupTextFontCSS font string + letterSpacing / wordSpacing
AnchorsetupTextAlignmenttextAlign, textBaseline
BranchinlinetextOnCurve · else layout.maxWidth · else single-line (still honours \\n)

Straight-line segments (renderEnhancedTextLine)

Defined in text-style.ts — ordering per documentation comment:

  1. effects.highlight — backdrop fillRect
  2. effects.glow — blurred fillText halo (may double-fill when gradient glow)
  3. effects.shadow — Canvas shadow fillText
  4. stroke — strokeText (complex styles multi-pass)
  5. fill — renderTextFill (colour / gradient)
  6. decorations — underline / overline / strikethrough horizontal rules (renderTextDecorations)

Arc glyphs (renderRotatedGlyph)

Each grapheme paints inside translate → rotate local space with textAlign: center, textBaseline: middle:

highlight → glow → shadow → stroke → fill → decorations (local variants: renderTextHighlightLocal, renderTextDecorationsLocal).


Multi-pass helpers worth knowing

HelperRole
renderComplexTextStrokeImplements groove, ridge, double outline styles via stacked strokeText passes
createTextGradientBuilds linear, radial, conic paints + optional repeating patterns

Legacy module (draw-text-legacy.ts)

Older drawText helpers targeting TextObject remain for backwards compatibility — new code should call createText / measureText only.


Extending rendering

There is no alternate textPathRenderer wired into TextCreator today — arbitrary Bézier baselines require custom drawing or upstream preprocessing.


Next steps