import { type FontWidthMap } from '../components/text-ellipsis/chars-font-width-map.js'; import type { TextSize } from '../types/text-size.js'; /** * A function that measures the pixel width of a string at a given font size. * @internal */ export type TextMeasurer = (text: string, fontSize: number) => number; /** * Resolves the {@link FontWidthMap} to use when measuring at a given font * size. Charts supply their own resolver because the appropriate weight (and * therefore the appropriate map) depends on the chart-specific typography. * @internal */ export type FontWidthMapResolver = (fontSize: number) => FontWidthMap; /** * Options for {@link getTextMeasurer}. * @internal */ export interface GetTextMeasurerOptions { /** Font weight applied when falling back to canvas measurement. */ fontWeight: number; /** Resolves which lookup map to use for preset/auto sizes. */ resolveMap?: FontWidthMapResolver; } /** * Returns the appropriate {@link TextMeasurer} for the given text size. * * When `textSize` is `'auto'` or one of the preset font sizes defined in * {@link AUTO_TEXT_SIZE_PRESETS}, a fast lookup-table measurer is returned. * Otherwise a measurer backed by `CanvasRenderingContext2D.measureText` is * returned for accurate results with arbitrary font sizes. * @internal */ export declare const getTextMeasurer: (ctx: CanvasRenderingContext2D, textSize: TextSize, options: GetTextMeasurerOptions) => TextMeasurer;