UNPKG

@sheetxl/models

Version:

Models - A Headless javascript spreadsheet library.

72 lines 1.79 kB
import { TextMeasurer } from '../font/FontUtils'; /** * Very simple Text Line Wrapper. Is not useful for Rich Text. see @TextLayout * */ export interface TextWrapperOptions { fontName: string; fontSize: number; maxWidth?: number; maxHeight?: number; /** * defaults to 0 */ letterSpacing?: number; bold?: boolean; italic?: boolean; /** * If the text is a superscript or a subscript. * This affects the width but not the height of the line. */ superSub?: boolean; indent?: number; } export interface TextWrapperResults { bounds: { x: number; y: number; width: number; widthWhitespace: number; height: number; }; lines: Line[]; } export interface Line { text: string; startPosition: number; x: number; y: number; width: number; widthWhitespace: number; height: number; baseline: number; } export interface onLine { (line: Line): boolean | void; } export declare const linesToText: (lines: Line[], trimTrailingSpace?: boolean) => string; export declare class TextWrapper { private _textMeasurer; private _breaker; private _lastBreak; private _charactersRead; private _linesRead; private _maxXRead; private _maxXWhitespaceRead; private _maxYRead; private _fontName; private _fontSize; private _metricOptions; private _indent; private _isSuperSub; private _ellipsis; private _maxWidth; private _maxHeight; constructor(textMeasurer: TextMeasurer); private _measureText; private _breakWord; private _breakWhiteSpace; wrap(text: string, options?: TextWrapperOptions): TextWrapperResults; } export default TextWrapper; //# sourceMappingURL=TextWrapper.d.ts.map