font([font])

Class: Text.

Description:

Gets or sets the font used for the Text shape. See the example for font object format.

Parameters:

Name Type Description

[font]

Font

Font object.

Returns:

Type: this | Font

Examples:

textShape.font({name: "sans-serif", size: 14, italic: true}); // Sets new font.
const font = textShape.font(); // gets component's font

// Full list of supported font properties:
const font = {
    name: string,           // Font family name (e.g., "sans-serif")
    size: number,           // Font size in pixels
    bold: boolean,          // Whether the text is bold
    italic: boolean,        // Whether the text is italic
    underlined: boolean,    // Whether the text is underlined
    strikethrough: boolean, // Whether the text has a strikethrough
    direction: string,      // Text direction: "ltr" or "rtl"
    kerning: boolean,       // Enable or disable kerning
    ligatures: boolean,     // Enable or disable font ligatures
    tracking: number        // Letter spacing adjustment: -1, 0 (default), or 1
};

Also See: