Interface TextRange

Represents a range of text within a Text shape. This interface provides properties for styling and formatting text ranges.

interface TextRange {
    shape: Text;
    characters: string;
    fontId: string;
    fontFamily: string;
    fontVariantId: string;
    fontSize: string;
    fontWeight: string;
    fontStyle:
        | null
        | "normal"
        | "italic"
        | "mixed";
    lineHeight: string;
    letterSpacing: string;
    textTransform:
        | null
        | "none"
        | "mixed"
        | "uppercase"
        | "capitalize"
        | "lowercase";
    textDecoration:
        | null
        | "none"
        | "mixed"
        | "underline"
        | "line-through";
    direction:
        | null
        | "mixed"
        | "ltr"
        | "rtl";
    fills: Fill[] | "mixed";
    align:
        | null
        | "center"
        | "left"
        | "right"
        | "mixed"
        | "justify";
    verticalAlign:
        | null
        | "center"
        | "top"
        | "bottom"
        | "mixed";
    applyTypography(typography: LibraryTypography): void;
}

Properties

shape: Text

The Text shape to which this text range belongs.

characters: string

The characters associated with the current text range.

fontId: string

The font ID of the text range. It can be a specific font ID or 'mixed' if multiple fonts are used.

fontFamily: string

The font family of the text range. It can be a specific font family or 'mixed' if multiple font families are used.

fontVariantId: string

The font variant ID of the text range. It can be a specific font variant ID or 'mixed' if multiple font variants are used.

fontSize: string

The font size of the text range. It can be a specific font size or 'mixed' if multiple font sizes are used.

fontWeight: string

The font weight of the text range. It can be a specific font weight or 'mixed' if multiple font weights are used.

fontStyle:
    | null
    | "normal"
    | "italic"
    | "mixed"

The font style of the text range. It can be a specific font style or 'mixed' if multiple font styles are used.

lineHeight: string

The line height of the text range. It can be a specific line height or 'mixed' if multiple line heights are used.

letterSpacing: string

The letter spacing of the text range. It can be a specific letter spacing or 'mixed' if multiple letter spacings are used.

textTransform:
    | null
    | "none"
    | "mixed"
    | "uppercase"
    | "capitalize"
    | "lowercase"

The text transform applied to the text range. It can be a specific text transform or 'mixed' if multiple text transforms are used.

textDecoration:
    | null
    | "none"
    | "mixed"
    | "underline"
    | "line-through"

The text decoration applied to the text range. It can be a specific text decoration or 'mixed' if multiple text decorations are used.

direction:
    | null
    | "mixed"
    | "ltr"
    | "rtl"

The text direction for the text range. It can be a specific direction or 'mixed' if multiple directions are used.

fills: Fill[] | "mixed"

The fill styles applied to the text range.

align:
    | null
    | "center"
    | "left"
    | "right"
    | "mixed"
    | "justify"

The horizontal alignment of the text range. It can be a specific alignment or 'mixed' if multiple alignments are used.

verticalAlign:
    | null
    | "center"
    | "top"
    | "bottom"
    | "mixed"

The vertical alignment of the text range. It can be a specific alignment or 'mixed' if multiple alignments are used.

Methods

  • Applies a typography style to the text range. This method sets various typography properties for the text range according to the given typography style.

    Parameters

    Returns void

    textRange.applyTypography(typography);