Export fonts
ChartExportFontFace, ChartExportFontFamily, ChartExportFonts, ChartExportFontSource: generated from the source of active-charts.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Types#
One font file of a family.
interface ChartExportFontFace {
source: ChartExportFontSource;
weight?: number;
style?: 'normal' | 'italic';
}A host font family, under the host's own name.
interface ChartExportFontFamily {
family: string;
faces: readonly ChartExportFontFace[];
}The fonts of a visual export: the primary family first, then the fallback families in the order the host wants them tried. One set serves every visual format:
- PDF draws each text element in the first family that covers all of it and refuses text none covers.
- SVG names the families, in order, before the live chart's own font stack, and embeds their faces only with
embed.In Svg - PNG embeds every face of every family and rasterises with the same family order, so the browser falls back per glyph across the host's families before any system font.
The chart is never laid out again in these fonts: it keeps the geometry of the live font, so a family with other metrics can shift or clip text. Put the live family first for the closest result.
interface ChartExportFonts {
families: readonly ChartExportFontFamily[];
embedInSvg?: boolean;
}The bytes of one font file, or a loader the package calls once, before the export's capture moment, when an export needs the face. The host's loader owns the network, its timeout, retries and credentials; the package never takes a URL.
type ChartExportFontSource =
ArrayBuffer | Uint8Array | (() => Promise<ArrayBuffer | Uint8Array>);