SheetXL - v1.0.2
    Preparing search index...

    Interface IFontStyle

    How text is drawn: its typeface, size, weight, slant, lines, color, spacing and baseline.

    A cell's font (range.getStyle().getFont()) and the text of a chart part (title.getStyle().getFont() on a title, legend, axis or data labels) are both text styles, so the same code formats either.

    What a style does not state it takes from the text around it: a cell's from the Normal style, a chart title's from the chart, the chart's from the theme. Reads answer what is drawn, stated or not.

    Setters return the text style to keep chaining on. A cell's font is a snapshot of the cell, so its setters return the updated font rather than the one they were called on.

    range.getStyle().getFont().setBold(true).setColor('accent2');
    chart.getTitle().getStyle().getFont().update({ size: 18, family: IFontStyle.ThemeFamily.Heading });
    interface IFontStyle {
        isIFontStyle: true;
        getBaseline(): number;
        getBold(): boolean;
        getColor(): IColor;
        getFallbacks(): string[];
        getFamily(): string;
        getItalic(): boolean;
        getLetterSpacing(): number;
        getSize(): number;
        getStrike(): IFont.StrikeStyle;
        getThemeFamily(): IFontStyle.ThemeFamily | null;
        getUnderline(): IFont.UnderlineStyle;
        getWeight(): number;
        isEqualMeasure(other: IFontStyle): boolean;
        setBaseline(
            baseline: number | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setBold(
            bold: boolean | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setColor(
            color: string | IColor | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setFallbacks(
            fallbacks: string[] | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setFamily(
            family: string | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setItalic(
            italic: boolean | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setLetterSpacing(
            spacing: number | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setSize(
            size: number | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setStrike(
            strike: IFont.StrikeStyle | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setUnderline(
            underline: IFont.UnderlineStyle | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        setWeight(
            weight: number | null,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
        toCSS(mode?: CSSMode, zoom?: number, ignoreNormal?: boolean): Properties;
        toJSON(): IFontStyle.JSON;
        update(
            update: IFontStyle.Update,
            options?: ITransaction.OperationOptions,
        ): IFontStyle;
    }
    Index
    isIFontStyle: true

    For runtime type checking.

    • Returns how far the text is raised, as a percentage of its size: positive for superscript, negative for subscript, 0 on the baseline.

      Returns number

    • Returns whether the text is bold: a weight above 400.

      Returns boolean

    • Returns the families drawn when IFontStyle.getFamily cannot draw a character, in order.

      Returns string[]

    • Returns the typeface drawn: the one stated, or the theme's font when the style names a theme font or none.

      Returns string

    • Returns whether the text is italic.

      Returns boolean

    • Returns the space added between characters, in points; 0 for none, negative to condense.

      Returns number

    • Returns the size in points.

      Returns number

    • Returns the weight, 400 being regular and 700 bold.

      Returns number

    • Returns true when other measures text the same, so a measured width can be reused.

      Parameters

      Returns boolean

    • Returns the style as CSS properties.

      Parameters

      • Optionalmode: CSSMode

        How colors are written.

      • Optionalzoom: number

        Scales the font size.

      • OptionalignoreNormal: boolean

        Leaves out what equals the Normal style's font, where there is one.

      Returns Properties