Node / Text Rendering · guide
Text on a circular arc (textOnCurve)
Current Apexify.js 6.0.0 documentation for Text on a circular arc (textOnCurve).
When textOnCurve is set (TextCurveConfig), EnhancedTextRenderer routes each newline-separated row through renderCurvedLine.
Activating arc layout
Degenerate cases → straight text
If sweepAngle <= 0, sweepAngle >= 360, computeCircularArcPlacements returns null, or there are zero graphemes, the renderer falls back to renderEnhancedTextLine at (x, y) — same styling stack as normal horizontal text.
Geometry model (lib-next/text/text-curved.ts)
- Graphemes come from
Intl.Segmenterwhen available — combining marks stay attached. - Horizontal centres along the straight baseline (
measureGraphemeCenters) drive proportional spacing along the arc. anchor (x, y)is the mid-string anchor on the arc (apex whenup: trueatstartAngleDeg: 0).baselineOffsetexpands/contractsRdraw = R + baselineOffsetwithout changing angular spacing.
layoutMode (CurvedTextLayoutMode)
Relates measured typographic width W, user sweep θ, and optional radius (**documented on CurvedTextLayoutMode in types/text.ts):
| Mode | Radius rule |
|---|---|
fit | R = W / θ — radius ignored for geometry; arc length matches measured width. |
clamp (default) | R = max(radius ?? R_fit, R_fit) — never tighter than fit. |
override | R = radius ?? R_fit; if R·θ < W, sweep expands so spacing never crowds. |
Multi-line arcs
text.split('\n') feeds independent arcs. y advances per line by lineHeight * fontSize where lineHeight defaults 1.4 (resolveTextLayout).
Example — badge arc
Interaction with maxWidth
Arc mode does not word-wrap — layout.maxWidth is ignored for branching (textOnCurve wins first). Insert \\n manually if you need stacked arcs.