vyaz-monorepo / core/src / TextFrame
Interface: TextFrame
Defined in: core/src/types/Document.ts:620
Root text container — a text box on a canvas.
This replaces the earlier RichTextDocument. It holds geometry, text flow settings, and the paragraph array.
Wrap & Autofit interaction:
- When
wrapistrue, the layout engine breaks lines atwidth. - When
autofit.enabledistrue, the engine shrinks the font proportionally to fit the text insidewidth×height.
Example
{
width: 600,
height: 400,
wrap: true,
autofit: { enabled: true, minFontSize: 10, maxFontSize: 24 },
writingMode: "horizontal-tb",
verticalAlignment: "top",
paragraphs: [ /* ... */ ]
}Properties
autofit?
optionalautofit?:AutofitConfig
Defined in: core/src/types/Document.ts:642
Autofit (auto font-size reduction) configuration.
columns?
optionalcolumns?:MultiColumnConfig
Defined in: core/src/types/Document.ts:703
Experimental
Multi-column layout configuration. When set, paragraphs are automatically broken into columns. Accepted in the type but ignored by the layout engine (no-op until implemented).
defaultStyle?
optionaldefaultStyle?:Partial<Omit<TextRun,"type"|"text"|"inlineWidget">>
Defined in: core/src/types/Document.ts:710
Default style inherited by all TextRun children. Any field omitted in a TextRun will fall back to this value.
direction?
optionaldirection?:"ltr"|"rtl"
Defined in: core/src/types/Document.ts:671
Base text direction (important for bidi). 'ltr' = left-to-right, 'rtl' = right-to-left.
dominantBaseline?
optionaldominantBaseline?:DominantBaseline
Defined in: core/src/types/Document.ts:678
Experimental
Dominant baseline for inline alignment. Accepted in the type but ignored by the layout engine (no-op until implemented).
height?
optionalheight?:number
Defined in: core/src/types/Document.ts:634
Container height in px.
When set — may clip content or trigger autofit. When undefined — auto (content determines height, contentHeight from the layout result).
lineFitEdge?
optionallineFitEdge?:LineFitEdge
Defined in: core/src/types/Document.ts:683
Experimental
Font metric edge used for line box height. Accepted in the type but ignored by the layout engine (no-op until implemented).
padding?
optionalpadding?:object
Defined in: core/src/types/Document.ts:688
Inner padding of the frame. Text layout starts at x + padding.left, y + padding.top.
bottom
bottom:
number
Bottom padding in px.
left
left:
number
Left padding in px.
right
right:
number
Right padding in px.
top
top:
number
Top padding in px.
paragraphs
paragraphs:
Paragraph[]
Defined in: core/src/types/Document.ts:705
Paragraphs forming the text content.
rotation?
optionalrotation?:number
Defined in: core/src/types/Document.ts:666
Rigid clockwise rotation of the whole text block, in degrees, applied after layout as an affine transform about the frame-box centre. This does not affect line breaking, measurement or positioning — only the final render transform. Mirrors PowerPoint's shape rotation (<a:xfrm rot>).
Composes with writingMode: 'sideways-*' (which contributes its own ±90°). 0, 90, 180, 270 are the exercised values; other angles are accepted and rotate about the centre without expanding the canvas bounding box.
The engine folds this together with the writing-mode rotation and reports the result on TextFrameLayoutResult.transform.
textOrientation?
optionaltextOrientation?:TextOrientation
Defined in: core/src/types/Document.ts:652
Character orientation in vertical mode. Ignored when writingMode === 'horizontal-tb'.
verticalAlignment?
optionalverticalAlignment?:VerticalAlignment
Defined in: core/src/types/Document.ts:673
Vertical alignment of the content block inside the frame.
width?
optionalwidth?:number
Defined in: core/src/types/Document.ts:627
Container width in px.
When set — text wraps by this width (if wrap=true). Used as the inline-size for horizontal-tb writing mode. When undefined — auto (fit-content).
wrap
wrap:
boolean
Defined in: core/src/types/Document.ts:640
Whether line wrapping is enabled. true = lines break when they exceed width (or height in vertical mode). false = text overflows (may be clipped or trigger autofit).
writingMode?
optionalwritingMode?:WritingMode
Defined in: core/src/types/Document.ts:647
Writing mode (block flow direction). Defaults to 'horizontal-tb' when absent.
