@format.dev/fonts 0.1.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +5 -3
  2. package/fonts/fonts.json +88 -4
  3. package/fonts/math/STIXTwoMath-Regular.ttf +0 -0
  4. package/fonts/math/format-math.woff2 +0 -0
  5. package/fonts/static/serif/FormatSerif-200-Italic.ttf +0 -0
  6. package/fonts/static/serif/FormatSerif-200-Italic.woff2 +0 -0
  7. package/fonts/static/serif/FormatSerif-200.ttf +0 -0
  8. package/fonts/static/serif/FormatSerif-200.woff2 +0 -0
  9. package/fonts/static/serif/FormatSerif-300-Italic.ttf +0 -0
  10. package/fonts/static/serif/FormatSerif-300-Italic.woff2 +0 -0
  11. package/fonts/static/serif/FormatSerif-300.ttf +0 -0
  12. package/fonts/static/serif/FormatSerif-300.woff2 +0 -0
  13. package/fonts/static/serif/FormatSerif-400-Italic.ttf +0 -0
  14. package/fonts/static/serif/FormatSerif-400-Italic.woff2 +0 -0
  15. package/fonts/static/serif/FormatSerif-400.ttf +0 -0
  16. package/fonts/static/serif/FormatSerif-400.woff2 +0 -0
  17. package/fonts/static/serif/FormatSerif-500-Italic.ttf +0 -0
  18. package/fonts/static/serif/FormatSerif-500-Italic.woff2 +0 -0
  19. package/fonts/static/serif/FormatSerif-500.ttf +0 -0
  20. package/fonts/static/serif/FormatSerif-500.woff2 +0 -0
  21. package/fonts/static/serif/FormatSerif-600-Italic.ttf +0 -0
  22. package/fonts/static/serif/FormatSerif-600-Italic.woff2 +0 -0
  23. package/fonts/static/serif/FormatSerif-600.ttf +0 -0
  24. package/fonts/static/serif/FormatSerif-600.woff2 +0 -0
  25. package/fonts/static/serif/FormatSerif-700-Italic.ttf +0 -0
  26. package/fonts/static/serif/FormatSerif-700-Italic.woff2 +0 -0
  27. package/fonts/static/serif/FormatSerif-700.ttf +0 -0
  28. package/fonts/static/serif/FormatSerif-700.woff2 +0 -0
  29. package/fonts/static/serif/FormatSerif-800-Italic.ttf +0 -0
  30. package/fonts/static/serif/FormatSerif-800-Italic.woff2 +0 -0
  31. package/fonts/static/serif/FormatSerif-800.ttf +0 -0
  32. package/fonts/static/serif/FormatSerif-800.woff2 +0 -0
  33. package/fonts/static/serif/FormatSerif-900-Italic.ttf +0 -0
  34. package/fonts/static/serif/FormatSerif-900-Italic.woff2 +0 -0
  35. package/fonts/static/serif/FormatSerif-900.ttf +0 -0
  36. package/fonts/static/serif/FormatSerif-900.woff2 +0 -0
  37. package/fonts/static.css +42 -0
  38. package/fonts/variable/serif/FormatSerif-Italic.ttf +0 -0
  39. package/fonts/variable/serif/FormatSerif-Italic.woff2 +0 -0
  40. package/fonts/variable/serif/FormatSerif.ttf +0 -0
  41. package/fonts/variable/serif/FormatSerif.woff2 +0 -0
  42. package/fonts/variable.css +2 -2
  43. package/manifest.json +2 -2
  44. package/package.json +2 -2
package/README.md CHANGED
@@ -35,7 +35,9 @@ A static cut embeds as a CID subset, and Format writes its text in one of two wa
35
35
 
36
36
  A glyph lands exactly only when its advance is exact in binary floating point. That advance is the glyph's stored width times the font size over the units-per-em, and the division is exact only when the units-per-em is a power of two and the size is a whole pixel. Mono's source, JetBrains Mono, carries a 1000-unit em, so the division leaves a remainder that accrues on every glyph, and Format writes a separate instruction for nearly every one.
37
37
 
