@meltemi/diagrams-fonts 0.0.0-stage → 1.9.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Architecture Studio contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @meltemi/diagrams-fonts
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The bundled open fonts (Inter, IBM Plex Sans and Cascadia Mono, under the SIL Open Font
4
+ Licence), text measurement for layout, subsetting for embedded SVG fonts and text outlines. The
5
+ `./node` entry reads the font files from the installed font packages.
6
+
7
+ It is part of [Meltemi Diagrams](https://github.com/askenaz-dev/meltemi-diagrams#readme), diagrams as code with a canvas, motion and
8
+ exports. Every package of the product has the same version.
9
+
10
+ ## Install
11
+
12
+ ```bash
13
+ npm install @meltemi/diagrams-fonts
14
+ ```
15
+
16
+ Node 22.12.0 or later. The package is an ES module with type declarations.
17
+
18
+ ## Use
19
+
20
+ ```ts
21
+ import { createNodeFontLibrary } from "@meltemi/diagrams-fonts/node";
22
+
23
+ const fonts = createNodeFontLibrary();
24
+ // The width of a label in Inter 600 at 14 px, as the layout measures it.
25
+ console.log(fonts.width("Orders API", "Inter", 600, 14) > 0); // true
26
+ ```
27
+
28
+ ## Documentation
29
+
30
+ - [Fonts](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/language/fonts.md)
31
+ - [All documentation](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/docs/README.md)
32
+
33
+ ## Licence
34
+
35
+ MIT. Third-party components and their licences are listed in [THIRD_PARTY_LICENSES.md](https://github.com/askenaz-dev/meltemi-diagrams/blob/main/THIRD_PARTY_LICENSES.md).
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A bundled font family. Text is measured and outlined with the complete font files when the
3
+ * family has them (every glyph, kerning across scripts). It is embedded with the small Fontsource
4
+ * script subsets, so exported files stay light.
5
+ */
6
+ export interface BundledFamily {
7
+ readonly family: string;
8
+ /** Fontsource package with script subsets (`files/<prefix>-<subset>-<weight>-normal.woff2`). */
9
+ readonly subsets: {
10
+ readonly package: string;
11
+ readonly prefix: string;
12
+ };
13
+ /** Complete font files by weight, as package-relative paths. */
14
+ readonly complete: Readonly<Record<number, string>> | null;
15
+ readonly weights: readonly number[];
16
+ }
17
+ export declare const BUNDLED_FAMILIES: readonly BundledFamily[];
18
+ /** Families tried, in order, for characters the requested family does not have. */
19
+ export declare const FALLBACK_FAMILIES: readonly ["Inter", "IBM Plex Sans"];
20
+ /** Packages whose files a font reader must provide. */
21
+ export declare const FONT_PACKAGES: readonly ["@fontsource/inter", "@fontsource/ibm-plex-sans", "@fontsource/cascadia-mono", "inter-ui", "@ibm/plex-sans"];
22
+ /** The first family of a CSS font stack that is bundled, matched without quotes or case. */
23
+ export declare function resolveFontStack(stack: string): string | undefined;
24
+ export declare function bundledFamily(family: string): BundledFamily | undefined;
25
+ /** The bundled weight closest to `weight`; ties go to the heavier one. */
26
+ export declare function nearestWeight(family: BundledFamily, weight: number): number;
27
+ /** Parses a CSS `unicode-range` value such as `U+0000-00FF,U+0131` into inclusive ranges. */
28
+ export declare function parseUnicodeRange(value: string): [number, number][];
29
+ /** Formats code points as a compact CSS `unicode-range` (`U+41-43,U+61`). */
30
+ export declare function formatUnicodeRange(codePoints: Iterable<number>): string;
31
+ //# sourceMappingURL=families.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"families.d.ts","sourceRoot":"","sources":["../src/families.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACxE,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,gBAAgB,EAAE,SAAS,aAAa,EA6BpD,CAAC;AAEF,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,qCAAsC,CAAC;AAErE,uDAAuD;AACvD,eAAO,MAAM,aAAa,wHAMhB,CAAC;AAEX,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAUlE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEvE;AAED,0EAA0E;AAC1E,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAS3E;AAED,6FAA6F;AAC7F,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAgBnE;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAYvE"}
@@ -0,0 +1,103 @@
1
+ export const BUNDLED_FAMILIES = [
2
+ {
3
+ family: "Inter",
4
+ subsets: { package: "@fontsource/inter", prefix: "inter" },
5
+ complete: {
6
+ 400: "inter-ui/web/Inter-Regular.woff2",
7
+ 500: "inter-ui/web/Inter-Medium.woff2",
8
+ 600: "inter-ui/web/Inter-SemiBold.woff2",
9
+ 700: "inter-ui/web/Inter-Bold.woff2",
10
+ },
11
+ weights: [400, 500, 600, 700],
12
+ },
13
+ {
14
+ family: "IBM Plex Sans",
15
+ subsets: { package: "@fontsource/ibm-plex-sans", prefix: "ibm-plex-sans" },
16
+ complete: {
17
+ 400: "@ibm/plex-sans/fonts/complete/woff2/IBMPlexSans-Regular.woff2",
18
+ 500: "@ibm/plex-sans/fonts/complete/woff2/IBMPlexSans-Medium.woff2",
19
+ 600: "@ibm/plex-sans/fonts/complete/woff2/IBMPlexSans-SemiBold.woff2",
20
+ 700: "@ibm/plex-sans/fonts/complete/woff2/IBMPlexSans-Bold.woff2",
21
+ },
22
+ weights: [400, 500, 600, 700],
23
+ },
24
+ {
25
+ family: "Cascadia Mono",
26
+ subsets: { package: "@fontsource/cascadia-mono", prefix: "cascadia-mono" },
27
+ complete: null,
28
+ weights: [400, 500, 600, 700],
29
+ },
30
+ ];
31
+ /** Families tried, in order, for characters the requested family does not have. */
32
+ export const FALLBACK_FAMILIES = ["Inter", "IBM Plex Sans"];
33
+ /** Packages whose files a font reader must provide. */
34
+ export const FONT_PACKAGES = [
35
+ "@fontsource/inter",
36
+ "@fontsource/ibm-plex-sans",
37
+ "@fontsource/cascadia-mono",
38
+ "inter-ui",
39
+ "@ibm/plex-sans",
40
+ ];
41
+ /** The first family of a CSS font stack that is bundled, matched without quotes or case. */
42
+ export function resolveFontStack(stack) {
43
+ for (const part of stack.split(",")) {
44
+ const name = part
45
+ .trim()
46
+ .replace(/^["']|["']$/g, "")
47
+ .toLowerCase();
48
+ const family = BUNDLED_FAMILIES.find((f) => f.family.toLowerCase() === name);
49
+ if (family)
50
+ return family.family;
51
+ }
52
+ return undefined;
53
+ }
54
+ export function bundledFamily(family) {
55
+ return BUNDLED_FAMILIES.find((f) => f.family === family);
56
+ }
57
+ /** The bundled weight closest to `weight`; ties go to the heavier one. */
58
+ export function nearestWeight(family, weight) {
59
+ let best = family.weights[0];
60
+ for (const candidate of family.weights) {
61
+ const distance = Math.abs(candidate - weight);
62
+ const bestDistance = Math.abs(best - weight);
63
+ if (distance < bestDistance || (distance === bestDistance && candidate > best))
64
+ best = candidate;
65
+ }
66
+ return best;
67
+ }
68
+ /** Parses a CSS `unicode-range` value such as `U+0000-00FF,U+0131` into inclusive ranges. */
69
+ export function parseUnicodeRange(value) {
70
+ const ranges = [];
71
+ for (const part of value.split(",")) {
72
+ const match = /^\s*U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f]+))?\s*$/.exec(part);
73
+ if (!match)
74
+ continue;
75
+ if (match[1].includes("?")) {
76
+ ranges.push([
77
+ parseInt(match[1].replace(/\?/g, "0"), 16),
78
+ parseInt(match[1].replace(/\?/g, "F"), 16),
79
+ ]);
80
+ }
81
+ else {
82
+ const start = parseInt(match[1], 16);
83
+ ranges.push([start, match[2] ? parseInt(match[2], 16) : start]);
84
+ }
85
+ }
86
+ return ranges;
87
+ }
88
+ /** Formats code points as a compact CSS `unicode-range` (`U+41-43,U+61`). */
89
+ export function formatUnicodeRange(codePoints) {
90
+ const sorted = [...new Set(codePoints)].sort((a, b) => a - b);
91
+ const parts = [];
92
+ let i = 0;
93
+ while (i < sorted.length) {
94
+ let j = i;
95
+ while (j + 1 < sorted.length && sorted[j + 1] === sorted[j] + 1)
96
+ j++;
97
+ const hex = (n) => n.toString(16).toUpperCase();
98
+ parts.push(i === j ? `U+${hex(sorted[i])}` : `U+${hex(sorted[i])}-${hex(sorted[j])}`);
99
+ i = j + 1;
100
+ }
101
+ return parts.join(",");
102
+ }
103
+ //# sourceMappingURL=families.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"families.js","sourceRoot":"","sources":["../src/families.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD;QACE,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,OAAO,EAAE;QAC1D,QAAQ,EAAE;YACR,GAAG,EAAE,kCAAkC;YACvC,GAAG,EAAE,iCAAiC;YACtC,GAAG,EAAE,mCAAmC;YACxC,GAAG,EAAE,+BAA+B;SACrC;QACD,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;KAC9B;IACD;QACE,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,eAAe,EAAE;QAC1E,QAAQ,EAAE;YACR,GAAG,EAAE,+DAA+D;YACpE,GAAG,EAAE,8DAA8D;YACnE,GAAG,EAAE,gEAAgE;YACrE,GAAG,EAAE,4DAA4D;SAClE;QACD,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;KAC9B;IACD;QACE,MAAM,EAAE,eAAe;QACvB,OAAO,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,EAAE,eAAe,EAAE;QAC1E,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;KAC9B;CACF,CAAC;AAEF,mFAAmF;AACnF,M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C,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAE,GAAG,CAAC;YAAE,CAAC,EAAE,CAAC;QACtE,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACxD,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC;QACzF,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACZ,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const PACKAGE_NAME = "@meltemi/diagrams-fonts";
2
+ export * from "./families.js";
3
+ export * from "./library.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,4BAA4B,CAAC;AAEtD,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export const PACKAGE_NAME = "@meltemi/diagrams-fonts";
2
+ export * from "./families.js";
3
+ export * from "./library.js";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAEtD,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Reads a file of a bundled font package by its package-relative path, such as
3
+ * `@fontsource/inter/unicode.json` or `inter-ui/web/Inter-Regular.woff2`.
4
+ */
5
+ export type FontFileReader = (path: string) => Uint8Array | undefined;
6
+ export type FontFormat = "woff2" | "woff" | "truetype" | "opentype";
7
+ /**
8
+ * A font file to embed as an `@font-face` rule: a bundled WOFF2 subset limited by `unicodeRange`
9
+ * to the characters used, or a whole project font with an empty `unicodeRange`.
10
+ */
11
+ export interface EmbeddedFace {
12
+ readonly family: string;
13
+ readonly weight: number;
14
+ readonly subset: string;
15
+ readonly format: FontFormat;
16
+ readonly data: Uint8Array;
17
+ readonly unicodeRange: string;
18
+ }
19
+ /** A font of a project's `assets/fonts/`, as registered with `addFont`. */
20
+ export interface ProjectFont {
21
+ readonly family: string;
22
+ readonly weight: number;
23
+ readonly style: "normal" | "italic";
24
+ readonly format: FontFormat;
25
+ /** True when the font's `fsType` forbids embedding; it is used for measurement only. */
26
+ readonly restricted: boolean;
27
+ readonly source: string;
28
+ }
29
+ export type AddFontResult = {
30
+ readonly ok: true;
31
+ readonly font: ProjectFont;
32
+ } | {
33
+ readonly ok: false;
34
+ readonly message: string;
35
+ };
36
+ /** The format of font data from its signature. */
37
+ export declare function fontFormat(data: Uint8Array): FontFormat | undefined;
38
+ /** True when an `fsType` value is restricted-licence embedding (bit 1 alone among bits 0 to 3). */
39
+ export declare function restrictsEmbedding(fsType: number): boolean;
40
+ /** Text drawn as a path in pixel units: baseline at y = 0, starting at x = 0, y down. */
41
+ export interface TextOutline {
42
+ readonly d: string;
43
+ readonly width: number;
44
+ }
45
+ /**
46
+ * Measures, outlines and embeds text with the bundled fonts. Each character is drawn by the
47
+ * requested family when it has the glyph, otherwise by the fallback families, as browsers do.
48
+ * Parsed fonts and widths are cached, so one library serves a whole CLI run or editor session.
49
+ */
50
+ export declare class FontLibrary {
51
+ private readonly read;
52
+ private readonly subsetTables;
53
+ private readonly fonts;
54
+ private readonly widths;
55
+ private readonly missing;
56
+ /** Project fonts by lower-case family name, then by `weight|style`. */
57
+ private readonly project;
58
+ constructor(read: FontFileReader);
59
+ /**
60
+ * Registers a project font under the family, weight and style it declares. The same family,
61
+ * weight and style registered twice keeps the first file.
62
+ */
63
+ addFont(data: Uint8Array, source: string): AddFontResult;
64
+ /** The project fonts registered so far. */
65
+ projectFonts(): ProjectFont[];
66
+ /** Whether a family's text may be embedded or outlined; false for restricted project fonts. */
67
+ embeddable(family: string): boolean;
68
+ /** The family a CSS font stack resolves to: a project family or a bundled one. */
69
+ family(stack: string): string | undefined;
70
+ /** The project face of a family nearest to a weight, normal style first. */
71
+ private projectFace;
72
+ knows(stack: string): boolean;
73
+ /** Width in pixels of `text` in the font a stack resolves to, with kerning. */
74
+ width(text: string, stack: string, weight: number, size: number): number;
75
+ /** The sources, resolved weight and average advance of a family, bundled or from the project. */
76
+ private primary;
77
+ /** Characters of `text` that no font of the stack or the fallback families covers. */
78
+ uncovered(text: string, stack: string): string[];
79
+ /** Every character measured so far that no bundled font covered. */
80
+ unmeasured(): string[];
81
+ /** Cap height of the stack's font in ems, rounded to four decimals. */
82
+ capHeight(stack: string, weight: number): number;
83
+ /**
84
+ * The family's script subset files that `text` needs, for embedding. Characters only the
85
+ * complete fonts or fallback families have are left to the viewer's fallback, which keeps the
86
+ * embedded data small; they are still measured and outlined exactly.
87
+ */
88
+ faces(family: string, weight: number, text: string): EmbeddedFace[];
89
+ /** `text` as one path in pixel units, laid out with kerning; baseline at y = 0. */
90
+ outline(text: string, family: string, weight: number, size: number): TextOutline;
91
+ /** Splits text into runs drawn by one font each, trying the sources in order per character. */
92
+ private runs;
93
+ /** The fonts of a family at one weight: its complete font, or its subsets, latin first. */
94
+ private sources;
95
+ private subsetTable;
96
+ private subsetFont;
97
+ private load;
98
+ /** Average advance in ems, from the OS/2 table of the family's first font. */
99
+ private averageAdvance;
100
+ }
101
+ //# sourceMappingURL=library.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,wFAAwF;IACxF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,EAAE,EAAE,I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EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAqBxE,iGAAiG;IACjG,OAAO,CAAC,OAAO;IAiBf,sFAAsF;IACtF,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAShD,oEAAoE;IACpE,UAAU,IAAI,MAAM,EAAE;IAItB,uEAAuE;IACvE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAQhD;;;;OAIG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE;IA4CnE,mFAAmF;IACnF,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW;IA6BhF,+FAA+F;IAC/F,OAAO,CAAC,IAAI;IAyBZ,2FAA2F;IAC3F,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,WAAW;IAmBnB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,IAAI;IAQZ,8EAA8E;IAC9E,OAAO,CAAC,cAAc;CAKvB"}
@@ -0,0 +1,367 @@
1
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference -- fontkit ships no types, and other packages compile these sources directly.
2
+ /// <reference path="./fontkit.d.ts" />
3
+ import * as fontkit from "fontkit";
4
+ import { FALLBACK_FAMILIES, bundledFamily, formatUnicodeRange, nearestWeight, parseUnicodeRange, resolveFontStack, } from "./families.js";
5
+ import { messages } from "./messages/index.js";
6
+ /** The format of font data from its signature. */
7
+ export function fontFormat(data) {
8
+ const tag = String.fromCharCode(...data.subarray(0, 4));
9
+ if (tag === "wOF2")
10
+ return "woff2";
11
+ if (tag === "wOFF")
12
+ return "woff";
13
+ if (tag === "OTTO")
14
+ return "opentype";
15
+ if (tag === "true" || (data[0] === 0 && data[1] === 1 && data[2] === 0 && data[3] === 0)) {
16
+ return "truetype";
17
+ }
18
+ return undefined;
19
+ }
20
+ /** True when an `fsType` value is restricted-licence embedding (bit 1 alone among bits 0 to 3). */
21
+ export function restrictsEmbedding(fsType) {
22
+ return (fsType & 0x000f) === 0x0002;
23
+ }
24
+ function numericFlags(value, bits) {
25
+ if (typeof value === "number")
26
+ return value;
27
+ let result = 0;
28
+ for (const [flag, bit] of Object.entries(bits))
29
+ if (value[flag])
30
+ result |= bit;
31
+ return result;
32
+ }
33
+ const AVERAGE_FALLBACK = 0.55;
34
+ const ESTIMATED_CAP_HEIGHT = 0.7;
35
+ /**
36
+ * Measures, outlines and embeds text with the bundled fonts. Each character is drawn by the
37
+ * requested family when it has the glyph, otherwise by the fallback families, as browsers do.
38
+ * Parsed fonts and widths are cached, so one library serves a whole CLI run or editor session.
39
+ */
40
+ export class FontLibrary {
41
+ read;
42
+ subsetTables = new Map();
43
+ fonts = new Map();
44
+ widths = new Map();
45
+ missing = new Set();
46
+ /** Project fonts by lower-case family name, then by `weight|style`. */
47
+ project = new Map();
48
+ constructor(read) {
49
+ this.read = read;
50
+ }
51
+ /**
52
+ * Registers a project font under the family, weight and style it declares. The same family,
53
+ * weight and style registered twice keeps the first file.
54
+ */
55
+ addFont(data, source) {
56
+ // Problems are written in the interface language of the moment the font is added.
57
+ const t = messages().fonts;
58
+ const format = fontFormat(data);
59
+ if (!format)
60
+ return { ok: false, message: t.format };
61
+ let font;
62
+ try {
63
+ font = fontkit.create(data);
64
+ }
65
+ catch (error) {
66
+ return { ok: false, message: t.unreadable(error.message) };
67
+ }
68
+ const os2 = font["OS/2"];
69
+ const family = (font.familyName ?? "").trim();
70
+ if (family === "")
71
+ return { ok: false, message: t.noFamily };
72
+ const fsType = numericFlags(os2?.fsType ?? 0, {
73
+ noEmbedding: 0x0002,
74
+ viewOnly: 0x0004,
75
+ editable: 0x0008,
76
+ });
77
+ const fsSelection = numericFlags(os2?.fsSelection ?? 0, { italic: 0x0001 });
78
+ const info = {
79
+ family,
80
+ weight: os2?.usWeightClass || 400,
81
+ style: (fsSelection & 1) !== 0 || (font.italicAngle ?? 0) !== 0 ? "italic" : "normal",
82
+ format,
83
+ restricted: restrictsEmbedding(fsType),
84
+ source,
85
+ };
86
+ const key = family.toLowerCase();
87
+ const entry = this.project.get(key) ?? { family, faces: new Map() };
88
+ const faceKey = `${info.weight}|${info.style}`;
89
+ if (!entry.faces.has(faceKey))
90
+ entry.faces.set(faceKey, { info, font, data });
91
+ this.project.set(key, entry);
92
+ return { ok: true, font: info };
93
+ }
94
+ /** The project fonts registered so far. */
95
+ projectFonts() {
96
+ return [...this.project.values()].flatMap((entry) => [...entry.faces.values()].map((f) => f.info));
97
+ }
98
+ /** Whether a family's text may be embedded or outlined; false for restricted project fonts. */
99
+ embeddable(family) {
100
+ const entry = this.project.get(family.toLowerCase());
101
+ return !entry || [...entry.faces.values()].every((face) => !face.info.restricted);
102
+ }
103
+ /** The family a CSS font stack resolves to: a project family or a bundled one. */
104
+ family(stack) {
105
+ for (const part of stack.split(",")) {
106
+ const name = part
107
+ .trim()
108
+ .replace(/^["']|["']$/g, "")
109
+ .toLowerCase();
110
+ const project = this.project.get(name);
111
+ if (project)
112
+ return project.family;
113
+ const bundled = resolveFontStack(name);
114
+ if (bundled)
115
+ return bundled;
116
+ }
117
+ return undefined;
118
+ }
119
+ /** The project face of a family nearest to a weight, normal style first. */
120
+ projectFace(family, weight) {
121
+ const entry = this.project.get(family.toLowerCase());
122
+ if (!entry)
123
+ return undefined;
124
+ const faces = [...entry.faces.values()];
125
+ const normal = faces.filter((f) => f.info.style === "normal");
126
+ const pool = normal.length > 0 ? normal : faces;
127
+ return pool.reduce((best, face) => {
128
+ const d = Math.abs(face.info.weight - weight);
129
+ const bestD = Math.abs(best.info.weight - weight);
130
+ return d < bestD || (d === bestD && face.info.weight > best.info.weight) ? face : best;
131
+ });
132
+ }
133
+ knows(stack) {
134
+ return this.family(stack) !== undefined;
135
+ }
136
+ /** Width in pixels of `text` in the font a stack resolves to, with kerning. */
137
+ width(text, stack, weight, size) {
138
+ const family = this.family(stack);
139
+ if (!family)
140
+ return [...text].length * size * AVERAGE_FALLBACK;
141
+ const { sources, weight: w, average } = this.primary(family, weight);
142
+ const key = `${family}|${w}|${text}`;
143
+ let ems = this.widths.get(key);
144
+ if (ems === undefined) {
145
+ ems = 0;
146
+ for (const run of this.runs(sources, family, w, text)) {
147
+ if (run.source === null) {
148
+ for (const ch of run.text)
149
+ this.missing.add(ch);
150
+ ems += [...run.text].length * average;
151
+ }
152
+ else {
153
+ ems += run.source.font.layout(run.text).advanceWidth / run.source.font.unitsPerEm;
154
+ }
155
+ }
156
+ this.widths.set(key, ems);
157
+ }
158
+ return ems * size;
159
+ }
160
+ /** The sources, resolved weight and average advance of a family, bundled or from the project. */
161
+ primary(family, weight) {
162
+ const face = this.projectFace(family, weight);
163
+ if (face) {
164
+ return {
165
+ sources: [{ key: `project:${face.info.source}`, font: face.font, ranges: null }],
166
+ weight: face.info.weight,
167
+ average: face.font["OS/2"].xAvgCharWidth / face.font.unitsPerEm || AVERAGE_FALLBACK,
168
+ };
169
+ }
170
+ const spec = bundledFamily(family);
171
+ const w = nearestWeight(spec, weight);
172
+ return { sources: this.sources(spec, w), weight: w, average: this.averageAdvance(spec, w) };
173
+ }
174
+ /** Characters of `text` that no font of the stack or the fallback families covers. */
175
+ uncovered(text, stack) {
176
+ const family = this.family(stack);
177
+ if (!family)
178
+ return [];
179
+ const { sources, weight } = this.primary(family, 400);
180
+ return this.runs(sources, family, weight, text)
181
+ .filter((run) => run.source === null)
182
+ .flatMap((run) => [...run.text]);
183
+ }
184
+ /** Every character measured so far that no bundled font covered. */
185
+ unmeasured() {
186
+ return [...this.missing];
187
+ }
188
+ /** Cap height of the stack's font in ems, rounded to four decimals. */
189
+ capHeight(stack, weight) {
190
+ const family = this.family(stack);
191
+ if (!family)
192
+ return ESTIMATED_CAP_HEIGHT;
193
+ const font = this.primary(family, weight).sources[0]?.font;
194
+ if (!font)
195
+ return ESTIMATED_CAP_HEIGHT;
196
+ return Math.round((font.capHeight / font.unitsPerEm) * 10000) / 10000;
197
+ }
198
+ /**
199
+ * The family's script subset files that `text` needs, for embedding. Characters only the
200
+ * complete fonts or fallback families have are left to the viewer's fallback, which keeps the
201
+ * embedded data small; they are still measured and outlined exactly.
202
+ */
203
+ faces(family, weight, text) {
204
+ const project = this.projectFace(family, weight);
205
+ if (project) {
206
+ if (project.info.restricted)
207
+ return [];
208
+ return [
209
+ {
210
+ family: this.project.get(family.toLowerCase()).family,
211
+ weight: project.info.weight,
212
+ subset: project.info.source,
213
+ format: project.info.format,
214
+ data: project.data,
215
+ unicodeRange: "",
216
+ },
217
+ ];
218
+ }
219
+ const spec = bundledFamily(family);
220
+ if (!spec)
221
+ return [];
222
+ const w = nearestWeight(spec, weight);
223
+ const tables = this.subsetTable(spec);
224
+ const bySubset = new Map();
225
+ for (const ch of text) {
226
+ const cp = ch.codePointAt(0);
227
+ const subset = tables.find((s) => inRanges(s.ranges, cp))?.name;
228
+ if (!subset || !this.subsetFont(spec, w, subset)?.hasGlyphForCodePoint(cp))
229
+ continue;
230
+ const codePoints = bySubset.get(subset) ?? new Set();
231
+ codePoints.add(cp);
232
+ bySubset.set(subset, codePoints);
233
+ }
234
+ const faces = [];
235
+ for (const [subset, codePoints] of [...bySubset].sort(([a], [b]) => (a < b ? -1 : 1))) {
236
+ const data = this.read(subsetPath(spec, w, subset));
237
+ if (!data)
238
+ continue;
239
+ faces.push({
240
+ family,
241
+ weight: w,
242
+ subset,
243
+ format: "woff2",
244
+ data,
245
+ unicodeRange: formatUnicodeRange(codePoints),
246
+ });
247
+ }
248
+ return faces;
249
+ }
250
+ /** `text` as one path in pixel units, laid out with kerning; baseline at y = 0. */
251
+ outline(text, family, weight, size) {
252
+ if (!bundledFamily(family) && !this.project.has(family.toLowerCase()))
253
+ return { d: "", width: 0 };
254
+ const { sources, weight: w, average } = this.primary(family, weight);
255
+ const parts = [];
256
+ let x = 0;
257
+ for (const run of this.runs(sources, family, w, text)) {
258
+ if (run.source === null) {
259
+ x += [...run.text].length * average * size;
260
+ continue;
261
+ }
262
+ const font = run.source.font;
263
+ const scale = size / font.unitsPerEm;
264
+ const laid = font.layout(run.text);
265
+ laid.glyphs.forEach((glyph, i) => {
266
+ const position = laid.positions[i];
267
+ const svg = glyph.path
268
+ .scale(scale, -scale)
269
+ .translate(x + position.xOffset * scale, -position.yOffset * scale)
270
+ .toSVG();
271
+ if (svg)
272
+ parts.push(roundPath(svg));
273
+ x += position.xAdvance * scale;
274
+ });
275
+ }
276
+ return { d: parts.join(""), width: Math.round(x * 100) / 100 };
277
+ }
278
+ // ---------------------------------------------------------------- internals
279
+ /** Splits text into runs drawn by one font each, trying the sources in order per character. */
280
+ runs(primary, family, weight, text) {
281
+ const sources = [
282
+ ...primary,
283
+ ...FALLBACK_FAMILIES.filter((f) => f !== family).flatMap((f) => {
284
+ const fallback = bundledFamily(f);
285
+ return this.sources(fallback, nearestWeight(fallback, weight));
286
+ }),
287
+ ];
288
+ const runs = [];
289
+ for (const ch of text) {
290
+ const cp = ch.codePointAt(0);
291
+ const source = cp < 0x20
292
+ ? null
293
+ : (sources.find((s) => (s.ranges === null || inRanges(s.ranges, cp)) && s.font.hasGlyphForCodePoint(cp)) ?? null);
294
+ const last = runs[runs.length - 1];
295
+ if (last && last.source?.key === source?.key)
296
+ last.text += ch;
297
+ else
298
+ runs.push({ source, text: ch });
299
+ }
300
+ return runs;
301
+ }
302
+ /** The fonts of a family at one weight: its complete font, or its subsets, latin first. */
303
+ sources(spec, weight) {
304
+ const completePath = spec.complete?.[weight];
305
+ if (completePath) {
306
+ const font = this.load(completePath);
307
+ if (font)
308
+ return [{ key: completePath, font, ranges: null }];
309
+ }
310
+ return this.subsetTable(spec).flatMap((subset) => {
311
+ const font = this.subsetFont(spec, weight, subset.name);
312
+ return font
313
+ ? [{ key: subsetPath(spec, weight, subset.name), font, ranges: subset.ranges }]
314
+ : [];
315
+ });
316
+ }
317
+ subsetTable(spec) {
318
+ const name = spec.subsets.package;
319
+ if (!this.subsetTables.has(name)) {
320
+ const bytes = this.read(`${name}/unicode.json`);
321
+ if (!bytes) {
322
+ this.subsetTables.set(name, null);
323
+ }
324
+ else {
325
+ const table = JSON.parse(new TextDecoder().decode(bytes));
326
+ const entries = Object.entries(table)
327
+ .filter(([subset]) => !subset.startsWith("["))
328
+ .map(([subset, value]) => ({ name: subset, ranges: parseUnicodeRange(value) }));
329
+ const rank = (subset) => (subset === "latin" ? 0 : subset === "latin-ext" ? 1 : 2);
330
+ entries.sort((a, b) => rank(a.name) - rank(b.name) || (a.name < b.name ? -1 : 1));
331
+ this.subsetTables.set(name, entries);
332
+ }
333
+ }
334
+ return this.subsetTables.get(name) ?? [];
335
+ }
336
+ subsetFont(spec, weight, subset) {
337
+ return this.load(subsetPath(spec, weight, subset));
338
+ }
339
+ load(path) {
340
+ if (!this.fonts.has(path)) {
341
+ const bytes = this.read(path);
342
+ this.fonts.set(path, bytes ? fontkit.create(bytes) : null);
343
+ }
344
+ return this.fonts.get(path) ?? undefined;
345
+ }
346
+ /** Average advance in ems, from the OS/2 table of the family's first font. */
347
+ averageAdvance(spec, weight) {
348
+ const font = this.sources(spec, weight)[0]?.font;
349
+ if (!font)
350
+ return AVERAGE_FALLBACK;
351
+ return font["OS/2"].xAvgCharWidth / font.unitsPerEm;
352
+ }
353
+ }
354
+ function subsetPath(spec, weight, subset) {
355
+ return `${spec.subsets.package}/files/${spec.subsets.prefix}-${subset}-${weight}-normal.woff2`;
356
+ }
357
+ function inRanges(ranges, cp) {
358
+ return ranges.some(([a, b]) => cp >= a && cp <= b);
359
+ }
360
+ /** Rounds every number of an SVG path to two decimals to keep outlines compact. */
361
+ function roundPath(d) {
362
+ return d.replace(/-?\d*\.\d+(?:e-?\d+)?/g, (n) => {
363
+ const rounded = Math.round(Number(n) * 100) / 100;
364
+ return Object.is(rounded, -0) ? "0" : String(rounded);
365
+ });
366
+ }
367
+ //# sourceMappingURL=library.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.js","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAAA,mJAAmJ;AACnJ,uCAAuC;AACvC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GAEjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA4C/C,kDAAkD;AAClD,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxD,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,OAAO,CAAC;IACnC,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,UAAU,CAAC;IACtC,IAAI,GAAG,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACzF,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AACtC,CAAC;AAED,SAAS,YAAY,CACnB,KAAgE,EAChE,IAAsC;IAEtC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,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C;AACL,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The words of fonts in English: why a font file of a project cannot be used. They are written in
3
+ * the interface language when a font is added, so they are read at that moment, never at module
4
+ * load.
5
+ */
6
+ export declare const en: {
7
+ /** Why `addFont` refuses a file. */
8
+ fonts: {
9
+ format: string;
10
+ /** The font parser's own words, which end the sentence. */
11
+ unreadable: (reason: string) => string;
12
+ noFamily: string;
13
+ };
14
+ };
15
+ //# sourceMappingURL=en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,EAAE;IACb,oCAAoC;;;QAGlC,2DAA2D;6BACtC,MAAM;;;CAG9B,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The words of fonts in English: why a font file of a project cannot be used. They are written in
3
+ * the interface language when a font is added, so they are read at that moment, never at module
4
+ * load.
5
+ */
6
+ export const en = {
7
+ /** Why `addFont` refuses a file. */
8
+ fonts: {
9
+ format: "The file is not a WOFF2, WOFF, TrueType or OpenType font.",
10
+ /** The font parser's own words, which end the sentence. */
11
+ unreadable: (reason) => `The font cannot be read: ${reason}`,
12
+ noFamily: "The font has no family name.",
13
+ },
14
+ };
15
+ //# sourceMappingURL=en.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en.js","sourceRoot":"","sources":["../../src/messages/en.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAChB,oCAAoC;IACpC,KAAK,EAAE;QACL,MAAM,EAAE,2DAA2D;QACnE,2DAA2D;QAC3D,UAAU,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,4BAA4B,MAAM,EAAE;QACpE,QAAQ,EAAE,8BAA8B;KACzC;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { en } from "./en.js";
2
+ /** The words of fonts in Spanish. */
3
+ export declare const es: typeof en;
4
+ //# sourceMappingURL=es.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/messages/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAElC,qCAAqC;AACrC,eAAO,MAAM,EAAE,EAAE,OAAO,EAMvB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** The words of fonts in Spanish. */
2
+ export const es = {
3
+ fonts: {
4
+ format: "El archivo no es una fuente WOFF2, WOFF, TrueType u OpenType.",
5
+ unreadable: (reason) => `No se puede leer la fuente: ${reason}`,
6
+ noFamily: "La fuente no tiene nombre de familia.",
7
+ },
8
+ };
9
+ //# sourceMappingURL=es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"es.js","sourceRoot":"","sources":["../../src/messages/es.ts"],"names":[],"mappings":"AAEA,qCAAqC;AACrC,MAAM,CAAC,MAAM,EAAE,GAAc;IAC3B,KAAK,EAAE;QACL,MAAM,EAAE,+DAA+D;QACvE,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,+BAA+B,MAAM,EAAE;QAC/D,QAAQ,EAAE,uCAAuC;KAClD;CACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The words of fonts for people: why a project's font file cannot be used. They are in the
3
+ * interface language (`getLocale()`), looked up when a font is added, never when a module loads.
4
+ */
5
+ export declare const messages: (locale?: import("@meltemi/diagrams-i18n").Locale) => {
6
+ fonts: {
7
+ format: string;
8
+ unreadable: (reason: string) => string;
9
+ noFamily: string;
10
+ };
11
+ };
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;CAAkB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { catalog } from "@meltemi/diagrams-i18n";
2
+ import { en } from "./en.js";
3
+ import { es } from "./es.js";
4
+ /**
5
+ * The words of fonts for people: why a project's font file cannot be used. They are in the
6
+ * interface language (`getLocale()`), looked up when a font is added, never when a module loads.
7
+ */
8
+ export const messages = catalog(en, es);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC"}
package/dist/node.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { FontLibrary, type FontFileReader } from "./library.js";
2
+ /** Reads bundled font files from the Fontsource packages installed next to this module. */
3
+ export declare function createNodeFontReader(): FontFileReader;
4
+ /** A font library over the bundled fonts on the local file system. */
5
+ export declare function createNodeFontLibrary(): FontLibrary;
6
+ /** A file the font library reads: its package-relative path and the installed file. */
7
+ export interface BundledFontFile {
8
+ /** The path the library reads, such as `@fontsource/inter/unicode.json`. */
9
+ readonly path: string;
10
+ readonly source: string;
11
+ }
12
+ /**
13
+ * Every file the font library reads for the bundled families: the complete files, the script
14
+ * subsets of the bundled weights and the Fontsource subset tables (`unicode.json`), sorted by
15
+ * path. Hosts that ship the fonts with their bundle copy exactly these.
16
+ */
17
+ export declare function bundledFontFiles(): BundledFontFile[];
18
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAuBhE,2FAA2F;AAC3F,wBAAgB,oBAAoB,IAAI,cAAc,CAYrD;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,IAAI,WAAW,CAEnD;AAED,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,eAAe,EAAE,CAuBpD"}
package/dist/node.js ADDED
@@ -0,0 +1,78 @@
1
+ import { readFileSync, readdirSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { BUNDLED_FAMILIES, FONT_PACKAGES } from "./families.js";
5
+ import { FontLibrary } from "./library.js";
6
+ /** The installed folders of the font packages, by package name; missing packages are left out. */
7
+ function packageRoots() {
8
+ const require = createRequire(import.meta.url);
9
+ const roots = new Map();
10
+ for (const name of FONT_PACKAGES) {
11
+ try {
12
+ roots.set(name, dirname(require.resolve(`${name}/package.json`)));
13
+ }
14
+ catch {
15
+ // The package is missing; its files read as undefined and text falls back to estimates.
16
+ }
17
+ }
18
+ return roots;
19
+ }
20
+ /** The package of a package-relative path, and the rest of the path. */
21
+ function splitPath(path) {
22
+ const parts = path.split("/");
23
+ const scoped = parts[0].startsWith("@");
24
+ return { name: parts.slice(0, scoped ? 2 : 1).join("/"), rest: parts.slice(scoped ? 2 : 1) };
25
+ }
26
+ /** Reads bundled font files from the Fontsource packages installed next to this module. */
27
+ export function createNodeFontReader() {
28
+ const roots = packageRoots();
29
+ return (path) => {
30
+ const { name, rest } = splitPath(path);
31
+ const root = roots.get(name);
32
+ if (!root)
33
+ return undefined;
34
+ try {
35
+ return new Uint8Array(readFileSync(join(root, ...rest)));
36
+ }
37
+ catch {
38
+ return undefined;
39
+ }
40
+ };
41
+ }
42
+ /** A font library over the bundled fonts on the local file system. */
43
+ export function createNodeFontLibrary() {
44
+ return new FontLibrary(createNodeFontReader());
45
+ }
46
+ /**
47
+ * Every file the font library reads for the bundled families: the complete files, the script
48
+ * subsets of the bundled weights and the Fontsource subset tables (`unicode.json`), sorted by
49
+ * path. Hosts that ship the fonts with their bundle copy exactly these.
50
+ */
51
+ export function bundledFontFiles() {
52
+ const roots = packageRoots();
53
+ const files = new Map();
54
+ const add = (path) => {
55
+ const { name, rest } = splitPath(path);
56
+ const root = roots.get(name);
57
+ if (root)
58
+ files.set(path, join(root, ...rest));
59
+ };
60
+ for (const family of BUNDLED_FAMILIES) {
61
+ for (const path of Object.values(family.complete ?? {}))
62
+ add(path);
63
+ const { package: name, prefix } = family.subsets;
64
+ const root = roots.get(name);
65
+ if (!root)
66
+ continue;
67
+ add(`${name}/unicode.json`);
68
+ const weights = family.weights.join("|");
69
+ const subset = new RegExp(`^${prefix}-[a-z0-9-]+-(?:${weights})-normal\\.woff2$`);
70
+ for (const file of readdirSync(join(root, "files")).filter((f) => subset.test(f))) {
71
+ add(`${name}/files/${file}`);
72
+ }
73
+ }
74
+ return [...files]
75
+ .map(([path, source]) => ({ path, source }))
76
+ .sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
77
+ }
78
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,WAAW,EAAuB,MAAM,cAAc,CAAC;AAEhE,kGAAkG;AAClG,SAAS,YAAY;IACnB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAG,IAAI,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QAClF,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClF,GAAG,CAAC,GAAG,IAAI,UAAU,IAAI,EAAE,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,KAAK,CAAC;SACd,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;SAC3C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@meltemi/diagrams-fonts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.9.0",
4
+ "description": "Bundled OFL fonts, text measurement, font subsetting and text outlines for Meltemi Diagrams.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/askenaz-dev/meltemi-diagrams.git",
9
+ "directory": "packages/fonts"
10
+ },
11
+ "homepage": "https://github.com/askenaz-dev/meltemi-diagrams/tree/main/packages/fonts#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/askenaz-dev/meltemi-diagrams/issues"
14
+ },
15
+ "engines": {
16
+ "node": ">=22.12.0"
17
+ },
18
+ "type": "module",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./node": {
25
+ "types": "./dist/node.d.ts",
26
+ "default": "./dist/node.js"
27
+ }
28
+ },
29
+ "files": [
30
+ "dist"
31
+ ],
32
+ "dependencies": {
33
+ "@fontsource/cascadia-mono": "5.3.0",
34
+ "@fontsource/ibm-plex-sans": "5.3.0",
35
+ "@fontsource/inter": "5.3.0",
36
+ "@ibm/plex-sans": "1.1.0",
37
+ "fontkit": "2.0.4",
38
+ "inter-ui": "4.1.1",
39
+ "@meltemi/diagrams-i18n": "1.9.0"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc -p tsconfig.build.json",
46
+ "typecheck": "tsc -p tsconfig.json"
47
+ }
6
48
  }