@kensio/colophon 2.13.0 → 2.13.1

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.
Files changed (44) hide show
  1. package/README.md +4 -3
  2. package/dist/config/defaults.d.ts +8 -4
  3. package/dist/config/defaults.d.ts.map +1 -1
  4. package/dist/config/defaults.js +8 -4
  5. package/dist/config/defaults.js.map +1 -1
  6. package/dist/config/resolve.d.ts +13 -0
  7. package/dist/config/resolve.d.ts.map +1 -1
  8. package/dist/config/resolve.js +14 -8
  9. package/dist/config/resolve.js.map +1 -1
  10. package/dist/fonts/bundled.d.ts +38 -0
  11. package/dist/fonts/bundled.d.ts.map +1 -0
  12. package/dist/fonts/bundled.js +29 -0
  13. package/dist/fonts/bundled.js.map +1 -0
  14. package/dist/fonts/index.d.ts +1 -0
  15. package/dist/fonts/index.d.ts.map +1 -1
  16. package/dist/fonts/index.js +1 -0
  17. package/dist/fonts/index.js.map +1 -1
  18. package/dist/measure/faces.d.ts.map +1 -1
  19. package/dist/measure/faces.js +29 -5
  20. package/dist/measure/faces.js.map +1 -1
  21. package/dist/measure/index.d.ts.map +1 -1
  22. package/dist/measure/index.js +0 -0
  23. package/dist/measure/index.js.map +1 -1
  24. package/dist/platform/bundled-fonts.browser.d.ts +16 -0
  25. package/dist/platform/bundled-fonts.browser.d.ts.map +1 -0
  26. package/dist/platform/bundled-fonts.browser.js +17 -0
  27. package/dist/platform/bundled-fonts.browser.js.map +1 -0
  28. package/dist/platform/bundled-fonts.node.d.ts +18 -0
  29. package/dist/platform/bundled-fonts.node.d.ts.map +1 -0
  30. package/dist/platform/bundled-fonts.node.js +49 -0
  31. package/dist/platform/bundled-fonts.node.js.map +1 -0
  32. package/dist/render/rasterise.d.ts.map +1 -1
  33. package/dist/render/rasterise.js +8 -3
  34. package/dist/render/rasterise.js.map +1 -1
  35. package/fonts/JetBrainsMono-LICENSE.txt +93 -0
  36. package/fonts/JetBrainsMono_400Regular.ttf +0 -0
  37. package/fonts/JetBrainsMono_700Bold.ttf +0 -0
  38. package/fonts/Outfit-LICENSE.txt +93 -0
  39. package/fonts/Outfit_400Regular.ttf +0 -0
  40. package/fonts/Outfit_500Medium.ttf +0 -0
  41. package/fonts/Outfit_600SemiBold.ttf +0 -0
  42. package/fonts/Outfit_700Bold.ttf +0 -0
  43. package/fonts/Outfit_800ExtraBold.ttf +0 -0
  44. package/package.json +4 -2