38
- The build therefore re-ems any static face that isn't already on a power-of-two em onto a 2048-unit grid (`scale_upem` in `build-fonts.py`). Only the internal grid moves: outlines, advances, kerning, and vertical metrics all scale by the same ratio, so the face looks identical, and the largest coordinate shift lands a few thousandths of a pixel at reading size. The two 1000-em faces, Mono and the copied-through Math face, drop from one instruction per glyph to fully packed runs. Serif (1024) and Sans (2048) are already on a power-of-two em, so they pack as-is and pass through. Emoji and Tofu are colour faces the PDF draws per-glyph regardless, so they pass through too; Tofu is Format's own font, so its em is fixed on a power of two in the tofu package's generator, not here. The variable masters keep their source em, since the `fidelity` path embeds them as Type 3 and writes each glyph separately regardless of the em.
38
+ The build therefore re-ems a static face that isn't already on a power-of-two em onto a 2048-unit grid (`scale_upem` in `build-fonts.py`). Only the internal grid moves: outlines, advances, kerning, and vertical metrics all scale by the same ratio, so the face looks identical, and the largest coordinate shift lands a few thousandths of a pixel at reading size. Mono drops from one instruction per glyph to fully packed runs. Serif (1024) and Sans (2048) are already on a power-of-two em, so they pack as-is and pass through. Emoji and Tofu are colour faces the PDF draws per-glyph regardless, so they pass through too; Tofu is Format's own font, so its em is fixed on a power of two in the tofu package's generator, not here. The variable masters keep their source em, since the `fidelity` path embeds them as Type 3 and writes each glyph separately regardless of the em.
39
+
40
+ Math also carries a 1000-unit em, but the build copies it through byte-for-byte, because the rescale leaves two parts of STIX Two Math at the old em. The first is its TrueType hinting. Its control values hold 1000-unit heights, and PDFium (Chrome's built-in PDF viewer) runs a font's hinting instructions when it draws embedded text, so a rescaled Math face draws at about half height there. The second is the MATH table's integer dimensions, which MathML layout reads to size large operators and to build stretched delimiters, radicals, and accents. Mono carries neither, so its re-em stays lossless. Keeping Math on its source em means its glyphs can take the per-glyph path described above, which can make compact PDFs of math-heavy documents larger.
39
41
 
40
42
  ## Families
41
43
 
@@ -75,7 +77,7 @@ For bundlers (Vite), the package also ships the two stylesheets prebuilt — `@f
75
77
  sources/ variable masters (Sans/Serif/Mono) + static Emoji/Math/Tofu — the inputs
76
78
  manifest.json families, weight ranges and step, optical sizes, emoji unicode-ranges
77
79
  scripts/
78
- build-fonts.py instances, rebrands, re-ems any non-power-of-two face to 2048 (Mono; Math on copy-through), and compresses the masters to woff2 + ttf; copies the static families; writes fonts/fonts.json
80
+ build-fonts.py instances, rebrands, re-ems a non-power-of-two face to 2048 (Mono; Math keeps its 1000-unit em), and compresses the masters to woff2 + ttf; copies the static families; writes fonts/fonts.json
79
81
  emit-css.mjs writes fonts/static.css and fonts/variable.css from fonts.json
80
82
  fonts/ generated, committed: woff2 + ttf, fonts.json descriptors, static.css, variable.css
81
83
  src/
@@ -93,7 +95,7 @@ pip install -r requirements.txt # fonttools + brotli
93
95
  pnpm --filter "@format.dev/fonts" build:fonts # rebuilds fonts/ and re-emits the stylesheets
94
96
  ```
95
97
 
96
- CI runs `pnpm --filter @format.dev/fonts check:fonts`, which fails if `fonts/` is stale.
98
+ No CI job runs `check:fonts`. A rebuild stamps its own modification time into every face, and `emit-css.mjs` writes the stylesheets without the Prettier wrapping the committed copies carry, so the diff that `check:fonts` runs reports changes after any rebuild. CI checks the committed fonts in two other places. The press workflow runs this package's tests (`pnpm --filter @format.dev/fonts test`), which check that both Math deliveries, the TTF and the WOFF2, are byte-identical to their sources. In the same workflow, the PDF suite renders the engine's fixture corpus, MathML included, through the TTF faces installed in the service image, so a change to a face that press embeds fails the suite as structural or pixel drift.
97
99
 
98
100
  ## Future: demand-driven instancing
99
101
 
package/fonts/fonts.json CHANGED
@@ -535,6 +535,62 @@
535
535
  "ttf": "variable/sans/FormatSans-Italic.ttf",
536
536
  "postscriptName": "FormatSans-VariableItalic"
537
537
  },
