import catalog from "./font-catalog.json"; export type CaptionFont = { id: string; name: string; family: string; file: string; common: boolean; recommended: boolean; google: boolean; url?: string; sha256?: string; preparedSha256?: string; }; /** Same packaged font bytes are used in browser previews and FFmpeg exports. */ const bundledFonts: CaptionFont[] = [ { id: "source-han", name: "Source Han Sans CN", family: "Source Han Sans SC", file: "source-han.otf", common: true, recommended: true, google: false, }, { id: "noto-sans-sc", name: "Noto Sans SC", family: "Noto Sans SC", file: "noto-sans-sc.ttf", common: true, recommended: true, google: true, }, { id: "noto-serif-sc", name: "Noto Serif SC", family: "Noto Serif SC", file: "noto-serif-sc.ttf", common: true, recommended: true, google: true, }, { id: "roboto", name: "Roboto", family: "Roboto", file: "roboto.ttf", common: true, recommended: false, google: true, }, { id: "inter", name: "Inter", family: "Inter", file: "inter.ttf", common: true, recommended: false, google: true, }, ]; export const captionFonts: CaptionFont[] = [...bundledFonts, ...catalog]; const byId = new Map(captionFonts.map((font) => [font.id, font])); export const captionFont = (id?: string) => byId.get(id || "");