@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
50 lines • 2.01 kB
TypeScript
import { VerticalTextAlignment } from "../text/types";
/**
* Advanced text metrics.
*/
export interface ExtendedTextMetrics extends Partial<TextMetrics>, Partial<FontMetrics> {
/**
* This is the lineHeight and includes the lineGap
*/
readonly lineHeight: number;
}
export interface FontMetrics {
readonly underlinePosition?: number;
readonly underlineThickness?: number;
readonly strikePosition?: number;
readonly strikeThickness?: number;
readonly italicAngle?: number;
readonly lineHeight: number;
readonly baseline: number;
readonly lineGap: number;
}
export declare const MIN_FONT_SIZE = 1;
export declare const MAX_FONT_SIZE = 409;
export declare const MAX_FONT_PRECISION = 1;
export declare const DEFAULT_LINE_HEIGHT_MULTIPLIER = 1.2;
export declare const FONT_SIZES_EXCEL: number[];
export declare const findNextFontSize: (size: number, increase?: boolean, steps?: number[]) => number;
export declare const defaultHorizontalPadding: (fontSize: number) => number;
export declare const defaultVerticalPadding: (_fontSize: number) => number;
export interface TextMetricOptions {
isBold?: boolean;
isItalic?: boolean;
letterSpacing?: number;
}
export interface TextMeasurer {
(text: string, size: number, family: string, options?: TextMetricOptions): ExtendedTextMetrics;
}
export declare const setDefaultTextMeasurer: (measurer: TextMeasurer) => void;
export declare const getDefaultTextMeasurer: () => TextMeasurer;
export declare const fontScale: () => number;
/**
* @remarks
*
* This information is encoded in the font file but not available in the browser in an easy to get way.
*
* @param fontFamily
* @returns 'the number to scale the font size by to get the super/subscript font size'
*/
export declare const superSubScale: (_fontFamily: string) => number;
export declare const superSubShift: (fontFamily: string, fontSize: number, verticalAlign: VerticalTextAlignment) => number;
//# sourceMappingURL=FontUtils.d.ts.map