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

Node / Text Rendering · guide

Decorations & highlight

Current Apexify.js 6.0.0 documentation for Decorations & highlight.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

Put backdrop tint under effects.highlight and typographic rules under decorations (underline, overline, strikethrough). Legacy flat highlight / underline / … still resolve via resolveTextEffects / resolveTextDecorations (nested wins).


Highlight — effects.highlight

Drawn before glow, shadow, stroke, fill, and line decorations (renderEnhancedTextLine).

KeyDefault
color#ffff00
gradientOverrides color
opacity0.3

Straight baseline: renderTextHighlight draws fillRect(x, highlightY, width, height) with highlightY = y - height * 0.8 — tuned for alphabetic baseline geometry.

Arc text: each glyph uses renderTextHighlightLocal in tangent coordinates (width = measured advance for that grapheme).


Underline / overline / strikethrough (TextLineDecoration)

Each may be true (inherits fill color + thickness ≈ fontSize * 0.05) or an object:

SOURCEtypescript
typescript
Studio
underline?: boolean | {  color?: string;  gradient?: gradient;  width?: number;};

Same shape for overline and strikethrough.

Placement on straight lines (renderTextDecorations)

Uses ctx.measureText width from x as textAlign defines origin:

DecorationY offset
Underliney + fontSize * 0.1
Overliney - fontSize * 0.8
Strikethroughy - fontSize * 0.3

Gradient strokes span x → x + measuredWidth at fixed decorationY.


Example

SOURCEtypescript
typescript
Studio
await painter.createText(  {    text: 'Sale · Today only',    x: 72,    y: 140,    font: { size: 36, family: 'Arial' },    effects: {      highlight: { color: '#fef08a', opacity: 0.55 },    },    decorations: {      underline: { color: '#dc2626', width: 3 },      strikethrough: true,    },    fill: { color: '#0f172a' },  },  buffer);

Next steps