import * as fontkit from 'fontkit'; export type Font = Omit & { type: 'TTF' | 'WOFF' | 'WOFF2' | 'STANDARD'; encode?: (string: string) => number[]; }; export type FontStyle = 'normal' | 'italic' | 'oblique'; export type FontWeight = | number | 'thin' | 'hairline' | 'ultralight' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'demibold' | 'bold' | 'ultrabold' | 'extrabold' | 'heavy' | 'black' | `${number}`; export type FontDescriptor = { fontFamily: string; fontStyle?: FontStyle; fontWeight?: FontWeight; }; export type RemoteOptions = { method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; headers?: Record; body?: any; }; export type FontSourceOptions = { postscriptName?: string; } & RemoteOptions; export type FontSourceData = Uint8Array | ArrayBuffer; export type FontSource = { src: string | FontSourceData; fontStyle?: FontStyle; fontWeight?: FontWeight; } & FontSourceOptions; export type SingleLoad = { family: string; } & FontSource; export type BulkLoad = { family: string; fonts: FontSource[]; }; interface EmojiSourceUrl { url: string; format?: string; withVariationSelectors?: boolean; } interface EmojiSourceBuilder { builder: (code: string) => string; withVariationSelectors?: boolean; } export type EmojiSource = EmojiSourceUrl | EmojiSourceBuilder; export type HyphenatedPart = { string: string; hyphen?: '-' | null; }; export type HyphenatedWord = (string | HyphenatedPart)[]; export type HyphenationCallback = ( word: string, fallback: (word: string) => string[], ) => HyphenatedWord;