skia
    Preparing search index...

    Interface ParagraphBuilder

    CanvasKit is built with Emscripten and Embind. Embind adds the following methods to all objects that are exposed with it. This _type field is necessary for the TypeScript compiler to differentiate between opaque types such as Shader and ColorFilter. It doesn't exist at runtime.

    interface ParagraphBuilder {
        _type: "ParagraphBuilder";
        addPlaceholder(
            width?: number,
            height?: number,
            alignment?: EmbindEnumEntity,
            baseline?: EmbindEnumEntity,
            offset?: number,
        ): void;
        addText(str: string): void;
        build(): Paragraph;
        delete(): void;
        deleteLater(): void;
        getText(): string;
        isAliasOf(other: any): boolean;
        isDeleted(): boolean;
        pop(): void;
        pushPaintStyle(textStyle: TextStyle, fg: Paint, bg: Paint): void;
        pushStyle(text: TextStyle): void;
        reset(): void;
        setGraphemeBreaksUtf16(graphemes: InputGraphemes): void;
        setGraphemeBreaksUtf8(graphemes: InputGraphemes): void;
        setLineBreaksUtf16(lineBreaks: InputLineBreaks): void;
        setLineBreaksUtf8(lineBreaks: InputLineBreaks): void;
        setWordsUtf16(words: InputWords): void;
        setWordsUtf8(words: InputWords): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    _type: "ParagraphBuilder"

    Methods

    • Adds text to the builder. Forms the proper runs to use the upper-most style on the style_stack.

      Parameters

      • str: string

      Returns void

    • Returns the entire Paragraph text (which is useful in case that text was produced as a set of addText calls).

      Returns string

    • Remove a style from the stack. Useful to apply different styles to chunks of text such as bolding.

      Returns void

    • Push a style to the stack. The corresponding text added with addText will use the top-most style.

      Parameters

      Returns void

    • Resets this builder to its initial state, discarding any text, styles, placeholders that have been added, but keeping the initial ParagraphStyle.

      Returns void

    • Parameters

      • graphemes: InputGraphemes

        is an array of indexes in the input text that point to the start of each grapheme.

        The indices are expected to be relative to the UTF-16 representation of the text.

        The Intl.Segmenter API can be used as a source for this data.

      Returns void

    • Parameters

      • graphemes: InputGraphemes

        is an array of indexes in the input text that point to the start of each grapheme.

        The indices are expected to be relative to the UTF-8 representation of the text.

      Returns void

    • Parameters

      • lineBreaks: InputLineBreaks

        is an array of unsigned integers that should be treated as pairs (index, break type) that point to the places of possible line breaking if needed. It should include 0 as the first element. Break type == 0 means soft break, break type == 1 is a hard break.

        The indices are expected to be relative to the UTF-16 representation of the text.

        Chrome's v8BreakIterator API can be used as a source for this data.

      Returns void

    • Parameters

      • lineBreaks: InputLineBreaks

        is an array of unsigned integers that should be treated as pairs (index, break type) that point to the places of possible line breaking if needed. It should include 0 as the first element. Break type == 0 means soft break, break type == 1 is a hard break.

        The indices are expected to be relative to the UTF-8 representation of the text.

      Returns void

    • Parameters

      • words: InputWords

        is an array of word edges (starting or ending). You can pass 2 elements (0 as a start of the entire text and text.size as the end). This information is only needed for a specific API method getWords.

        The indices are expected to be relative to the UTF-16 representation of the text.

        The Intl.Segmenter API can be used as a source for this data.

      Returns void

    • Parameters

      • words: InputWords

        is an array of word edges (starting or ending). You can pass 2 elements (0 as a start of the entire text and text.size as the end). This information is only needed for a specific API method getWords.

        The indices are expected to be relative to the UTF-8 representation of the text.

      Returns void