@kensio/colophon 2.12.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 (104) hide show
  1. package/README.md +8 -4
  2. package/dist/config/defaults.d.ts +32 -4
  3. package/dist/config/defaults.d.ts.map +1 -1
  4. package/dist/config/defaults.js +32 -4
  5. package/dist/config/defaults.js.map +1 -1
  6. package/dist/config/index.d.ts.map +1 -1
  7. package/dist/config/index.js +2 -1
  8. package/dist/config/index.js.map +1 -1
  9. package/dist/config/resolve.d.ts +13 -0
  10. package/dist/config/resolve.d.ts.map +1 -1
  11. package/dist/config/resolve.js +14 -8
  12. package/dist/config/resolve.js.map +1 -1
  13. package/dist/config/size.d.ts.map +1 -1
  14. package/dist/config/size.js +3 -0
  15. package/dist/config/size.js.map +1 -1
  16. package/dist/fonts/bundled.d.ts +38 -0
  17. package/dist/fonts/bundled.d.ts.map +1 -0
  18. package/dist/fonts/bundled.js +29 -0
  19. package/dist/fonts/bundled.js.map +1 -0
  20. package/dist/fonts/index.d.ts +1 -0
  21. package/dist/fonts/index.d.ts.map +1 -1
  22. package/dist/fonts/index.js +1 -0
  23. package/dist/fonts/index.js.map +1 -1
  24. package/dist/layout/fill.d.ts +32 -0
  25. package/dist/layout/fill.d.ts.map +1 -0
  26. package/dist/layout/fill.js +34 -0
  27. package/dist/layout/fill.js.map +1 -0
  28. package/dist/layout/index.d.ts +4 -2
  29. package/dist/layout/index.d.ts.map +1 -1
  30. package/dist/layout/index.js +2 -1
  31. package/dist/layout/index.js.map +1 -1
  32. package/dist/measure/faces.d.ts.map +1 -1
  33. package/dist/measure/faces.js +29 -5
  34. package/dist/measure/faces.js.map +1 -1
  35. package/dist/measure/index.d.ts.map +1 -1
  36. package/dist/measure/index.js +0 -0
  37. package/dist/measure/index.js.map +1 -1
  38. package/dist/platform/bundled-fonts.browser.d.ts +16 -0
  39. package/dist/platform/bundled-fonts.browser.d.ts.map +1 -0
  40. package/dist/platform/bundled-fonts.browser.js +17 -0
  41. package/dist/platform/bundled-fonts.browser.js.map +1 -0
  42. package/dist/platform/bundled-fonts.node.d.ts +18 -0
  43. package/dist/platform/bundled-fonts.node.d.ts.map +1 -0
  44. package/dist/platform/bundled-fonts.node.js +49 -0
  45. package/dist/platform/bundled-fonts.node.js.map +1 -0
  46. package/dist/render/rasterise.d.ts.map +1 -1
  47. package/dist/render/rasterise.js +8 -3
  48. package/dist/render/rasterise.js.map +1 -1
  49. package/dist/render/svg.js +1 -1
  50. package/dist/render/svg.js.map +1 -1
  51. package/dist/templates/index.d.ts +1 -0
  52. package/dist/templates/index.d.ts.map +1 -1
  53. package/dist/templates/index.js +3 -0
  54. package/dist/templates/index.js.map +1 -1
  55. package/dist/templates/thumbnail/index.d.ts +21 -0
  56. package/dist/templates/thumbnail/index.d.ts.map +1 -0
  57. package/dist/templates/thumbnail/index.js +68 -0
  58. package/dist/templates/thumbnail/index.js.map +1 -0
  59. package/dist/templates/thumbnail/lines.d.ts +38 -0
  60. package/dist/templates/thumbnail/lines.d.ts.map +1 -0
  61. package/dist/templates/thumbnail/lines.js +76 -0
  62. package/dist/templates/thumbnail/lines.js.map +1 -0
  63. package/dist/text/fill.d.ts +34 -0
  64. package/dist/text/fill.d.ts.map +1 -0
  65. package/dist/text/fill.js +57 -0
  66. package/dist/text/fill.js.map +1 -0
  67. package/dist/text/fit.d.ts.map +1 -1
  68. package/dist/text/fit.js +2 -6
  69. package/dist/text/fit.js.map +1 -1
  70. package/dist/text/index.d.ts +2 -0
  71. package/dist/text/index.d.ts.map +1 -1
  72. package/dist/text/index.js +1 -0
  73. package/dist/text/index.js.map +1 -1
  74. package/dist/text/step.d.ts +13 -0
  75. package/dist/text/step.d.ts.map +1 -0
  76. package/dist/text/step.js +17 -0
  77. package/dist/text/step.js.map +1 -0
  78. package/dist/text/unbroken.d.ts +22 -0
  79. package/dist/text/unbroken.d.ts.map +1 -0
  80. package/dist/text/unbroken.js +29 -0
  81. package/dist/text/unbroken.js.map +1 -0
  82. package/dist/texture/index.d.ts +14 -2
  83. package/dist/texture/index.d.ts.map +1 -1
  84. package/dist/texture/index.js +22 -3
  85. package/dist/texture/index.js.map +1 -1
  86. package/dist/texture/resolve.d.ts +10 -0
  87. package/dist/texture/resolve.d.ts.map +1 -1
  88. package/dist/texture/resolve.js +15 -0
  89. package/dist/texture/resolve.js.map +1 -1
  90. package/dist/types.d.ts +28 -0
  91. package/dist/types.d.ts.map +1 -1
  92. package/dist/validate/keys.d.ts.map +1 -1
  93. package/dist/validate/keys.js +2 -0
  94. package/dist/validate/keys.js.map +1 -1
  95. package/fonts/JetBrainsMono-LICENSE.txt +93 -0
  96. package/fonts/JetBrainsMono_400Regular.ttf +0 -0
  97. package/fonts/JetBrainsMono_700Bold.ttf +0 -0
  98. package/fonts/Outfit-LICENSE.txt +93 -0
  99. package/fonts/Outfit_400Regular.ttf +0 -0
  100. package/fonts/Outfit_500Medium.ttf +0 -0
  101. package/fonts/Outfit_600SemiBold.ttf +0 -0
  102. package/fonts/Outfit_700Bold.ttf +0 -0
  103. package/fonts/Outfit_800ExtraBold.ttf +0 -0
  104. 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
 
