@json-to-office/shared 1.6.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-4MJFAJFW.js +507 -0
- package/dist/chunk-4MJFAJFW.js.map +1 -0
- package/dist/{chunk-MCUIFSUN.js → chunk-OM2IOZMT.js} +74 -6
- package/dist/chunk-OM2IOZMT.js.map +1 -0
- package/dist/fonts/node.js +1 -1
- package/dist/index.d.ts +1048 -31
- package/dist/index.js +152 -36
- package/dist/index.js.map +1 -1
- package/dist/schemas/slide-content.d.ts +10 -10
- package/dist/schemas/slide-content.js +5 -3
- package/dist/schemas/slide-content.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6KUQYVPT.js +0 -177
- package/dist/chunk-6KUQYVPT.js.map +0 -1
- package/dist/chunk-MCUIFSUN.js.map +0 -1
package/dist/chunk-6KUQYVPT.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
// src/schemas/font-catalog.ts
|
|
2
|
-
import { Type } from "@sinclair/typebox";
|
|
3
|
-
var SAFE_FONTS = [
|
|
4
|
-
"Arial",
|
|
5
|
-
"Calibri",
|
|
6
|
-
"Cambria",
|
|
7
|
-
"Consolas",
|
|
8
|
-
"Courier New",
|
|
9
|
-
"Georgia",
|
|
10
|
-
"Segoe UI",
|
|
11
|
-
"Tahoma",
|
|
12
|
-
"Times New Roman",
|
|
13
|
-
"Trebuchet MS",
|
|
14
|
-
"Verdana",
|
|
15
|
-
"Helvetica",
|
|
16
|
-
"Helvetica Neue",
|
|
17
|
-
"Menlo",
|
|
18
|
-
"Monaco"
|
|
19
|
-
];
|
|
20
|
-
function isSafeFont(name) {
|
|
21
|
-
const lower = name.toLowerCase();
|
|
22
|
-
return SAFE_FONTS.some((f) => f.toLowerCase() === lower);
|
|
23
|
-
}
|
|
24
|
-
var FontFamilyNameSchema = Type.String({
|
|
25
|
-
description: "Font family name. Prefer a SAFE_FONTS entry (Arial, Calibri, Cambria, Consolas, Courier New, Georgia, Segoe UI, Tahoma, Times New Roman, Trebuchet MS, Verdana, Helvetica, Helvetica Neue, Menlo, Monaco) for zero-setup rendering. For any other font, register it in props.fontRegistry[] and reference it here by family. Unregistered non-safe names render with a host fallback.",
|
|
26
|
-
examples: ["Arial", "Calibri", "Georgia", "Inter", "Roboto"]
|
|
27
|
-
});
|
|
28
|
-
var FontWeightSchema = Type.Number({
|
|
29
|
-
minimum: 100,
|
|
30
|
-
maximum: 900,
|
|
31
|
-
description: "OpenType weight (100 thin ... 900 black). Default 400."
|
|
32
|
-
});
|
|
33
|
-
var FontItalicSchema = Type.Boolean({
|
|
34
|
-
description: "Whether this source is italic. Default false."
|
|
35
|
-
});
|
|
36
|
-
var SafeFontSourceSchema = Type.Object(
|
|
37
|
-
{
|
|
38
|
-
kind: Type.Literal("safe"),
|
|
39
|
-
family: Type.String({
|
|
40
|
-
description: "A SAFE_FONTS name \u2014 installed with Office."
|
|
41
|
-
})
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
additionalProperties: false,
|
|
45
|
-
description: "Office-installed font \u2014 no embedding"
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
var GoogleFontSourceSchema = Type.Object(
|
|
49
|
-
{
|
|
50
|
-
kind: Type.Literal("google"),
|
|
51
|
-
family: Type.String({
|
|
52
|
-
description: 'Exact Google Fonts family name (e.g. "Inter").'
|
|
53
|
-
}),
|
|
54
|
-
weights: Type.Optional(
|
|
55
|
-
Type.Array(FontWeightSchema, {
|
|
56
|
-
description: "Weights to fetch. Default [400, 700]."
|
|
57
|
-
})
|
|
58
|
-
),
|
|
59
|
-
italics: Type.Optional(
|
|
60
|
-
Type.Boolean({ description: "Include italic variants. Default false." })
|
|
61
|
-
)
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
additionalProperties: false,
|
|
65
|
-
description: "Google Fonts \u2014 auto-fetched and embedded"
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
var FileFontSourceSchema = Type.Object(
|
|
69
|
-
{
|
|
70
|
-
kind: Type.Literal("file"),
|
|
71
|
-
path: Type.String({
|
|
72
|
-
description: "Path to a .ttf/.otf file. Relative paths are resolved against the JSON document file."
|
|
73
|
-
}),
|
|
74
|
-
weight: Type.Optional(FontWeightSchema),
|
|
75
|
-
italic: Type.Optional(FontItalicSchema)
|
|
76
|
-
},
|
|
77
|
-
{ additionalProperties: false, description: "Local font file to embed" }
|
|
78
|
-
);
|
|
79
|
-
var UrlFontSourceSchema = Type.Object(
|
|
80
|
-
{
|
|
81
|
-
kind: Type.Literal("url"),
|
|
82
|
-
url: Type.String({
|
|
83
|
-
description: "HTTPS URL of a TTF or OTF file."
|
|
84
|
-
}),
|
|
85
|
-
weight: Type.Optional(FontWeightSchema),
|
|
86
|
-
italic: Type.Optional(FontItalicSchema)
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
additionalProperties: false,
|
|
90
|
-
description: "Direct TTF/OTF URL (non-Google CDN)"
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
var VariableFontSourceSchema = Type.Object(
|
|
94
|
-
{
|
|
95
|
-
kind: Type.Literal("variable"),
|
|
96
|
-
url: Type.String({
|
|
97
|
-
description: "HTTPS URL of a variable TTF (`fvar` axis table required)."
|
|
98
|
-
}),
|
|
99
|
-
weight: FontWeightSchema,
|
|
100
|
-
italic: Type.Optional(FontItalicSchema),
|
|
101
|
-
axes: Type.Optional(
|
|
102
|
-
Type.Record(Type.String(), Type.Number(), {
|
|
103
|
-
description: "Additional axis pin values (e.g. `{ ital: 1, opsz: 14 }`) merged on top of the derived `wght` pin. Uncommon \u2014 the `weight` field is usually enough."
|
|
104
|
-
})
|
|
105
|
-
)
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
additionalProperties: false,
|
|
109
|
-
description: "Variable-font instancer. The fetcher pins `wght` to `weight` (plus any `axes` overrides) and emits a clean static TTF, bypassing upstream distributions that collapse multiple static weights onto the same glyph geometry."
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
var DataFontSourceSchema = Type.Object(
|
|
113
|
-
{
|
|
114
|
-
kind: Type.Literal("data"),
|
|
115
|
-
data: Type.String({
|
|
116
|
-
description: "Base64-encoded TTF/OTF or data: URL (data:font/ttf;base64,...). Makes the JSON self-contained at the cost of size."
|
|
117
|
-
}),
|
|
118
|
-
weight: Type.Optional(FontWeightSchema),
|
|
119
|
-
italic: Type.Optional(FontItalicSchema)
|
|
120
|
-
},
|
|
121
|
-
{ additionalProperties: false, description: "Inline base64 font \u2014 portable" }
|
|
122
|
-
);
|
|
123
|
-
var FontSourceSchema = Type.Union(
|
|
124
|
-
[
|
|
125
|
-
SafeFontSourceSchema,
|
|
126
|
-
GoogleFontSourceSchema,
|
|
127
|
-
FileFontSourceSchema,
|
|
128
|
-
DataFontSourceSchema,
|
|
129
|
-
UrlFontSourceSchema,
|
|
130
|
-
VariableFontSourceSchema
|
|
131
|
-
],
|
|
132
|
-
{
|
|
133
|
-
description: 'A single font variant source. Use kind:"safe" for installed fonts, kind:"google" for Google Fonts, kind:"file" for local files, kind:"data" for base64, kind:"url" for direct HTTPS TTF/OTF URLs, kind:"variable" to instance a variable TTF at a specific weight.'
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
var FontCategorySchema = Type.Union(
|
|
137
|
-
[
|
|
138
|
-
Type.Literal("sans"),
|
|
139
|
-
Type.Literal("serif"),
|
|
140
|
-
Type.Literal("mono"),
|
|
141
|
-
Type.Literal("display"),
|
|
142
|
-
Type.Literal("handwriting")
|
|
143
|
-
],
|
|
144
|
-
{ description: "Broad category used for fallback selection" }
|
|
145
|
-
);
|
|
146
|
-
var FontRegistryEntrySchema = Type.Object(
|
|
147
|
-
{
|
|
148
|
-
id: Type.String({
|
|
149
|
-
description: 'Registry key. By convention, match the display family name ("Inter", "Roboto Slab").'
|
|
150
|
-
}),
|
|
151
|
-
family: Type.String({
|
|
152
|
-
description: "Display family used in font.family / fontFace / theme.fonts.*. Usually identical to id."
|
|
153
|
-
}),
|
|
154
|
-
category: Type.Optional(FontCategorySchema),
|
|
155
|
-
sources: Type.Array(FontSourceSchema, {
|
|
156
|
-
minItems: 1,
|
|
157
|
-
description: "One or more weight/style variants. List at least a regular (weight 400, italic false)."
|
|
158
|
-
})
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
additionalProperties: false,
|
|
162
|
-
description: "A font registered for this document. Referenced by family from font.family, fontFace, and theme.fonts.*."
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
var FontRegistrySchema = Type.Array(FontRegistryEntrySchema, {
|
|
166
|
-
description: "Document-scoped font registry. Every non-safe font used in this document must be registered here."
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
export {
|
|
170
|
-
SAFE_FONTS,
|
|
171
|
-
isSafeFont,
|
|
172
|
-
FontFamilyNameSchema,
|
|
173
|
-
FontSourceSchema,
|
|
174
|
-
FontRegistryEntrySchema,
|
|
175
|
-
FontRegistrySchema
|
|
176
|
-
};
|
|
177
|
-
//# sourceMappingURL=chunk-6KUQYVPT.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schemas/font-catalog.ts"],"sourcesContent":["/**\n * Font catalog + registry schemas.\n *\n * Shared by DOCX and PPTX pipelines. Defines:\n * - SAFE_FONTS: Office-safe font names (installed on Windows/macOS with Office).\n * - FontFamilyNameSchema: free-form string for `font.family` / `fontFace`, with LLM-facing guidance.\n * - FontSourceSchema: one binary variant (safe | google | file | data).\n * - FontRegistryEntrySchema / FontRegistrySchema: document-scoped font registry.\n */\n\nimport { Type, Static } from '@sinclair/typebox';\n\n/**\n * Fonts pre-installed with Microsoft Office on Windows + macOS.\n * Using one of these requires no registration and no embedding.\n */\nexport const SAFE_FONTS = [\n 'Arial',\n 'Calibri',\n 'Cambria',\n 'Consolas',\n 'Courier New',\n 'Georgia',\n 'Segoe UI',\n 'Tahoma',\n 'Times New Roman',\n 'Trebuchet MS',\n 'Verdana',\n 'Helvetica',\n 'Helvetica Neue',\n 'Menlo',\n 'Monaco',\n] as const;\n\nexport type SafeFontName = (typeof SAFE_FONTS)[number];\n\n/** Case-insensitive membership test against SAFE_FONTS. */\nexport function isSafeFont(name: string): boolean {\n const lower = name.toLowerCase();\n return SAFE_FONTS.some((f) => f.toLowerCase() === lower);\n}\n\n/**\n * Font family name used in `font.family` / `fontFace`.\n *\n * Stays a free-form string so users can reference custom or Google fonts.\n * Description + examples guide LLMs and JSON Schema consumers toward SAFE_FONTS.\n */\nexport const FontFamilyNameSchema = Type.String({\n description:\n 'Font family name. Prefer a SAFE_FONTS entry (Arial, Calibri, Cambria, Consolas, Courier New, Georgia, Segoe UI, Tahoma, Times New Roman, Trebuchet MS, Verdana, Helvetica, Helvetica Neue, Menlo, Monaco) for zero-setup rendering. For any other font, register it in props.fontRegistry[] and reference it here by family. Unregistered non-safe names render with a host fallback.',\n examples: ['Arial', 'Calibri', 'Georgia', 'Inter', 'Roboto'],\n});\n\n// ----------------------------------------------------------------------------\n// Font sources — one weight/style variant\n// ----------------------------------------------------------------------------\n\nconst FontWeightSchema = Type.Number({\n minimum: 100,\n maximum: 900,\n description: 'OpenType weight (100 thin ... 900 black). Default 400.',\n});\n\nconst FontItalicSchema = Type.Boolean({\n description: 'Whether this source is italic. Default false.',\n});\n\n/** Safe reference — no embedding needed. */\nconst SafeFontSourceSchema = Type.Object(\n {\n kind: Type.Literal('safe'),\n family: Type.String({\n description: 'A SAFE_FONTS name — installed with Office.',\n }),\n },\n {\n additionalProperties: false,\n description: 'Office-installed font — no embedding',\n }\n);\n\n/** Google Fonts — fetched and embedded at generate time. */\nconst GoogleFontSourceSchema = Type.Object(\n {\n kind: Type.Literal('google'),\n family: Type.String({\n description: 'Exact Google Fonts family name (e.g. \"Inter\").',\n }),\n weights: Type.Optional(\n Type.Array(FontWeightSchema, {\n description: 'Weights to fetch. Default [400, 700].',\n })\n ),\n italics: Type.Optional(\n Type.Boolean({ description: 'Include italic variants. Default false.' })\n ),\n },\n {\n additionalProperties: false,\n description: 'Google Fonts — auto-fetched and embedded',\n }\n);\n\n/** Local TTF/OTF file — resolved relative to the JSON file, or absolute. */\nconst FileFontSourceSchema = Type.Object(\n {\n kind: Type.Literal('file'),\n path: Type.String({\n description:\n 'Path to a .ttf/.otf file. Relative paths are resolved against the JSON document file.',\n }),\n weight: Type.Optional(FontWeightSchema),\n italic: Type.Optional(FontItalicSchema),\n },\n { additionalProperties: false, description: 'Local font file to embed' }\n);\n\n/**\n * Direct URL to a TTF/OTF. Used to bypass Google Fonts redistribution for\n * families with known metadata defects — e.g. rsms/inter hosted on jsDelivr.\n * A single URL fetches one variant; multiple URLs build a multi-weight family.\n */\nconst UrlFontSourceSchema = Type.Object(\n {\n kind: Type.Literal('url'),\n url: Type.String({\n description: 'HTTPS URL of a TTF or OTF file.',\n }),\n weight: Type.Optional(FontWeightSchema),\n italic: Type.Optional(FontItalicSchema),\n },\n {\n additionalProperties: false,\n description: 'Direct TTF/OTF URL (non-Google CDN)',\n }\n);\n\n/**\n * Variable-font-instanced variant. Points at a variable TTF URL plus a\n * target weight (and optional additional `axes` pins); the fetcher\n * downloads the variable TTF once (disk-cached) and uses harfbuzz to pin\n * the `wght` axis (plus any additional axes) to produce a clean static\n * TTF for embedding.\n *\n * Used to escape Google Fonts' lossy per-weight static generation — e.g.\n * Google ships Inter Thin and Inter ExtraLight as near-identical glyph\n * files (both sourced around wght=250), but the upstream variable Inter\n * produces properly distinct static instances when pinned precisely at\n * wght=100 vs wght=200.\n */\nconst VariableFontSourceSchema = Type.Object(\n {\n kind: Type.Literal('variable'),\n url: Type.String({\n description: 'HTTPS URL of a variable TTF (`fvar` axis table required).',\n }),\n weight: FontWeightSchema,\n italic: Type.Optional(FontItalicSchema),\n axes: Type.Optional(\n Type.Record(Type.String(), Type.Number(), {\n description:\n 'Additional axis pin values (e.g. `{ ital: 1, opsz: 14 }`) merged on top of the derived `wght` pin. Uncommon — the `weight` field is usually enough.',\n })\n ),\n },\n {\n additionalProperties: false,\n description:\n 'Variable-font instancer. The fetcher pins `wght` to `weight` (plus any `axes` overrides) and emits a clean static TTF, bypassing upstream distributions that collapse multiple static weights onto the same glyph geometry.',\n }\n);\n\n/** Inline base64 / data-URL — self-contained JSON. */\nconst DataFontSourceSchema = Type.Object(\n {\n kind: Type.Literal('data'),\n data: Type.String({\n description:\n 'Base64-encoded TTF/OTF or data: URL (data:font/ttf;base64,...). Makes the JSON self-contained at the cost of size.',\n }),\n weight: Type.Optional(FontWeightSchema),\n italic: Type.Optional(FontItalicSchema),\n },\n { additionalProperties: false, description: 'Inline base64 font — portable' }\n);\n\n/**\n * One weight/style variant backing a font registry entry.\n *\n * Kinds:\n * - safe: references an Office-installed font; no embedding.\n * - google: Google Fonts family; fetched and embedded at generate time.\n * - file: local .ttf/.otf read from disk.\n * - data: inline base64, makes JSON self-contained.\n */\nexport const FontSourceSchema = Type.Union(\n [\n SafeFontSourceSchema,\n GoogleFontSourceSchema,\n FileFontSourceSchema,\n DataFontSourceSchema,\n UrlFontSourceSchema,\n VariableFontSourceSchema,\n ],\n {\n description:\n 'A single font variant source. Use kind:\"safe\" for installed fonts, kind:\"google\" for Google Fonts, kind:\"file\" for local files, kind:\"data\" for base64, kind:\"url\" for direct HTTPS TTF/OTF URLs, kind:\"variable\" to instance a variable TTF at a specific weight.',\n }\n);\n\nexport type FontSource = Static<typeof FontSourceSchema>;\n\n// ----------------------------------------------------------------------------\n// Font registry entry\n// ----------------------------------------------------------------------------\n\nconst FontCategorySchema = Type.Union(\n [\n Type.Literal('sans'),\n Type.Literal('serif'),\n Type.Literal('mono'),\n Type.Literal('display'),\n Type.Literal('handwriting'),\n ],\n { description: 'Broad category used for fallback selection' }\n);\n\nexport const FontRegistryEntrySchema = Type.Object(\n {\n id: Type.String({\n description:\n 'Registry key. By convention, match the display family name (\"Inter\", \"Roboto Slab\").',\n }),\n family: Type.String({\n description:\n 'Display family used in font.family / fontFace / theme.fonts.*. Usually identical to id.',\n }),\n category: Type.Optional(FontCategorySchema),\n sources: Type.Array(FontSourceSchema, {\n minItems: 1,\n description:\n 'One or more weight/style variants. List at least a regular (weight 400, italic false).',\n }),\n },\n {\n additionalProperties: false,\n description:\n 'A font registered for this document. Referenced by family from font.family, fontFace, and theme.fonts.*.',\n }\n);\n\nexport type FontRegistryEntry = Static<typeof FontRegistryEntrySchema>;\n\n/**\n * Document-scoped font registry.\n *\n * Ships with the JSON — no runtime side-channel needed for the common case.\n * Every font name used in font.family / fontFace / theme.fonts.* that isn't\n * in SAFE_FONTS must resolve to an entry here (by family) or tooling warns.\n */\nexport const FontRegistrySchema = Type.Array(FontRegistryEntrySchema, {\n description:\n 'Document-scoped font registry. Every non-safe font used in this document must be registered here.',\n});\n\nexport type FontRegistryDefinition = Static<typeof FontRegistrySchema>;\n"],"mappings":";AAUA,SAAS,YAAoB;AAMtB,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,SAAS,WAAW,MAAuB;AAChD,QAAM,QAAQ,KAAK,YAAY;AAC/B,SAAO,WAAW,KAAK,CAAC,MAAM,EAAE,YAAY,MAAM,KAAK;AACzD;AAQO,IAAM,uBAAuB,KAAK,OAAO;AAAA,EAC9C,aACE;AAAA,EACF,UAAU,CAAC,SAAS,WAAW,WAAW,SAAS,QAAQ;AAC7D,CAAC;AAMD,IAAM,mBAAmB,KAAK,OAAO;AAAA,EACnC,SAAS;AAAA,EACT,SAAS;AAAA,EACT,aAAa;AACf,CAAC;AAED,IAAM,mBAAmB,KAAK,QAAQ;AAAA,EACpC,aAAa;AACf,CAAC;AAGD,IAAM,uBAAuB,KAAK;AAAA,EAChC;AAAA,IACE,MAAM,KAAK,QAAQ,MAAM;AAAA,IACzB,QAAQ,KAAK,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AA,IACJ,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,sBAAsB;AAAA,IACtB,aACE;AAAA,EACJ;AACF;AAWO,IAAM,qBAAqB,KAAK,MAAM,yBAAyB;AAAA,EACpE,aACE;AACJ,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/fonts/sources/ttf-name.ts","../src/fonts/sources/url-allowlist.ts","../src/fonts/sources/format.ts"],"sourcesContent":["/**\n * Name-table rewriting for TTF/OTF sfnt fonts. Two public transforms share\n * the rebuild machinery:\n *\n * - `rewriteFontFamilyName` — rewrite `nameID` 1 / 4 / 6 / 16 to a\n * synthetic family name. Used by the preview-side font stagers so that\n * running-text references like `\"Inter Light\"` resolve to the correct\n * face when the stager registers it with Core Text / fontconfig / GDI\n * (all of which index by the font's internal `name` table rather than\n * the filename).\n *\n * - `rewriteFontSubfamilyNames` — rewrite `nameID` 2 / 17 to the standard\n * subfamily strings for a (weight, italic) pair. Used by the variable-\n * font instancer: harfbuzz preserves the source font's name records\n * verbatim, so an instanced Bold would otherwise keep the variable\n * font's default-instance \"Regular\" subfamily and trip\n * `validateFontMetadata`.\n *\n * Each transform rebuilds the whole font: new `name` table bytes, new\n * table directory with shifted offsets, recomputed per-table checksums,\n * and the magic `head.checkSumAdjustment` recomputed against the whole\n * output buffer. Nothing else is touched.\n *\n * OTF (CFF-flavoured) and TTF (glyf-flavoured) share the sfnt outer\n * structure, so the same code handles both.\n */\n\nconst FAMILY_NAME_IDS = new Set<number>([\n 1, // Font Family\n 4, // Full Font Name\n 6, // PostScript Name\n 16, // Typographic/Preferred Family\n]);\n\nconst MAGIC_HEAD_CHECKSUM = 0xb1b0afba;\n\ninterface NameRecord {\n platformID: number;\n encodingID: number;\n languageID: number;\n nameID: number;\n bytes: Buffer;\n}\n\ninterface TableEntry {\n tag: string;\n checksum: number;\n /** Assigned when rebuilding. */\n offset: number;\n data: Buffer;\n originalOffset: number;\n}\n\n/**\n * Compute the 32-bit big-endian uint sum of `buf`, treating it as a\n * stream of uint32s zero-padded to a 4-byte boundary. Used for per-table\n * checksums and the whole-font `head.checkSumAdjustment`.\n */\nfunction sfntChecksum(buf: Buffer): number {\n let sum = 0;\n const end = buf.length;\n const aligned = end - (end % 4);\n for (let i = 0; i < aligned; i += 4) {\n sum = (sum + buf.readUInt32BE(i)) >>> 0;\n }\n if (aligned < end) {\n let chunk = 0;\n const remaining = end - aligned;\n if (remaining >= 1) chunk |= buf[aligned] << 24;\n if (remaining >= 2) chunk |= buf[aligned + 1] << 16;\n if (remaining >= 3) chunk |= buf[aligned + 2] << 8;\n sum = (sum + chunk) >>> 0;\n }\n return sum >>> 0;\n}\n\nfunction encodeString(record: NameRecord, value: string): Buffer {\n // Platform 3 (Microsoft) and 0 (Unicode) use UTF-16 BE. Platform 1\n // (Macintosh) uses a legacy Roman encoding we approximate with ASCII —\n // non-ASCII family names are rare in this code path.\n if (record.platformID === 1) {\n return Buffer.from(value, 'ascii');\n }\n const out = Buffer.alloc(value.length * 2);\n for (let i = 0; i < value.length; i += 1) {\n out.writeUInt16BE(value.charCodeAt(i), i * 2);\n }\n return out;\n}\n\nfunction buildNameTable(records: NameRecord[]): Buffer {\n const count = records.length;\n const headerSize = 6 + count * 12;\n let heapSize = 0;\n for (const r of records) heapSize += r.bytes.length;\n const raw = Buffer.alloc(headerSize + heapSize);\n raw.writeUInt16BE(0, 0); // format 0\n raw.writeUInt16BE(count, 2);\n raw.writeUInt16BE(headerSize, 4); // stringOffset\n let heapCursor = 0;\n for (let i = 0; i < count; i += 1) {\n const r = records[i];\n const ro = 6 + i * 12;\n raw.writeUInt16BE(r.platformID, ro);\n raw.writeUInt16BE(r.encodingID, ro + 2);\n raw.writeUInt16BE(r.languageID, ro + 4);\n raw.writeUInt16BE(r.nameID, ro + 6);\n raw.writeUInt16BE(r.bytes.length, ro + 8);\n raw.writeUInt16BE(heapCursor, ro + 10);\n r.bytes.copy(raw, headerSize + heapCursor);\n heapCursor += r.bytes.length;\n }\n return raw;\n}\n\n/** Per-record decision for `rewriteNameTable`. */\ntype NameRewrite =\n | { action: 'keep' }\n | { action: 'drop' }\n | { action: 'set'; value: string };\n\n/**\n * Return a copy of `input` whose name records have been mapped through\n * `decide`. Returns the original buffer unchanged if the font has no\n * `name` table or the sfnt header is invalid.\n */\nfunction rewriteNameTable(\n input: Buffer,\n decide: (record: NameRecord) => NameRewrite\n): Buffer {\n if (input.length < 12) return input;\n const version = input.readUInt32BE(0);\n // Accept sfnt (0x00010000), OTTO (OpenType CFF), true, typ1.\n const isSfnt =\n version === 0x00010000 ||\n version === 0x4f54544f /* OTTO */ ||\n version === 0x74727565 /* true */ ||\n version === 0x74797031; /* typ1 */\n if (!isSfnt) return input;\n\n const numTables = input.readUInt16BE(4);\n if (numTables === 0 || input.length < 12 + numTables * 16) return input;\n\n // Read every table's directory entry, slurp its data.\n const tables: TableEntry[] = [];\n for (let i = 0; i < numTables; i += 1) {\n const eo = 12 + i * 16;\n const tag = input.toString('ascii', eo, eo + 4);\n const checksum = input.readUInt32BE(eo + 4);\n const offset = input.readUInt32BE(eo + 8);\n const length = input.readUInt32BE(eo + 12);\n if (offset + length > input.length) return input;\n tables.push({\n tag,\n checksum,\n offset: 0,\n originalOffset: offset,\n data: input.slice(offset, offset + length),\n });\n }\n\n const nameIdx = tables.findIndex((t) => t.tag === 'name');\n if (nameIdx === -1) return input;\n\n // Parse existing name records so we preserve all non-family entries.\n const nameBuf = tables[nameIdx].data;\n if (nameBuf.length < 6) return input;\n // `buildNameTable` emits format 0, which has no language-tag section. A\n // format-1 table keeps its tags after the name records, and any record with\n // languageID >= 0x8000 is an index into them — rewriting it as format 0\n // would strip the tags and leave those records pointing at nothing. Leaving\n // the font unstamped is the lesser loss, so hand it back untouched.\n // Preserving the tag section (and re-homing its string offsets) is the\n // follow-up if a real font ever needs the rewrite.\n if (nameBuf.readUInt16BE(0) !== 0) return input;\n const recordCount = nameBuf.readUInt16BE(2);\n const stringOffset = nameBuf.readUInt16BE(4);\n if (nameBuf.length < 6 + recordCount * 12) return input;\n\n const records: NameRecord[] = [];\n for (let i = 0; i < recordCount; i += 1) {\n const ro = 6 + i * 12;\n const platformID = nameBuf.readUInt16BE(ro);\n const encodingID = nameBuf.readUInt16BE(ro + 2);\n const languageID = nameBuf.readUInt16BE(ro + 4);\n const nameID = nameBuf.readUInt16BE(ro + 6);\n const length = nameBuf.readUInt16BE(ro + 8);\n const offset = nameBuf.readUInt16BE(ro + 10);\n const bytes = nameBuf.slice(\n stringOffset + offset,\n stringOffset + offset + length\n );\n records.push({ platformID, encodingID, languageID, nameID, bytes });\n }\n\n const survivors: NameRecord[] = [];\n for (const r of records) {\n const verdict = decide(r);\n if (verdict.action === 'drop') continue;\n if (verdict.action === 'set') {\n r.bytes = encodeString(r, verdict.value);\n }\n survivors.push(r);\n }\n records.length = 0;\n records.push(...survivors);\n\n const rebuiltName = buildNameTable(records);\n tables[nameIdx] = {\n ...tables[nameIdx],\n data: rebuiltName,\n checksum: sfntChecksum(rebuiltName),\n };\n\n // Preserve original physical order so tables whose offsets follow each\n // other stay contiguous (some consumers skim by offset rather than\n // directory). Offsets get reassigned either way — this is purely\n // aesthetic. Sort is stable.\n tables.sort((a, b) => a.originalOffset - b.originalOffset);\n\n // Assign new offsets, 4-byte aligned.\n let cursor = 12 + tables.length * 16;\n for (const t of tables) {\n cursor = (cursor + 3) & ~3;\n t.offset = cursor;\n cursor += t.data.length;\n }\n const totalSize = (cursor + 3) & ~3;\n\n const out = Buffer.alloc(totalSize);\n // Header — copy sfnt version, entrySelector, etc. verbatim; we preserve\n // numTables since we're not adding/removing entries.\n input.copy(out, 0, 0, 12);\n out.writeUInt16BE(tables.length, 4);\n\n // Directory entries go in alphabetical tag order per the sfnt spec.\n const dirTables = [...tables].sort((a, b) =>\n a.tag < b.tag ? -1 : a.tag > b.tag ? 1 : 0\n );\n for (let i = 0; i < dirTables.length; i += 1) {\n const t = dirTables[i];\n const eo = 12 + i * 16;\n out.write(t.tag, eo, 4, 'ascii');\n out.writeUInt32BE(t.checksum, eo + 4);\n out.writeUInt32BE(t.offset, eo + 8);\n out.writeUInt32BE(t.data.length, eo + 12);\n }\n\n // Write each table's bytes at its new offset. `out` is zero-filled, so\n // the 0–3 byte alignment padding after each table is already correct.\n for (const t of tables) {\n t.data.copy(out, t.offset);\n }\n\n // Recompute head.checkSumAdjustment. The algorithm: zero the field,\n // sum the whole font, then set the field to MAGIC - sum.\n const headTable = tables.find((t) => t.tag === 'head');\n if (headTable && headTable.data.length >= 12) {\n out.writeUInt32BE(0, headTable.offset + 8);\n const fontSum = sfntChecksum(out);\n const adjustment = (MAGIC_HEAD_CHECKSUM - fontSum) >>> 0;\n out.writeUInt32BE(adjustment, headTable.offset + 8);\n }\n\n return out;\n}\n\n/**\n * Return a copy of `input` whose name table has `nameID` 1/4/6/16 rewritten\n * to `newFamily`. Returns the original buffer unchanged if the font has no\n * `name` table or the sfnt header is invalid.\n */\nexport function rewriteFontFamilyName(\n input: Buffer,\n newFamily: string\n): Buffer {\n // PostScript names (nameID 6) are restricted to printable ASCII 33-126\n // minus `[](){}<>/%` per the OpenType spec — fold spaces out and strip\n // any forbidden chars so Word doesn't silently reject the font.\n const psForbidden = /[[\\](){}<>/%]/g;\n // eslint-disable-next-line no-control-regex\n const isAscii = /^[\\x00-\\x7f]*$/.test(newFamily);\n const psName = newFamily\n .replace(/\\s+/g, '')\n .replace(psForbidden, '')\n // eslint-disable-next-line no-control-regex\n .replace(/[^\\x21-\\x7e]/g, '');\n return rewriteNameTable(input, (r) => {\n if (!FAMILY_NAME_IDS.has(r.nameID)) return { action: 'keep' };\n // Platform 1 (Macintosh Roman) only round-trips ASCII. For non-ASCII\n // family names (e.g. CJK), `Buffer.from(value, 'ascii')` silently\n // drops the high bytes and produces garbled Roman-encoded strings\n // that Core Text may still index. Drop those records instead —\n // platforms 0 (Unicode) and 3 (Microsoft) carry the UTF-16 form and\n // are what modern consumers prefer anyway.\n if (r.platformID === 1 && !isAscii) return { action: 'drop' };\n return { action: 'set', value: r.nameID === 6 ? psName : newFamily };\n });\n}\n\nconst STANDARD_SUBFAMILY: Record<number, string> = {\n 100: 'Thin',\n 200: 'ExtraLight',\n 300: 'Light',\n 400: 'Regular',\n 500: 'Medium',\n 600: 'SemiBold',\n 700: 'Bold',\n 800: 'ExtraBold',\n 900: 'Black',\n};\n\n/**\n * Standard OpenType subfamily strings for a (weight, italic) pair, or null\n * for a non-standard weight. `typographic` is the nameID 17 form (full\n * weight vocabulary); `legacy` is the nameID 2 form, restricted to the\n * four-style RIBBI model (Regular/Italic/Bold/Bold Italic) that GDI-era\n * consumers expect. Single source of truth shared with\n * `validateFontMetadata` so writer and checker cannot diverge.\n */\nexport function standardSubfamilyNames(\n weight: number,\n italic: boolean\n): { typographic: string; legacy: string } | null {\n const base = STANDARD_SUBFAMILY[weight];\n if (!base) return null;\n return {\n typographic: italic ? `${base} Italic` : base,\n legacy:\n weight >= 600\n ? italic\n ? 'Bold Italic'\n : 'Bold'\n : italic\n ? 'Italic'\n : 'Regular',\n };\n}\n\n/**\n * Return a copy of `input` whose existing `nameID` 2/17 records carry the\n * standard subfamily strings for (weight, italic). Missing records are not\n * added. Returns the original buffer unchanged for non-standard weights,\n * or if the font has no `name` table or the sfnt header is invalid.\n */\nexport function rewriteFontSubfamilyNames(\n input: Buffer,\n weight: number,\n italic: boolean\n): Buffer {\n const std = standardSubfamilyNames(weight, italic);\n if (!std) return input;\n return rewriteNameTable(input, (r) => {\n if (r.nameID === 2) return { action: 'set', value: std.legacy };\n if (r.nameID === 17) return { action: 'set', value: std.typographic };\n return { action: 'keep' };\n });\n}\n","/**\n * Hostname allowlist for font fetchers.\n *\n * `url-fetcher` and `variable-fetcher` can be handed arbitrary URLs via\n * `FontRegistryEntry.sources`, which may originate from document JSON. Without\n * a guard, a malicious doc could point fetchers at internal hosts (SSRF), the\n * filesystem (`file://`), or the IMDS endpoint. Limit downloads to the hosts\n * our catalog + UPSTREAM_OVERRIDES actually target.\n *\n * Keep the list small and HTTPS-only. Expansions should be deliberate code\n * reviews, not config-driven — the cost of a new domain is the code change.\n */\n\nexport const FONT_URL_ALLOWLIST: readonly string[] = [\n 'fonts.gstatic.com',\n 'fonts.googleapis.com',\n 'cdn.jsdelivr.net',\n];\n\nexport function isAllowedFontUrl(url: string): boolean {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return false;\n }\n if (parsed.protocol !== 'https:') return false;\n return FONT_URL_ALLOWLIST.includes(parsed.hostname.toLowerCase());\n}\n","/**\n * Font format detection from magic bytes.\n * Source: OpenType spec + WOFF1/WOFF2 W3C specs.\n */\n\nimport type { ResolvedFontSource } from '../types';\n\nexport function detectFontFormat(buf: Buffer): ResolvedFontSource['format'] {\n if (buf.length < 4) return 'unknown';\n\n const b0 = buf[0],\n b1 = buf[1],\n b2 = buf[2],\n b3 = buf[3];\n\n // TTF: 0x00010000 (SFNT) or 'true' (0x74727565) or 'typ1' (0x74797031)\n if (\n (b0 === 0x00 && b1 === 0x01 && b2 === 0x00 && b3 === 0x00) ||\n (b0 === 0x74 && b1 === 0x72 && b2 === 0x75 && b3 === 0x65) ||\n (b0 === 0x74 && b1 === 0x79 && b2 === 0x70 && b3 === 0x31)\n ) {\n return 'ttf';\n }\n // OTF: 'OTTO'\n if (b0 === 0x4f && b1 === 0x54 && b2 === 0x54 && b3 === 0x4f) return 'otf';\n // WOFF: 'wOFF'\n if (b0 === 0x77 && b1 === 0x4f && b2 === 0x46 && b3 === 0x46) return 'woff';\n // WOFF2: 'wOF2'\n if (b0 === 0x77 && b1 === 0x4f && b2 === 0x46 && b3 === 0x32) return 'woff2';\n // EOT: version bytes at offset 8-11 — rougher signature\n if (buf.length >= 36 && buf[34] === 0x4c && buf[35] === 0x50) return 'eot';\n // PostScript Type 1 (.pfb) — binary container marker byte 0x80 followed by\n // segment type 0x01 (ASCII). Also match the text-form ASCII header\n // \"%!PS-AdobeFont\". Note: .pfm (metric files) have no reliable magic and\n // stay in 'unknown' — same treatment (rejection at the loader).\n if (b0 === 0x80 && b1 === 0x01) return 'pfb';\n if (\n buf.length >= 14 &&\n buf.slice(0, 14).toString('ascii') === '%!PS-AdobeFont'\n ) {\n return 'pfb';\n }\n\n return 'unknown';\n}\n\n/**\n * Formats we detect but cannot legally embed in an OOXML document:\n * WOFF/WOFF2 are web-only containers; PostScript (.pfb) is explicitly\n * disallowed by Microsoft's embedding guidance.\n */\nexport const UNEMBEDDABLE_FORMATS = new Set<ResolvedFontSource['format']>([\n 'woff',\n 'woff2',\n 'pfb',\n]);\n"],"mappings":";AA2BA,IAAM,kBAAkB,oBAAI,IAAY;AAAA,EACtC;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;AAED,IAAM,sBAAsB;AAwB5B,SAAS,aAAa,KAAqB;AACzC,MAAI,MAAM;AACV,QAAM,MAAM,IAAI;AAChB,QAAM,UAAU,MAAO,MAAM;AAC7B,WAAS,IAAI,GAAG,IAAI,SAAS,KAAK,GAAG;AACnC,UAAO,MAAM,IAAI,aAAa,CAAC,MAAO;AAAA,EACxC;AACA,MAAI,UAAU,KAAK;AACjB,QAAI,QAAQ;AACZ,UAAM,YAAY,MAAM;AACxB,QAAI,aAAa,EAAG,UAAS,IAAI,OAAO,KAAK;AAC7C,QAAI,aAAa,EAAG,UAAS,IAAI,UAAU,CAAC,KAAK;AACjD,QAAI,aAAa,EAAG,UAAS,IAAI,UAAU,CAAC,KAAK;AACjD,UAAO,MAAM,UAAW;AAAA,EAC1B;AACA,SAAO,QAAQ;AACjB;AAEA,SAAS,aAAa,QAAoB,OAAuB;AAI/D,MAAI,OAAO,eAAe,GAAG;AAC3B,WAAO,OAAO,KAAK,OAAO,OAAO;AAAA,EACnC;AACA,QAAM,MAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACzC,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;AACxC,QAAI,cAAc,MAAM,WAAW,CAAC,GAA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