Skip to content

Commit 1007020

Browse files
committed
Updated scenegraph.Text docs
1 parent 0431e1a commit 1007020

File tree

1 file changed

+74
-3
lines changed

1 file changed

+74
-3
lines changed

types/scenegraph.d.ts

+74-3
Original file line numberDiff line numberDiff line change
@@ -886,21 +886,92 @@ declare class Text extends GraphicsNode {
886886
public flipY: boolean;
887887

888888
/**
889-
* Horizontal alignment: Text.ALIGN_LEFT, ALIGN_CENTER, or ALIGN_RIGHT. This setting affects the layout of multiline text, and it also affects what direction text grows when edited on canvas.
889+
* **Since:** XD 14
890+
* Set the font family across all style ranges, or get the font family of the last style range (font family of all the text if one range covers all the text). Plugins should not assume any particular default value for fontFamily.
891+
*/
892+
public fontFamily: string;
893+
894+
/**
895+
* **Since:** XD 14
896+
* Set the font style across all style ranges, or get the font style of the last style range (font style of all the text if one range covers all the text).
897+
* @default non-italic normal weight style
898+
*/
899+
public fontStyle: string;
900+
901+
/**
902+
* **Since:** XD 14
903+
* Font size in document pixels. Set the font size across all style ranges, or get the font size of the last style range (font size of all the text if one range covers all the text). Plugins should not assume any particular default value for fontSize.
904+
*/
905+
public fontSize: number;
906+
907+
/**
908+
* Set the text color across all style ranges, or get the color of the last style range (color of all the text if one range covers all the text). Unlike most other nodes, text only allows a solid color fill - gradients and image fills are not supported.
909+
* @default null
910+
*/
911+
public fill: Color | null;
912+
913+
/**
914+
* **Since:** XD 14
915+
* Character spacing in increments of 1/1000th of the fontSize, in addition to the font's default character kerning. May be negative.
916+
*
917+
* Set the character spacing across all style ranges, or get the character spacing of the last style range (character spacing of all the text if one range covers all the text).
918+
* @default 0
919+
*/
920+
public charSpacing: number;
921+
922+
/**
923+
* **Since:** XD 14
924+
* Set underline across all style ranges, or get the underline of the last style range (underline of all the text if one range covers all the text).
925+
* @default false
926+
*/
927+
public underline: boolean;
928+
929+
public static readonly ALIGN_LEFT: string;
930+
public static readonly ALIGN_CENTER: string;
931+
public static readonly ALIGN_RIGHT: string;
932+
933+
/**
934+
* Horizontal alignment: Text.ALIGN_LEFT, ALIGN_CENTER, or ALIGN_RIGHT. This setting affects the layout of multiline text, and for point text it also affects how the text is positioned relative to its anchor point (x=0 in local coordinates) and what direction the text grows when edited by the user.
935+
*
936+
* Changing textAlign on existing point text will cause it to shift horizontally. To change textAlign while keeping the text in a fixed position, shift the text horizontally (moving its anchor point) to compensate:
937+
* @example ```javascript
938+
* let originalBounds = textNode.localBounds;
939+
* textNode.textAlign = newAlignValue;
940+
* let newBounds = textNode.localBounds;
941+
* textNode.moveInParentCoordinates(originalBounds.x - newBounds.x, 0);
942+
*
943+
* @default Text.ALIGN_LEFT
890944
*/
891945
public textAlign: string;
892946

893947
/**
894948
* Distance between baselines in multiline text, in document pixels. The special value 0 causes XD to use the default line spacing defined by the font given the current font size & style.
895949
*
896950
* This property is not automatically adjusted when fontSize changes, if line spacing is not set to 0, the line spacing will stay fixed while the font size changes, shifting the spacing’s proportional relationship to font size. If the value is 0, then the rendered line spacing will change to match the new font size, since 0 means the spacing is dynamically calculated from the current font settings.
951+
*
952+
* @default 0
897953
*/
898954
public lineSpacing: number;
899955

900956
/**
901-
* Null for point text. For area text, specifies the size of the rectangle within which text is wrapped and clipped.
957+
* **Since:** XD 14
958+
*
959+
* Additional distance between paragraphs, in document pixels, added to the lineSpacing amount (soft line breaks in area text are separated only by lineSpacing, while hard line breaks are separated by lineSpacing + paragraphSpacing). Unlike lineSpacing, 0 is not a special value; it just means no added spacing.
960+
*
961+
* Similar to {@link lineSpacing}, this property is not automatically adjusted when fontSize changes. The paragraph spacing amount will stay fixed while the font size changes, shifting the spacing's proportional relationship to font size.
962+
*
963+
* @default 0
964+
*/
965+
public paragraphSpacing: number;
966+
967+
/**
968+
* `Null` for point text. For area text, specifies the size of the rectangle within which text is wrapped and clipped.
969+
*
970+
* Changing point text to area text or vice versa will change the origin / anchor point of the text, thus changing its localBounds, but it will also automatically change the node's transform so its globalBounds and boundsInParent origins remain unchanged.
971+
*
972+
* Changing area text to point text will also automatically insert hard line breaks ("\n") into the text to match the previous line wrapping's appearance exactly.
902973
*/
903-
public readonly areaBox: null | { width: number; height: number };
974+
public areaBox: null | { width: number; height: number };
904975

905976
/**
906977
* Always false for point text. For area text, true if the text does not fit in the content box and its bottom is being clipped.

0 commit comments

Comments
 (0)