538
+ {
539
+ "variant": "static",
540
+ "family": "Format Serif",
541
+ "weight": 200,
542
+ "style": "normal",
543
+ "optical": null,
544
+ "deliveries": [
545
+ "url",
546
+ "local"
547
+ ],
548
+ "woff2": "static/serif/FormatSerif-200.woff2",
549
+ "ttf": "static/serif/FormatSerif-200.ttf",
550
+ "postscriptName": "FormatSerif-ExtraLight"
551
+ },
552
+ {
553
+ "variant": "static",
554
+ "family": "Format Serif",
555
+ "weight": 200,
556
+ "style": "italic",
557
+ "optical": null,
558
+ "deliveries": [
559
+ "url",
560
+ "local"
561
+ ],
562
+ "woff2": "static/serif/FormatSerif-200-Italic.woff2",
563
+ "ttf": "static/serif/FormatSerif-200-Italic.ttf",
564
+ "postscriptName": "FormatSerif-ExtraLightItalic"
565
+ },
566
+ {
567
+ "variant": "static",
568
+ "family": "Format Serif",
569
+ "weight": 300,
570
+ "style": "normal",
571
+ "optical": null,
572
+ "deliveries": [
573
+ "url",
574
+ "local"
575
+ ],
576
+ "woff2": "static/serif/FormatSerif-300.woff2",
577
+ "ttf": "static/serif/FormatSerif-300.ttf",
578
+ "postscriptName": "FormatSerif-Light"
579
+ },
580
+ {
581
+ "variant": "static",
582
+ "family": "Format Serif",
583
+ "weight": 300,
584
+ "style": "italic",
585
+ "optical": null,
586
+ "deliveries": [
587
+ "url",
588
+ "local"
589
+ ],
590
+ "woff2": "static/serif/FormatSerif-300-Italic.woff2",
591
+ "ttf": "static/serif/FormatSerif-300-Italic.ttf",
592
+ "postscriptName": "FormatSerif-LightItalic"
593
+ },
538
594
  {
539
595
  "variant": "static",
540
596
  "family": "Format Serif",
@@ -675,12 +731,40 @@
675
731
  "ttf": "static/serif/FormatSerif-800-Italic.ttf",
676
732
  "postscriptName": "FormatSerif-ExtraBoldItalic"
677
733
  },
