UNPKG

@sheetxl/models

Version:

Models - A Headless javascript spreadsheet library.

91 lines 2.84 kB
import { SerializableProperties } from "../primitives"; import { VerticalTextAlignment } from "../text/types"; import { FontStyle, FontScheme, UnderlineStyle } from "../font"; import { AdjustedColor } from "../color"; export interface FontValues { /** * This can be set as a string using html values such as 'Arial 11pt' but will be resolved to a single font. Fallbacks and fontSize will be * marshalled into their correct property. */ family: string; /** * A list of fonts and their fallbacks. These can also be provided in the fontFamily attribute but will * be normalized to here. */ familyFallbacks: string[]; /** * Font size is either a number in points or a string that can be converted such as '14px', '1.5em'. */ size: number; /** * The weight of the characters. * @remarks * 700 or above is considered bold. */ weight: number; /** * @defaultValue normal */ style: FontStyle; /** * The text color. * @remarks * Currently only solid fill is supported but this will be expanded to allow all fill types similar to DrawML. * TODO - allow this to be any fill style like DrawML */ fill: AdjustedColor; /** * Adds or removes additional spacing between the characters. */ letterSpacing: number; /** * Sets the underline style. If true defaults to single. If false or null defaults to none. * @defaultValue UnderlineStyle.None */ underline: boolean | UnderlineStyle | null; /** * The effect draws the text with a line through it. */ strike: boolean; /** * Defines the font scheme to use. * @default * FontScheme.Minor */ scheme: FontScheme; /** * @remarks * If the VerticalTextAlign is superscript or subscript then the font size should also render smaller. */ verticalAlign: VerticalTextAlignment; /** * The effect draws a shadow around the text. * @remarks * Not rendered by Excel or SheetXL. */ shadow: boolean; /** * The effect draws the text as an outline. * @remarks * Not rendered by Excel or SheetXL. */ outline: boolean; /** * The effect extends or stretches out the text. * @remarks * Not rendered by Excel or SheetXL. */ extend: boolean; } export interface IFont extends Omit<Readonly<FontValues>, "underline"> { underline: UnderlineStyle; readonly isIFont: true; /** * Compare against another font to see if they will have the same font measure * This is used to optimize updates by not re-calcing the width/height * @param other */ isEqualMeasure(other: IFont): boolean; toJSON(): SerializableProperties<FontValues>; } //# sourceMappingURL=IFont.d.ts.map