UNPKG

@lightningjs/renderer

Version:
27 lines (26 loc) 1.82 kB
import type { WrappedLinesStruct } from '../TextRenderer.js'; export declare const measureLines: (lines: string[], fontFamily: string, letterSpacing: number, fontScale: number, maxLines: number, hasMaxLines: boolean) => WrappedLinesStruct; /** * Wrap text for SDF rendering with proper width constraints */ export declare const wrapText: (text: string, fontFamily: string, fontScale: number, maxWidth: number, letterSpacing: number, overflowSuffix: string, wordBreak: string, maxLines: number, hasMaxLines: boolean) => WrappedLinesStruct; /** * Wrap a single line of text for SDF rendering */ export declare const wrapLine: (line: string, fontFamily: string, maxWidth: number, designLetterSpacing: number, spaceWidth: number, overflowSuffix: string, wordBreak: string, remainingLines: number, hasMaxLines: boolean) => WrappedLinesStruct; /** * Measure the width of text in SDF design units */ export declare const measureText: (text: string, fontFamily: string, designLetterSpacing: number) => number; /** * Truncate a line with overflow suffix to fit within width */ export declare const truncateLineWithSuffix: (line: string, fontFamily: string, maxWidth: number, designLetterSpacing: number, overflowSuffix: string) => string; /** * wordbreak function: https://developer.mozilla.org/en-US/docs/Web/CSS/word-break#break-word */ export declare const breakWord: (word: string, fontFamily: string, maxWidth: number, designLetterSpacing: number, remainingLines: number, hasMaxLines: boolean) => WrappedLinesStruct; /** * wordbreak function: https://developer.mozilla.org/en-US/docs/Web/CSS/word-break#break-word */ export declare const breakAll: (word: string, fontFamily: string, initial: number, maxWidth: number, designLetterSpacing: number, remainingLines: number, hasMaxLines: boolean) => WrappedLinesStruct;