meo-skia-canvas
    Preparing search index...

    Interface TextStyleInput

    🧪 Not in the HTML Canvas standard.

    interface TextStyleInput {
        backgroundColor?: Color4fInput;
        color?: Color4fInput;
        decoration?: number;
        decorationColor?: Color4fInput;
        decorationStyle?: TextDecorationStyleValue;
        decorationThickness?: number;
        fontFamilies?: string[];
        fontFeatures?: TextFontFeatures[];
        fontSize?: number;
        fontStyle?: { slant?: number; weight?: number; width?: number };
        fontVariations?: FontVariationInput[];
        foregroundColor?: Color4fInput;
        halfLeading?: boolean;
        heightMultiplier?: number;
        letterSpacing?: number;
        shadows?: TextShadowInput[];
        wordSpacing?: number;
    }
    Index
    backgroundColor?: Color4fInput

    Color painted behind the run's glyphs.

    color?: Color4fInput

    Fill color for the glyphs. Defaults to black.

    decoration?: number

    Which lines to draw. Combine with |: Underline | LineThrough.

    decorationColor?: Color4fInput

    Color of the decoration lines. Defaults to the text color.

    decorationStyle?: TextDecorationStyleValue

    How those lines are drawn. Anything outside the set draws as Solid.

    decorationThickness?: number

    Line thickness as a multiple of the font's own decoration thickness.

    fontFamilies?: string[]

    Families to match, in preference order, as ctx.font lists them.

    fontFeatures?: TextFontFeatures[]

    OpenType features applied to the run: small caps (smcp/c2sc), ligatures (liga/dlig), oldstyle/tabular/proportional figures (onum/lnum/tnum/pnum), slashed zero (zero), stylistic sets (ss01...ss20), and so on. The Canvas2D fontVariant path exposes these too; this is the rich-text/paragraph equivalent.

    fontSize?: number

    Type size in pixels.

    fontStyle?: { slant?: number; weight?: number; width?: number }

    Face selection within the families: CSS numeric weight (400 normal, 700 bold), CSS numeric width (1 ultra-condensed through 9 ultra-expanded), and slant as 0 upright, 1 italic, 2 oblique. Each defaults to normal when left out.

    Type Declaration

    • Optionalslant?: number

      Slant in degrees, for a font with a variable slant axis.

    • Optionalweight?: number

      Weight on the CSS scale, 100 to 900.

    • Optionalwidth?: number

      Width as a percentage of normal, where 100 is unstretched.

    fontVariations?: FontVariationInput[]

    Explicit variable-font axis positions. When set, the paragraph engine instantiates the matched typeface at these axis values instead of relying on the nominal weight match -- match CanvasKit's behaviour where the variable axes are honoured precisely.

    Each entry must carry a 4-character ASCII axis tag; values are clamped to the typeface's declared min/max for that axis. Entries referring to axes the typeface doesn't expose are silently dropped.

    foregroundColor?: Color4fInput

    Fill color for the glyphs, taking precedence over color where both are given. The two are separate in CanvasKit and kept separate here.

    halfLeading?: boolean

    Distribute the run's leading half above and half below the text, centring it within the line box. Mirrors CanvasKit's TextStyle.halfLeading.

    heightMultiplier?: number

    Line height as a multiple of fontSize, replacing the font's own metrics. Setting it at all turns on the override.

    letterSpacing?: number

    Extra space added after each glyph, in pixels.

    shadows?: TextShadowInput[]

    Shadows painted under the run, in the order given -- several are allowed, unlike the context's single shadowColor.

    wordSpacing?: number

    Extra space added at each word boundary, in pixels.