734
+ {
735
+ "variant": "static",
736
+ "family": "Format Serif",
737
+ "weight": 900,
738
+ "style": "normal",
739
+ "optical": null,
740
+ "deliveries": [
741
+ "url",
742
+ "local"
743
+ ],
744
+ "woff2": "static/serif/FormatSerif-900.woff2",
745
+ "ttf": "static/serif/FormatSerif-900.ttf",
746
+ "postscriptName": "FormatSerif-Black"
747
+ },
748
+ {
749
+ "variant": "static",
750
+ "family": "Format Serif",
751
+ "weight": 900,
752
+ "style": "italic",
753
+ "optical": null,
754
+ "deliveries": [
755
+ "url",
756
+ "local"
757
+ ],
758
+ "woff2": "static/serif/FormatSerif-900-Italic.woff2",
759
+ "ttf": "static/serif/FormatSerif-900-Italic.ttf",
760
+ "postscriptName": "FormatSerif-BlackItalic"
761
+ },
678
762
  {
679
763
  "variant": "variable",
680
764
  "family": "Format Serif",
681
765
  "weightRange": [
682
- 400,
683
- 800
766
+ 200,
767
+ 900
684
768
  ],
685
769
  "style": "normal",
686
770
  "deliveries": [
@@ -695,8 +779,8 @@
695
779
  "variant": "variable",
696
780
  "family": "Format Serif",
697
781
  "weightRange": [
698
- 400,
699
- 800
782
+ 200,
783
+ 900
700
784
  ],
701
785
  "style": "italic",
702
786
  "deliveries": [
Binary file
Binary file
package/fonts/static.css CHANGED
@@ -251,6 +251,34 @@
251
251
  font-display: block;
252
252
  src: url('./static/sans/FormatSansDisplay-900-Italic.woff2') format('woff2');
253
253
  }
254
+ @font-face {
255
+ font-family: 'Format Serif';
256
+ font-style: normal;
257
+ font-weight: 200;
258
+ font-display: block;
259
+ src: url('./static/serif/FormatSerif-200.woff2') format('woff2');
260
+ }
261
+ @font-face {
262
+ font-family: 'Format Serif';
263
+ font-style: italic;
264
+ font-weight: 200;
265
+ font-display: block;
266
+ src: url('./static/serif/FormatSerif-200-Italic.woff2') format('woff2');
267
+ }
268
+ @font-face {
269
+ font-family: 'Format Serif';
270
+ font-style: normal;
271
+ font-weight: 300;
272
+ font-display: block;
273
+ src: url('./static/serif/FormatSerif-300.woff2') format('woff2');
274
+ }
275
+ @font-face {
276
+ font-family: 'Format Serif';
277
+ font-style: italic;
278
+ font-weight: 300;
279
+ font-display: block;
280
+ src: url('./static/serif/FormatSerif-300-Italic.woff2') format('woff2');
281
+ }
254
282
  @font-face {
255
283
  font-family: 'Format Serif';
256
284
  font-style: normal;
@@ -321,6 +349,20 @@
321
349
  font-display: block;
322
350
  src: url('./static/serif/FormatSerif-800-Italic.woff2') format('woff2');
323
351
  }
352
+ @font-face {
353
+ font-family: 'Format Serif';
354
+ font-style: normal;
355
+ font-weight: 900;
356
+ font-display: block;
357
+ src: url('./static/serif/FormatSerif-900.woff2') format('woff2');
358
+ }
359
+ @font-face {
360
+ font-family: 'Format Serif';
361
+ font-style: italic;
362
+ font-weight: 900;
363
+ font-display: block;
364
+ src: url('./static/serif/FormatSerif-900-Italic.woff2') format('woff2');
365
+ }
324
366
  @font-face {
325
367
  font-family: 'Format Mono';
326
368
  font-style: normal;
@@ -16,14 +16,14 @@
16
16
  @font-face {
17
17
  font-family: 'Format Serif';
18
18
  font-style: normal;
19
- font-weight: 400 800;
19
+ font-weight: 200 900;
20
20
  font-display: block;
21
21
  src: url('./variable/serif/FormatSerif.woff2') format('woff2');
22
22
  }
23
23
  @font-face {
24
24
  font-family: 'Format Serif';
25
25
  font-style: italic;
26
- font-weight: 400 800;
26
+ font-weight: 200 900;
27
27
  font-display: block;
28
28
  src: url('./variable/serif/FormatSerif-Italic.woff2') format('woff2');
29
29
  }
package/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "Single source of truth for @format.dev/fonts. scripts/build-fonts.py reads this to instance the variable masters into static cuts + variable woff2 and writes dist/. Only Sans has an opsz axis (text/display); Serif/Mono are weight-only. Emoji/Math/Tofu are already static. The serif master's name-table copyright record (ID 0) reads 'Copyright 2026 Format' without the domain; the built cuts inherit it, and set_names leaves copyright records untouched by design — on the next serif rebuild, re-stamp ID 0 to 'Format (format.dev)' with fontTools before instancing.",
2
+ "$comment": "Single source of truth for @format.dev/fonts. scripts/build-fonts.py reads this to instance the variable masters into static cuts + variable woff2 and writes dist/. Only Sans has an opsz axis (text/display); Serif/Mono are weight-only. Emoji/Math/Tofu are already static.",
3
3
  "variable": {
4
4
  "sans": {
5
5
  "family": "Format Sans",
@@ -17,7 +17,7 @@
17
17
  "family": "Format Serif",
18
18
  "regular": "sources/serif/FMTCrimsonPro[wght].ttf",
19
19
  "italic": "sources/serif/FMTCrimsonPro-Italic[wght].ttf",
20
- "wght": [400, 800],
20
+ "wght": [200, 900],
21
21
  "weightStep": 100,
22
22
  "opsz": null
23
23
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@format.dev/fonts",
3
- "version": "0.1.3",
3
+ "version": "0.3.0",
4
4
  "license": "(MIT AND OFL-1.1)",
5
5
  "description": "Format's built-in font families (Sans/Serif/Mono/Emoji/Math/Tofu) as a single source of truth: static weight palettes + optical cuts + variable masters, with an @font-face CSS generator. Consumed identically by the previews and the PDF renderer so they never diverge.",
6
6
  "author": "the format.dev developers",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "scripts": {
59
59
  "clean": "rimraf dist",
60
- "build": "tsdown",
60
+ "build": "tsdown --config-loader native",
61
61
  "dev": "tsdown --watch",
62
62
  "typecheck": "tsc -p tsconfig.json --noEmit",
63
63
  "build:fonts": "python3 scripts/build-fonts.py && node scripts/emit-css.mjs",