Penpot plugins API
    Preparing search index...

    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: "normal" | "italic" | "mixed" | null;
        lineHeight: string;
        letterSpacing: string;
        textTransform:
            | "none"
            | "mixed"
            | "uppercase"
            | "capitalize"
            | "lowercase"
            | null;
        textDecoration: "none"
        | "mixed"
        | "underline"
        | "line-through"
        | null;
        direction: "mixed" | "ltr" | "rtl" | null;
        fills: Fill[] | "mixed";
        align: "center" | "left" | "right" | "mixed" | "justify" | null;
        verticalAlign: "center" | "top" | "bottom" | "mixed" | null;
        applyTypography(typography: LibraryTypography): void;
    }
    Index

    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: "normal" | "italic" | "mixed" | null

    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:
        | "none"
        | "mixed"
        | "uppercase"
        | "capitalize"
        | "lowercase"
        | null

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

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

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

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

    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: "center" | "left" | "right" | "mixed" | "justify" | null

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

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

    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);