package/README.md CHANGED
@@ -40,9 +40,10 @@ pnpm add @kensio/colophon
40
40
  ```
41
41
 
42
42
  `@resvg/resvg-js` rasterises the SVG to PNG, and `shiki` provides the grammars
43
- and themes for the `code` template. No headless browser is involved. Fonts can
44
- be handed to the renderer as files, so a build renders the same image
45
- everywhere.
43
+ and themes for the `code` template. No headless browser is involved. Outfit and
44
+ JetBrains Mono ship with the package and are used by default, so a build renders
45
+ the same image everywhere without configuring anything; point `fonts` at your
46
+ own files to use those instead.
46
47
 
47
48
  ## Quick start
48
49
 
@@ -61,11 +61,15 @@ export declare const SIZE_PRESETS: {
61
61
  */
62
62
  export declare const DEFAULT_SIZES: readonly OutputSize[];
63
63
  /**
64
- * Default font stack, used when no fonts are configured. It names families and
65
- * hopes the machine has them, which is exactly what `config.fonts` exists to
66
- * avoid: supply a font file and the output stops depending on the machine.
64
+ * Default font stack, used when no fonts are configured.
65
+ *
66
+ * Outfit ships with the package, so this resolves to a real file rather than
67
+ * to whatever the machine happens to have: the same words come out the same
68
+ * width on a laptop, in CI and in a container, without a project configuring
69
+ * anything. The families behind it are the fallback for a character Outfit
70
+ * does not cover, which is most of what is not Latin.
67
71
  */
68
- export declare const DEFAULT_FONT_FAMILY = "Arial, Helvetica, sans-serif";
72
+ export declare const DEFAULT_FONT_FAMILY = "Outfit, \"Helvetica Neue\", Helvetica, Arial, sans-serif";
69
73
  /**
70
74
  * Default zlib level for the rendered PNG: the strongest there is.
71
75
  *
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults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O,MAAM,cAAc,EAAE,QAAQ,CAAC,WAAW,CAKhD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8FACkD,CAAC;AAExF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,SAAS,CAalD,CAAC"}
@@ -47,11 +47,15 @@ export const DEFAULT_SIZES = [
47
47
  SIZE_PRESETS.square,
48
48
  ];
49
49
  /**
50
- * Default font stack, used when no fonts are configured. It names families and
51
- * hopes the machine has them, which is exactly what `config.fonts` exists to
52
- * avoid: supply a font file and the output stops depending on the machine.
50
+ * Default font stack, used when no fonts are configured.
51
+ *
52
+ * Outfit ships with the package, so this resolves to a real file rather than
53
+ * to whatever the machine happens to have: the same words come out the same
54
+ * width on a laptop, in CI and in a container, without a project configuring
55
+ * anything. The families behind it are the fallback for a character Outfit
56
+ * does not cover, which is most of what is not Latin.
53
57
  */
54
- export const DEFAULT_FONT_FAMILY = "Arial, Helvetica, sans-serif";
58
+ export const DEFAULT_FONT_FAMILY = 'Outfit, "Helvetica Neue", Helvetica, Arial, sans-serif';
55
59
  /**
56
60
  * Default zlib level for the rendered PNG: the strongest there is.
57
61
  *
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;IAC5C,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IACrD,OAAO,EAAE,E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AACH,MAAM,CAAC,MAAM,cAAc,GAAiB,KAAK,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAA0B;IACnD,KAAK,EAAE,SAAS;IAChB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,UAAU,EAAE,SAAS;CACtB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,qFAAqF,CAAC;AAExF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,KAAK,EAAE,aAAa;IACpB,UAAU,EAAE,wBAAwB;IACpC,UAAU,EAAE,IAAI;IAChB,OAAO,EAAE,CAAC;IACV,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,KAAK;IACnB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,KAAK;IAClB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,SAAS;IACtB,aAAa,EAAE,IAAI;CACpB,CAAC"}
@@ -36,6 +36,19 @@ export declare function resolveCompressionLevel(level: number | undefined): numb
36
36
  * Whether to load the machine's own fonts. Configured fonts are meant to make
37
37
  * the output the same everywhere, so supplying any turns system fonts off
38
38
  * unless the project asks for them back.
39
+ *
40
+ * A project that configures none still gets them, even though the package now
41
+ * bundles fonts of its own. What the bundled ones give is a Latin face that is
42
+ * the same everywhere, and they cover nothing else: a Japanese or Arabic title
43
+ * on a project that has configured no fonts has only the machine's own to be
44
+ * drawn in, and turning them off by default would render it as nothing at all.
45
+ * So the rule is unchanged and the bundled fonts sit in front of the system
46
+ * ones rather than in place of them.
47
+ *
48
+ * `systemFonts: false` with no fonts configured used to be an error, on the
49
+ * grounds that it left nothing to render with. The bundled fonts are what it
50
+ * leaves now, and that pairing is the whole way to ask for a build that does
51
+ * not depend on the machine without supplying font files, so it is allowed.
39
52
  */
40
53
  export declare function shouldLoadSystemFonts(systemFonts: boolean | undefined, fonts: readonly FontSource[]): boolean;
41
54
  //# sourceMappingURL=resolve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACX,MAAM,aAAa,CAAC;AASrB;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,QAAQ,CAAC,WAAW,CAAC,CAWvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,UAAU,GAAG,SAAS,CASxB;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,UAAU,CAS3E;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,CAE5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,GACvC,SAAS,UAAU,EAAE,CAgBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAazE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,OAAO,GAAG,SAAS,EAChC,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,OAAO,CAaT"}
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAU,EACX,MAAM,aAAa,CAAC;AASrB;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,QAAQ,CAAC,WAAW,CAAC,CAWvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,UAAU,GAAG,SAAS,CASxB;AAED,uEAAuE;AACvE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,UAAU,CAS3E;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC,CAE5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,GACvC,SAAS,UAAU,EAAE,CAgBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAazE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,OAAO,GAAG,SAAS,EAChC,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,OAAO,CAET"}
@@ -87,15 +87,21 @@ export function resolveCompressionLevel(level) {
87
87
  * Whether to load the machine's own fonts. Configured fonts are meant to make
88
88
  * the output the same everywhere, so supplying any turns system fonts off
89
89
  * unless the project asks for them back.
90
+ *
91
+ * A project that configures none still gets them, even though the package now
92
+ * bundles fonts of its own. What the bundled ones give is a Latin face that is
93
+ * the same everywhere, and they cover nothing else: a Japanese or Arabic title
94
+ * on a project that has configured no fonts has only the machine's own to be
95
+ * drawn in, and turning them off by default would render it as nothing at all.
96
+ * So the rule is unchanged and the bundled fonts sit in front of the system
97
+ * ones rather than in place of them.
98
+ *
99
+ * `systemFonts: false` with no fonts configured used to be an error, on the
100
+ * grounds that it left nothing to render with. The bundled fonts are what it
101
+ * leaves now, and that pairing is the whole way to ask for a build that does
102
+ * not depend on the machine without supplying font files, so it is allowed.
90
103
  */
91
104
  export function shouldLoadSystemFonts(systemFonts, fonts) {
92
- if (systemFonts === undefined) {
93
- return fonts.length === 0;
94
- }
95
- if (!systemFonts && fonts.length === 0) {
96
- throw new Error("systemFonts is false and no fonts are configured, so no text could be" +
97
- " rendered. Add fonts, or leave systemFonts unset.");
98
- }
99
- return systemFonts;
105
+ return systemFonts ?? fonts.length === 0;
100
106
  }
101
107
  //# sourceMappingURL=resolve.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/config/resolve.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,MAA+B;IAE/B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK;QAC3C,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,KAAK;QAC3C,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,cAAc,CAAC,UAAU;KAC3D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAkC;IAElC,IAAI,UAAU,EAAE,IAAI,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO;QACL,GAAG,UAAU;QACb,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KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAyB;IAC/D,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CACb,4BAA4B,MAAM,CAAC,KAAK,CAAC,gCAAgC;YACvE,gEAAgE,CACnE,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CACnC,WAAgC,EAChC,KAA4B;IAE5B,OAAO,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { FontSource } from "../types.js";
2
+ /**
3
+ * One font that ships with the package: always a file, and always with its
4
+ * family declared. Narrower than {@link FontSource} because both of those are
5
+ * true of every one of them, and a caller that has to prove a `path` is there
6
+ * before reading it would be proving something this module already knows.
7
+ */
8
+ export type BundledFont = Extract<FontSource, {
9
+ readonly path: string;
10
+ }> & {
11
+ readonly family: string;
12
+ };
13
+ export { bundledFonts } from "../platform/bundled-fonts.node.js";
14
+ /**
15
+ * The fonts a build actually renders with: the project's own, and the ones
16
+ * that ship with the package behind them.
17
+ *
18
+ * The bundled fonts go last so that a project supplying its own is never
19
+ * argued with. Two things read the order and both keep the behaviour they had:
20
+ * `fallbackFamily` takes the first declared family, and the bundled fonts
21
+ * declare none, so a project's own font is still what resvg falls back to;
22
+ * and `faceFor` measures against the first face when system fonts are off,
23
+ * which is still the project's own where there is one and Outfit where there
24
+ * is not.
25
+ *
26
+ * This is deliberately not folded into `ResolvedConfig.fonts`. That field
27
+ * means what the project supplied, which is what makes it worth showing in an
28
+ * error message, and three things read it on that understanding: the rebuild
29
+ * stamp hashes it, `shouldLoadSystemFonts` counts it, and `fontFamily` takes
30
+ * its default from it. The bundled fonts change only when the package version
31
+ * does, and the version is in the stamp already.
32
+ *
33
+ * A custom {@link Rasteriser} that resolves font files itself wants this
34
+ * rather than `config.fonts`, or it will draw without the fonts the measurer
35
+ * measured with.
36
+ */
37
+ export declare function withBundledFonts(fonts: readonly FontSource[]): readonly FontSource[];
38
+ //# sourceMappingURL=bundled.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled.d.ts","sourceRoot":"","sources":["../../src/fonts/bundled.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IACzE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,SAAS,UAAU,EAAE,CAEvB"}
@@ -0,0 +1,29 @@
1
+ import { bundledFonts } from "../platform/bundled-fonts.node.js";
2
+ export { bundledFonts } from "../platform/bundled-fonts.node.js";
3
+ /**
4
+ * The fonts a build actually renders with: the project's own, and the ones
5
+ * that ship with the package behind them.
6
+ *
7
+ * The bundled fonts go last so that a project supplying its own is never
8
+ * argued with. Two things read the order and both keep the behaviour they had:
9
+ * `fallbackFamily` takes the first declared family, and the bundled fonts
10
+ * declare none, so a project's own font is still what resvg falls back to;
11
+ * and `faceFor` measures against the first face when system fonts are off,
12
+ * which is still the project's own where there is one and Outfit where there
13
+ * is not.
14
+ *
15
+ * This is deliberately not folded into `ResolvedConfig.fonts`. That field
16
+ * means what the project supplied, which is what makes it worth showing in an
17
+ * error message, and three things read it on that understanding: the rebuild
18
+ * stamp hashes it, `shouldLoadSystemFonts` counts it, and `fontFamily` takes
19
+ * its default from it. The bundled fonts change only when the package version
20
+ * does, and the version is in the stamp already.
21
+ *
22
+ * A custom {@link Rasteriser} that resolves font files itself wants this
23
+ * rather than `config.fonts`, or it will draw without the fonts the measurer
24
+ * measured with.
25
+ */
26
+ export function withBundledFonts(fonts) {
27
+ return [...fonts, ...bundledFonts()];
28
+ }
29
+ //# sourceMappingURL=bundled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled.js","sourceRoot":"","sources":["../../src/fonts/bundled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAajE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAA4B;IAE5B,OAAO,CAAC,GAAG,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC,CAAC;AACvC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { FontSource } from "../types.js";
2
+ export { bundledFonts, withBundledFonts } from "./bundled.js";
2
3
  export { fontFilePaths } from "./materialise.js";
3
4
  export { resolveFonts } from "./resolve.js";
4
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,UAAU,EAAE,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
@@ -1,3 +1,4 @@
1
+ export { bundledFonts, withBundledFonts } from "./bundled.js";
1
2
  export { fontFilePaths } from "./materialise.js";
2
3
  export { resolveFonts } from "./resolve.js";
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA4B;IAE5B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM,CAAC;AACjE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fonts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA4B;IAE5B,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM,CAAC;AACjE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AA0FD,+EAA+E;AAC/E,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAM1B"}
1
+ {"version":3,"file":"faces.d.ts","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAwHD,+EAA+E;AAC/E,wBAAsB,SAAS,CAC7B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,EAAE,cAAc,GACxB,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC,CAM1B"}
@@ -12,16 +12,40 @@ const byPath = new Map();
12
12
  */
13
13
  const byData = new WeakMap();
14
14
  /**
15
- * What a face declares about itself. The types say both of these are always
16
- * there, and a font file is data: one missing its name or its `OS/2` table
17
- * would otherwise take the build down inside `selectFace`, rather than being
15
+ * The family a face belongs to, as the rasteriser understands it.
16
+ *
17
+ * A font file carries two family names. The old one, name ID 1, has to put
18
+ * every cut beyond regular and bold in a family of its own, because that is
19
+ * all the four-slot model of the original format could express; the
20
+ * typographic family, name ID 16, is the one that was added to say what the
21
+ * file actually belongs to. Google's static cuts use both, so
22
+ * `Outfit_800ExtraBold.ttf` is `Outfit ExtraBold` under the old name and
23
+ * `Outfit` under the new one.
24
+ *
25
+ * resvg matches on the typographic family, so `font-family="Outfit"` at weight
26
+ * 800 finds that file. fontkit's `familyName` is the old one, so taking it
27
+ * here meant `selectFace` never matched anything but the regular cut: a bold
28
+ * title was drawn in `Outfit ExtraBold` and measured in `Outfit` Regular,
29
+ * which is narrower, so the line was under-measured and ran past the margin.
30
+ * Preferring name ID 16 is what makes the two agree.
31
+ *
32
+ * Everything is read defensively because a font file is data. The types say
33
+ * these are always there, and a file missing its name or its `OS/2` table
34
+ * would otherwise take the build down inside `selectFace` rather than being
18
35
  * measured as well as it can be. A face with no family name matches no stack,
19
- * so it is only ever reached as the fallback that the first configured font is.
36
+ * so it is only ever reached as the fallback the first configured font is.
20
37
  */
21
38
  function toFace(font) {
22
39
  const declared = font;
40
+ const preferred = declared.name?.records?.preferredFamily;
41
+ // Name records are keyed by language, and fontkit hands back either the map
42
+ // or a bare string depending on the file. English is what a stack is written
43
+ // in, and the first entry is the best guess for a file that has no English.
44
+ const typographic = typeof preferred === "string"
45
+ ? preferred
46
+ : (preferred?.["en"] ?? Object.values(preferred ?? {})[0]);
23
47
  return {
24
- family: declared.familyName ?? "",
48
+ family: typographic ?? declared.familyName ?? "",
25
49
  weight: declared["OS/2"]?.usWeightClass ?? 400,
26
50
  font,
27
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"faces.js","sourceRoot":"","sources":["../../src/measure/faces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OA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AM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CACnD,CAAC;IAEF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,aAAa,CAAC;AAO1E,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA8CvC;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,WAAW,CAAC,CAgBtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,aAAa,CAAC;AAO1E,YAAY,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AA8CvC;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,WAAW,CAAC,CAsBtB"}
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/measure/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;;;;;GAQG;AACH,SAAS,OAAO,CACd,KAAsB,EACtB,KAAgB,EAChB,cAAuB;IAEvB,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,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AAG,GAAG,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAC9D,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACpB,OAAO,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { BundledFont } from "../fonts/bundled.js";
2
+ /**
3
+ * The bundled fonts in the browser and at the edge, which is to say none.
4
+ *
5
+ * A bundler picks this up through `package.json`'s `browser` field. The fonts
6
+ * that ship with the package are files, and a file path means nothing here, so
7
+ * offering them would be offering something `readFileBytes` is about to refuse.
8
+ * Inlining the bytes instead would put half a megabyte of font into every
9
+ * bundle that imports the core, whether or not it draws any text.
10
+ *
11
+ * So text in a browser is measured by estimate and drawn in whatever the host
12
+ * has, exactly as it was before there were bundled fonts. A page that wants
13
+ * them supplies them itself, as bytes, which is what `FontSource.data` is for.
14
+ */
15
+ export declare function bundledFonts(): readonly BundledFont[];
16
+ //# sourceMappingURL=bundled-fonts.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-fonts.browser.d.ts","sourceRoot":"","sources":["../../src/platform/bundled-fonts.browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,IAAI,SAAS,WAAW,EAAE,CAErD"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The bundled fonts in the browser and at the edge, which is to say none.
3
+ *
4
+ * A bundler picks this up through `package.json`'s `browser` field. The fonts
5
+ * that ship with the package are files, and a file path means nothing here, so
6
+ * offering them would be offering something `readFileBytes` is about to refuse.
7
+ * Inlining the bytes instead would put half a megabyte of font into every
8
+ * bundle that imports the core, whether or not it draws any text.
9
+ *
10
+ * So text in a browser is measured by estimate and drawn in whatever the host
11
+ * has, exactly as it was before there were bundled fonts. A page that wants
12
+ * them supplies them itself, as bytes, which is what `FontSource.data` is for.
13
+ */
14
+ export function bundledFonts() {
15
+ return [];
16
+ }
17
+ //# sourceMappingURL=bundled-fonts.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-fonts.browser.js","sourceRoot":"","sources":["../../src/platform/bundled-fonts.browser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { BundledFont } from "../fonts/bundled.js";
2
+ /**
3
+ * The bundled fonts, in the order they are loaded.
4
+ *
5
+ * The family is declared as well as being in the file, which is a fact written
6
+ * down twice and worth the duplication for one reason: `fallbackFamily` reads
7
+ * declared families and nothing else, and it is what tells resvg which family
8
+ * to draw a stack in when the stack names nothing that was loaded. Without a
9
+ * declared family here, a project setting `fontFamily` to something it has not
10
+ * supplied would have its text measured against Outfit and drawn in whatever
11
+ * resvg falls back to on its own, which is how a layout comes out wrong on one
12
+ * machine and right on another. Nothing else reads these: matching a
13
+ * `font-family` to a file is done from the file's own name table, by the
14
+ * rasteriser and by `measure/faces.ts` alike. `fonts.test.ts` checks the two
15
+ * against each other so they cannot drift.
16
+ */
17
+ export declare function bundledFonts(): readonly BundledFont[];
18
+ //# sourceMappingURL=bundled-fonts.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-fonts.node.d.ts","sourceRoot":"","sources":["../../src/platform/bundled-fonts.node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA6BvD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,IAAI,SAAS,WAAW,EAAE,CAKrD"}
@@ -0,0 +1,49 @@
1
+ import { fileURLToPath } from "node:url";
2
+ /**
3
+ * The font files that ship with the package, as absolute paths.
4
+ *
5
+ * Two families, and only the cuts the built-in templates draw: Outfit at 400
6
+ * through 800 for everything that is words, and JetBrains Mono at 400 and 700
7
+ * for the code templates. The whole of either family would be most of a
8
+ * megabyte to install for cuts nothing asks for, and a weight that is not here
9
+ * is drawn in the nearest one that is, by resvg and by `selectFace` alike.
10
+ *
11
+ * Static cuts rather than the variable fonts, because resvg draws a variable
12
+ * font at its default instance and a single file would then be one weight.
13
+ *
14
+ * They are named from `import.meta.url` rather than resolved from the working
15
+ * directory, since the working directory belongs to the project being built
16
+ * and these live wherever the package was installed. Two levels up from
17
+ * `dist/platform/` is the package root.
18
+ */
19
+ const files = [
20
+ ["Outfit", "Outfit_400Regular.ttf"],
21
+ ["Outfit", "Outfit_500Medium.ttf"],
22
+ ["Outfit", "Outfit_600SemiBold.ttf"],
23
+ ["Outfit", "Outfit_700Bold.ttf"],
24
+ ["Outfit", "Outfit_800ExtraBold.ttf"],
25
+ ["JetBrains Mono", "JetBrainsMono_400Regular.ttf"],
26
+ ["JetBrains Mono", "JetBrainsMono_700Bold.ttf"],
27
+ ];
28
+ /**
29
+ * The bundled fonts, in the order they are loaded.
30
+ *
31
+ * The family is declared as well as being in the file, which is a fact written
32
+ * down twice and worth the duplication for one reason: `fallbackFamily` reads
33
+ * declared families and nothing else, and it is what tells resvg which family
34
+ * to draw a stack in when the stack names nothing that was loaded. Without a
35
+ * declared family here, a project setting `fontFamily` to something it has not
36
+ * supplied would have its text measured against Outfit and drawn in whatever
37
+ * resvg falls back to on its own, which is how a layout comes out wrong on one
38
+ * machine and right on another. Nothing else reads these: matching a
39
+ * `font-family` to a file is done from the file's own name table, by the
40
+ * rasteriser and by `measure/faces.ts` alike. `fonts.test.ts` checks the two
41
+ * against each other so they cannot drift.
42
+ */
43
+ export function bundledFonts() {
44
+ return files.map(([family, file]) => ({
45
+ family,
46
+ path: fileURLToPath(new URL(`../../fonts/${file}`, import.meta.url)),
47
+ }));
48
+ }
49
+ //# sourceMappingURL=bundled-fonts.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-fonts.node.js","sourceRoot":"","sources":["../../src/platform/bundled-fonts.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,KAAK,GAAyD;IAClE,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IACnC,CAAC,QAAQ,EAAE,sBAAsB,CAAC;IAClC,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IACpC,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IAChC,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IACrC,CAAC,gBAAgB,EAAE,8BAA8B,CAAC;IAClD,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;CAChD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;QACpC,MAAM;QACN,IAAI,EAAE,aAAa,CAAC,IAAI,GAAG,CAAC,eAAe,IAAI,EAAE,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;KACrE,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rasterise.d.ts","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,aAAa,CAAC;AAkB9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,UAO7B,CAAC"}
1
+ {"version":3,"file":"rasterise.d.ts","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,aAAa,CAAC;AAuB9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,UAO7B,CAAC"}
@@ -1,14 +1,19 @@
1
1
  import { renderAsync } from "@resvg/resvg-js";
2
- import { fallbackFamily, fontFilePaths } from "../fonts/index.js";
2
+ import { fallbackFamily, fontFilePaths, withBundledFonts, } from "../fonts/index.js";
3
3
  /**
4
4
  * Font options for resvg: the configured font files, and whether to fall back
5
5
  * to the machine's own.
6
6
  */
7
7
  async function fontOptions(config) {
8
- const fallback = fallbackFamily(config.fonts);
8
+ // The bundled fonts count here too, so that a stack naming nothing loaded
9
+ // falls back to Outfit rather than to whatever resvg would have chosen. That
10
+ // is the family the measurer will have measured against, and the two have to
11
+ // agree or the layout is right on a machine that happens to have the font
12
+ // and wrong on one that does not.
13
+ const fallback = fallbackFamily(withBundledFonts(config.fonts));
9
14
  return {
10
15
  loadSystemFonts: config.systemFonts,
11
- fontFiles: await fontFilePaths(config.fonts),
16
+ fontFiles: await fontFilePaths(withBundledFonts(config.fonts)),
12
17
  ...(fallback !== undefined && { defaultFontFamily: fallback }),
13
18
  };
14
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"rasterise.js","sourceRoot":"","sources":["../../src/render/rasterise.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlE;;;GAGG;AACH,KAAK,UAAU,WAAW,CACxB,MAAsB;IAEtB,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE9C,OAAO;QACL,eAAe,EAAE,MAAM,CAAC,WAAW;QACnC,SAAS,EAAE,MAAM,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;QAC5C,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,CAAC;KAC/D,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,eAAe,GAAe,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;IA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C,CAAC;IAEH,OAAO,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC,CAAC"}
@@ -0,0 +1,93 @@
1
+ Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+
5
+ This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
@@ -0,0 +1,93 @@
1
+ Copyright 2021 The Outfit Project Authors (https://github.com/Outfitio/Outfit-Fonts)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "repository": "https://github.com/KensioSoftware/colophon",
6
6
  "homepage": "https://github.com/KensioSoftware/colophon#readme",
7
7
  "license": "Apache-2.0",
8
- "version": "2.13.0",
8
+ "version": "2.13.1",
9
9
  "type": "module",
10
10
  "main": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts",
@@ -41,10 +41,12 @@
41
41
  },
42
42
  "browser": {
43
43
  "./dist/platform/read-file.node.js": "./dist/platform/read-file.browser.js",
44
- "./dist/platform/rasteriser.node.js": "./dist/platform/rasteriser.browser.js"
44
+ "./dist/platform/rasteriser.node.js": "./dist/platform/rasteriser.browser.js",
45
+ "./dist/platform/bundled-fonts.node.js": "./dist/platform/bundled-fonts.browser.js"
45
46
  },
46
47
  "files": [
47
48
  "dist",
49
+ "fonts",
48
50
  "README.md",
49
51
  "LICENSE"
50
52
  ],