Open Design

Interface IText

octopus
{ baselinePolicy?: "center" | "fixed"; bounds?: { bottom: number; height: number; left: number; right: number; top: number; width: number }; boundsMode?: "fixed" | "auto"; defaultStyle?: { color?: { a: number; b: number; g: number; r: number }; font?: { align?: "left" | "right" | "center" | "justify"; baseline?: "subScript" | "superScript" | "normal"; bold?: boolean; features?: Array<{ tag: string; value: number }>; italic?: boolean; kerning?: boolean; letterSpacing?: number; ligatures?: 0 | 1 | 2 | 3; lineHeight?: number; linethrough?: boolean; lowercase?: boolean; name?: string; postScriptName: string; size: number; smallcaps?: boolean; syntheticPostScriptName?: boolean; type?: string; underline?: 0 | 1 | 2; uppercase?: boolean } }; frame?: { bottom: number; height: number; left: number; right: number; top: number; width: number }; ignoreFirstLineHeight?: boolean; styles?: Array<{ color?: { a: number; b: number; g: number; r: number }; font?: { align?: "left" | "right" | "center" | "justify"; baseline?: "subScript" | "superScript" | "normal"; bold?: boolean; features?: Array<{ tag: string; value: number }>; italic?: boolean; kerning?: boolean; letterSpacing?: number; ligatures?: 0 | 1 | 2 | 3; lineHeight?: number; linethrough?: boolean; lowercase?: boolean; name?: string; postScriptName: string; size: number; smallcaps?: boolean; syntheticPostScriptName?: boolean; type?: string; underline?: 0 | 1 | 2; uppercase?: boolean }; ranges?: Array<{ from: number; to: number }> }>; transform?: { scaleX: number; scaleY: number }; transformMatrix?: { a: number; b: number; c: number; d: number; tx: number; ty: number }; value: string; verticalAlignment?: "top" | "bottom" | "center" }

Keys:

OptionalbaselinePolicy?: "center" | "fixed"

Defines a way the baseline position is determined.

  • fixed - baseline distance from a layer top is given only by font properties
  • center - baseline is centered within the line (i.e. depends on lineHeight)
Optionalbounds?: { bottom: number; height: number; left: number; right: number; top: number; width: number }

[deprecated, use frame instead] Bounds of the text. Text bounds are not always same as layer bounds.

OptionalboundsMode?: "fixed" | "auto"

Specifies the text frame semantics. fixed mode strictly sets the typeset area according to the frame, 'auto' mode expands bounds as needed.

OptionaldefaultStyle?: { color?: { a: number; b: number; g: number; r: number }; font?: { align?: "left" | "right" | "center" | "justify"; baseline?: "subScript" | "superScript" | "normal"; bold?: boolean; features?: Array<{ tag: string; value: number }>; italic?: boolean; kerning?: boolean; letterSpacing?: number; ligatures?: 0 | 1 | 2 | 3; lineHeight?: number; linethrough?: boolean; lowercase?: boolean; name?: string; postScriptName: string; size: number; smallcaps?: boolean; syntheticPostScriptName?: boolean; type?: string; underline?: 0 | 1 | 2; uppercase?: boolean } }

Text style that is used as a default when no explicit style range covers a particular fragment of a text. Every font style range in text.styles array overrides the defaultStyle value.

Optionalframe?: { bottom: number; height: number; left: number; right: number; top: number; width: number }

Describes an area the text layer should be typeset into. In case of auto bounds mode, width and height might be 0 as the dimension might not be specified.

OptionalignoreFirstLineHeight?: boolean

[Photoshop only, deprecated] Describes whether the first line's height is considered in the layer bounds calculation.

Optionalstyles?: Array<{ color?: { a: number; b: number; g: number; r: number }; font?: { align?: "left" | "right" | "center" | "justify"; baseline?: "subScript" | "superScript" | "normal"; bold?: boolean; features?: Array<{ tag: string; value: number }>; italic?: boolean; kerning?: boolean; letterSpacing?: number; ligatures?: 0 | 1 | 2 | 3; lineHeight?: number; linethrough?: boolean; lowercase?: boolean; name?: string; postScriptName: string; size: number; smallcaps?: boolean; syntheticPostScriptName?: boolean; type?: string; underline?: 0 | 1 | 2; uppercase?: boolean }; ranges?: Array<{ from: number; to: number }> }>

An array containing font style ranges.

Optionaltransform?: { scaleX: number; scaleY: number }

[Photoshop only] Text transform scale factors.

OptionaltransformMatrix?: { a: number; b: number; c: number; d: number; tx: number; ty: number }
value: string

Text content of the text layer.

OptionalverticalAlignment?: "top" | "bottom" | "center"

Text vertical alignment relative to the whole layer.

getFonts
getFonts(options?: Partial<{ depth: number }>): Array<FontDescriptor>

Parameters:

options: Partial<{ depth: number }>
returns Array<FontDescriptor>
getTextContent
getTextContent(): string
returns string