@@ -196,7 +197,10 @@ gallery stays in sync.
196
197
  <img src="docs/samples/docs-wide.png" alt="docs template, landscape" width="100%" /><br />
197
198
  <sub><code>docs</code> · 1200×630 · breadcrumb, title and summary</sub>
198
199
  </td>
199
- <td></td>
200
+ <td>
201
+ <img src="docs/samples/thumbnail-video.png" alt="thumbnail template, 16:9" width="100%" /><br />
202
+ <sub><code>thumbnail</code> · 1280×720 · title grown to fill the frame, texture scaled up</sub>
203
+ </td>
200
204
  </tr>
201
205
  </table>
202
206
 
@@ -1,4 +1,19 @@
1
1
  import type { BrandColors, CodeStyle, OutputFormat, OutputSize } from "../types.js";
2
+ /**
3
+ * How much larger a texture is drawn on the `thumbnail` preset.
4
+ *
5
+ * A thumbnail is uploaded at 1280 wide and shown at somewhere between about
6
+ * 360 and 170, so a dot grid at its default 44px spacing arrives at the reader
7
+ * about 10px apart, which is not a texture any more but a slightly dirty
8
+ * background. Three is the factor for the largest of those, and it is the
9
+ * conservative choice: a treatment that is a little too coarse still reads as
10
+ * a treatment, where one that is too fine reads as nothing at all.
11
+ */
12
+ export declare const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
13
+ /**
14
+ * The texture scale everything else is drawn at, which is to say, unchanged.
15
+ */
16
+ export declare const DEFAULT_TEXTURE_SCALE = 1;
2
17
  /**
3
18
  * Named output-size presets covering the common social-image standards. Each
4
19
  * `name` becomes the filename suffix (e.g. `my-post-og.png`).
@@ -8,6 +23,9 @@ import type { BrandColors, CodeStyle, OutputFormat, OutputSize } from "../types.
8
23
  * - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
9
24
  * - `twitter`: 2:1, X/Twitter `summary_large_image` card.
10
25
  * - `pinterest`: 2:3 tall pin.
26
+ * - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
27
+ * at. It is the one preset carrying an override of its own, for the reason
28
+ * {@link SizeOverrides.textureScale} gives.
11
29
  */
12
30
  export declare const SIZE_PRESETS: {
13
31
  readonly og: {
@@ -30,6 +48,12 @@ export declare const SIZE_PRESETS: {
30
48
  readonly width: 1000;
31
49
  readonly height: 1500;
32
50
  };
51
+ readonly thumbnail: {
52
+ readonly name: "thumbnail";
53
+ readonly width: 1280;
54
+ readonly height: 720;
55
+ readonly textureScale: 3;
56
+ };
33
57
  };
34
58
  /**
35
59
  * Default output sizes: the Open Graph landscape plus a square. Between them
@@ -37,11 +61,15 @@ export declare const SIZE_PRESETS: {
37
61
  */
38
62
  export declare const DEFAULT_SIZES: readonly OutputSize[];
39
63
  /**
40
- * Default font stack, used when no fonts are configured. It names families and
41
- * hopes the machine has them, which is exactly what `config.fonts` exists to
42
- * 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.
43
71
  */
44
- export declare const DEFAULT_FONT_FAMILY = "Arial, Helvetica, sans-serif";
72
+ export declare const DEFAULT_FONT_FAMILY = "Outfit, \"Helvetica Neue\", Helvetica, Arial, sans-serif";
45
73
  /**
46
74
  * Default zlib level for the rendered PNG: the strongest there is.
47
75
  *
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,UAAU,EACX,MAAM,aAAa,CAAC;AAErB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY;;iBACjB,IAAI,EAAE,IAAI;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBAChC,IAAI,EAAE,QAAQ;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;;iBACxC,IAAI,EAAE,SAAS;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,GAAG;;;iBACvC,IAAI,EAAE,WAAW;iBAAE,KAAK,EAAE,IAAI;iBAAE,MAAM,EAAE,IAAI;;CACZ,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG9C,CAAC;AAEF;;;;G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M,EAAE,GAAG;iBACX,YAAY;;CAE+B,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,UAAU,EAG9C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,6DAC0B,CAAC;AAE3D;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAoB,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,KAAK,CAAC;AAE/B,wEAAwE;AACxE,eAAO,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"}
@@ -1,3 +1,18 @@
1
+ /**
2
+ * How much larger a texture is drawn on the `thumbnail` preset.
3
+ *
4
+ * A thumbnail is uploaded at 1280 wide and shown at somewhere between about
5
+ * 360 and 170, so a dot grid at its default 44px spacing arrives at the reader
6
+ * about 10px apart, which is not a texture any more but a slightly dirty
7
+ * background. Three is the factor for the largest of those, and it is the
8
+ * conservative choice: a treatment that is a little too coarse still reads as
9
+ * a treatment, where one that is too fine reads as nothing at all.
10
+ */
11
+ export const DEFAULT_THUMBNAIL_TEXTURE_SCALE = 3;
12
+ /**
13
+ * The texture scale everything else is drawn at, which is to say, unchanged.
14
+ */
15
+ export const DEFAULT_TEXTURE_SCALE = 1;
1
16
  /**
2
17
  * Named output-size presets covering the common social-image standards. Each
3
18
  * `name` becomes the filename suffix (e.g. `my-post-og.png`).
@@ -7,12 +22,21 @@
7
22
  * - `square`: 1:1, X/Twitter `summary` card and a universal fallback.
8
23
  * - `twitter`: 2:1, X/Twitter `summary_large_image` card.
9
24
  * - `pinterest`: 2:3 tall pin.
25
+ * - `thumbnail`: 16:9, the size YouTube asks video thumbnails to be uploaded
26
+ * at. It is the one preset carrying an override of its own, for the reason
27
+ * {@link SizeOverrides.textureScale} gives.
10
28
  */
11
29
  export const SIZE_PRESETS = {
12
30
  og: { name: "og", width: 1200, height: 630 },
13
31
  square: { name: "square", width: 1200, height: 1200 },
14
32
  twitter: { name: "twitter", width: 1200, height: 600 },
15
33
  pinterest: { name: "pinterest", width: 1000, height: 1500 },
34
+ thumbnail: {
35
+ name: "thumbnail",
36
+ width: 1280,
37
+ height: 720,
38
+ textureScale: DEFAULT_THUMBNAIL_TEXTURE_SCALE,
39
+ },
16
40
  };
17
41
  /**
18
42
  * Default output sizes: the Open Graph landscape plus a square. Between them
@@ -23,11 +47,15 @@ export const DEFAULT_SIZES = [
23
47
  SIZE_PRESETS.square,
24
48
  ];
25
49
  /**
26
- * Default font stack, used when no fonts are configured. It names families and
27
- * hopes the machine has them, which is exactly what `config.fonts` exists to
28
- * 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.
29
57
  */
30
- export const DEFAULT_FONT_FAMILY = "Arial, Helvetica, sans-serif";
58
+ export const DEFAULT_FONT_FAMILY = 'Outfit, "Helvetica Neue", Helvetica, Arial, sans-serif';
31
59
  /**
32
60
  * Default zlib level for the rendered PNG: the strongest there is.
33
61
  *
@@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../src/config/defaults.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAE,EAAE,EAAE,IAA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H,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;GAGG;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"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAcvB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAAC;AAUzB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,cAAmB,GAAG,cAAc,CAsCxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EAErB,cAAc,EACf,MAAM,aAAa,CAAC;AAcrB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAcvB;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,cAAc,CAAC;AACrE;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,qBAAqB,GAC7B,qBAAqB,CAAC;AAUzB;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,GAAE,cAAmB,GAAG,cAAc,CAuCxE"}
@@ -5,7 +5,7 @@ import { resolveOptionalImage } from "../image/index.js";
5
5
  import { defaultRasteriser } from "../platform/rasteriser.node.js";
6
6
  import { builtinTemplates } from "../templates/index.js";
7
7
  import { applyTheme } from "../theme/index.js";
8
- import { resolveTexture } from "../texture/index.js";
8
+ import { resolveTexture, resolveTextureScale } from "../texture/index.js";
9
9
  import { validateConfig } from "../validate/index.js";
10
10
  import { DEFAULT_FONT_FAMILY, DEFAULT_FORMAT } from "./defaults.js";
11
11
  import { resolveMaxBytes, resolveQuality } from "./output.js";
@@ -49,6 +49,7 @@ export function resolveConfig(input = {}) {
49
49
  colors,
50
50
  background: resolveBackground(config.background) ?? defaultBackground(colors),
51
51
  texture: resolveTexture(config.texture, colors),
52
+ textureScale: resolveTextureScale(config.textureScale),
52
53
  fonts,
53
54
  systemFonts: shouldLoadSystemFonts(config.systemFonts, fonts),
54
55
  // A project that supplies one font should not have to name it twice.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,0DAA0D;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAOrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,uBAAuB,EACvB,YAAY,EACZ,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GACb,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,SAAS,aAAa,CAAC,OAAe;IACpC,4EAA4E;IAC5E,iCAAiC;IACjC,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,aAAa,OAAO,EAAE,CAAC,CAAC;AACvC,CAAC;AAeD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAA2B;IACtD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;GA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CAAC;QACjC,SAAS,EAAE,EAAE,GAAG,gBAAgB,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE;QACvD,4EAA4E;QAC5E,uEAAuE;QACvE,wEAAwE;QACxE,uCAAuC;QACvC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,iBAAiB;QAClD,gBAAgB,EAAE,uBAAuB,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAClE,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,KAAK;QAClC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,cAAc;QACvC,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC;QACvC,QAAQ,EAAE,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC;QAC1C,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;KACjC,CAAC;AACJ,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,MAAM,EAAE,kBAAkB,CAAC,UAAU,CAAC,MAAM,EAAE,mBAAmB,CAAC;KACnE,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,iBAAiB,CAAC,MAA6B;IAC7D,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE;YACL,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE;YACzC,EAAE,MAAM,EAAE,KAAK,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AK,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,CAiBhB"}
1
+ {"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../src/config/size.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,cAAc,EACd,UAAU,EACV,cAAc,EAEf,MAAM,aAAa,CAAC;AAyBrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,IAAI,EAAE,UAAU,GACf,cAAc,CAoBhB"}
@@ -48,6 +48,9 @@ export function resolveConfigForSize(config, size) {
48
48
  colors: mergeColors(base.colors, size.theme ?? base.theme, size.colors),
49
49
  }),
50
50
  ...(size.texture !== undefined && { texture: size.texture }),
51
+ ...(size.textureScale !== undefined && {
52
+ textureScale: size.textureScale,
53
+ }),
51
54
  ...(size.code !== undefined && { code: { ...base.code, ...size.code } }),
52
55
  ...(size.background !== undefined && { background: size.background }),
53
56
  ...(size.fontFamily !== undefined && { fontFamily: size.fontFamily }),
@@ -1 +1 @@
1
- {"version":3,"file":"size.js","sourceRoot":"","sources":["../../src/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AM,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC;SACxE,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC5D,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI;YACrC,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QACxE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;QACzD,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;KACpD,CAAC,CAAC;AACL,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"}
@@ -0,0 +1,32 @@
1
+ import type { MeasureText } from "../types.js";
2
+ import type { TextLine } from "./block.js";
3
+ /** One group of a template's text, and the box it has to fill. */
4
+ export interface FilledBlock {
5
+ readonly maxWidth: number;
6
+ readonly maxHeight: number;
7
+ /** The advance used both to fit the lines and to draw them, so they agree. */
8
+ readonly lineHeight: number;
9
+ /** The largest size to try, which short text ends up drawn at. */
10
+ readonly maxFontSize: number;
11
+ /** The size below which the text is cut rather than shrunk any further. */
12
+ readonly minFontSize: number;
13
+ readonly fontWeight: number;
14
+ readonly opacity: number;
15
+ /** Space inserted before the group's first line, to separate it from the last. */
16
+ readonly gapBefore?: number;
17
+ }
18
+ /**
19
+ * Fit one group of a template's text to a box, and return its lines.
20
+ *
21
+ * The sibling of `blockLines`, for the layouts where the text is the picture
22
+ * rather than a heading in it. Both take a prop that may not be there and give
23
+ * back nothing at all when it is missing; what differs is what decides the
24
+ * size. See {@link fillText} for which of the two a layout wants.
25
+ *
26
+ * `lineHeight` is here rather than left to `drawLines` because the fitting has
27
+ * to know it: how tall a block of lines is is what the search is measuring
28
+ * against. Pass the same value to both, or the block that was fitted is not
29
+ * the block that gets drawn.
30
+ */
31
+ export declare function fillLines(value: unknown, measure: MeasureText, fontFamily: string, block: FilledBlock): TextLine[];
32
+ //# sourceMappingURL=fill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.d.ts","sourceRoot":"","sources":["../../src/layout/fill.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,kEAAkE;AAClE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,WAAW,GACjB,QAAQ,EAAE,CAqBZ"}
@@ -0,0 +1,34 @@
1
+ import { optionalString } from "../props.js";
2
+ import { fillText } from "../text/index.js";
3
+ import { measureIn } from "./measure.js";
4
+ /**
5
+ * Fit one group of a template's text to a box, and return its lines.
6
+ *
7
+ * The sibling of `blockLines`, for the layouts where the text is the picture
8
+ * rather than a heading in it. Both take a prop that may not be there and give
9
+ * back nothing at all when it is missing; what differs is what decides the
10
+ * size. See {@link fillText} for which of the two a layout wants.
11
+ *
12
+ * `lineHeight` is here rather than left to `drawLines` because the fitting has
13
+ * to know it: how tall a block of lines is is what the search is measuring
14
+ * against. Pass the same value to both, or the block that was fitted is not
15
+ * the block that gets drawn.
16
+ */
17
+ export function fillLines(value, measure, fontFamily, block) {
18
+ const fitted = fillText(optionalString(value) ?? "", measureIn(measure, fontFamily, block.fontWeight), {
19
+ maxWidth: block.maxWidth,
20
+ maxHeight: block.maxHeight,
21
+ lineHeight: block.lineHeight,
22
+ maxFontSize: block.maxFontSize,
23
+ minFontSize: block.minFontSize,
24
+ });
25
+ return fitted.lines.map((text, index) => ({
26
+ text,
27
+ fontSize: fitted.fontSize,
28
+ fontWeight: block.fontWeight,
29
+ opacity: block.opacity,
30
+ ...(index === 0 &&
31
+ block.gapBefore !== undefined && { gapBefore: block.gapBefore }),
32
+ }));
33
+ }
34
+ //# sourceMappingURL=fill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fill.js","sourceRoot":"","sources":["../../src/layout/fill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAkBzC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS,CACvB,KAAc,EACd,OAAoB,EACpB,UAAkB,EAClB,KAAkB;IAElB,MAAM,MAAM,GAAe,QAAQ,CACjC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAC3B,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,EAChD;QACE,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,WAAW,EAAE,KAAK,CAAC,WAAW;KAC/B,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACxC,IAAI;QACJ,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,GAAG,CAAC,KAAK,KAAK,CAAC;YACb,KAAK,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;KACnE,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -30,6 +30,8 @@ export type { StackedRect } from "./stack.js";
30
30
  export type { Align, BoxStyle, Extent, Placed, Rect, Span } from "./types.js";
31
31
  export { blockLines } from "./block.js";
32
32
  export type { StyledBlock, TextBlock, TextLine } from "./block.js";
33
+ export { fillLines } from "./fill.js";
34
+ export type { FilledBlock } from "./fill.js";
33
35
  export { lineExtents, linesHeight } from "./extent.js";
34
36
  export { drawLines } from "./draw.js";
35
37
  export type { LinesStyle } from "./draw.js";
@@ -37,7 +39,7 @@ export { baselineFor, placeLines } from "./lines.js";
37
39
  export type { PlacedLine } from "./lines.js";
38
40
  export { measureIn } from "./measure.js";
39
41
  export { optionalString, stringList } from "../props.js";
40
- export { clampLine, escapeXml, fitText, textElement, wrapText, } from "../text/index.js";
41
- export type { FitOptions, FittedText, MeasureAt, MeasureLine, TextAttributes, } from "../text/index.js";
42
+ export { clampLine, escapeXml, fillText, fitText, textElement, wrapText, } from "../text/index.js";
43
+ export type { FillOptions, FitOptions, FittedText, MeasureAt, MeasureLine, TextAttributes, } from "../text/index.js";
42
44
  export type { Dimensions, MeasureText, MetaImageProps, ResolvedConfig, Template, TemplateContext, TextStyle, } from "../types.js";
43
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,M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AAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACR,eAAe,EACf,SAAS,GACV,MAAM,aAAa,CAAC"}
@@ -23,10 +23,11 @@ export { row } from "./row.js";
23
23
  export { scrim } from "./scrim.js";
24
24
  export { stack } from "./stack.js";
25
25
  export { blockLines } from "./block.js";
26
+ export { fillLines } from "./fill.js";
26
27
  export { lineExtents, linesHeight } from "./extent.js";
27
28
  export { drawLines } from "./draw.js";
28
29
  export { baselineFor, placeLines } from "./lines.js";
29
30
  export { measureIn } from "./measure.js";
30
31
  export { optionalString, stringList } from "../props.js";
31
- export { clampLine, escapeXml, fitText, textElement, wrapText, } from "../text/index.js";
32
+ export { clampLine, escapeXml, fillText, fitText, textElement, wrapText, } from "../text/index.js";
32
33
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/layout/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;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,YAAY,CAAC;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACT,MAAM,kBAAkB,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,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAc9D;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAwC,CAAC;AAEnE;;;;;;GAMG;AACH,SAAS,MAAM,CAAC,IAAU;IACxB,MAAM,QAAQ,GAAG,IAIhB,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,UAAU,IAAI,EAAE;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,IAAI,GAAG;QAC9C,IAAI;KACL,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,SAAS,OAAO,CAAC,MAAyC;IACxD,OAAO,OAAO,IAAI,MAAM;QACtB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACvB,CAAC;AAED;;;;;;;;GAQG;AACH,KAAK,UAAU,IAAI,CACjB,IAAgB,EAChB,SAAyB;IAEzB,IAAI,CAAC;QACH,yEAAyE;QACzE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CAAC,CAAC;QAC/D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC/D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,KAA4B,EAC5B,SAAyB;IAEzB,MAAM,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"}