ntk 8.14.3 → 8.14.4

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.
@@ -42,14 +42,20 @@ const RPC_TIMEOUT = 2000;
42
42
  * The token naming one shared font page: content-addressed, because the
43
43
  * generator's input is a font file far too big to name literally.
44
44
  *
45
- * ntkg1:<sha1 of font file bytes>:<variation coords>:<px size>:<format>
45
+ * ntkg2:<sha1 of font file bytes>:<face>:<variation coords>:<px size>:<format>
46
46
  *
47
- * The `ntkg1` version prefix is load-bearing, not hygiene: advances are
47
+ * The `ntkg2` version prefix is load-bearing, not hygiene: advances are
48
48
  * baked into glyphs at AddGlyphs time and idempotent duplicate uploads
49
49
  * assume byte-identical rasterization, both of which hold only among
50
50
  * processes running the same rasterizer and rounding. Change either — bump
51
51
  * the version, and two ntk versions on one display simply share nothing.
52
52
  *
53
+ * `<face>` is the face's PostScript name, because a file is not a face. A
54
+ * collection — Helvetica.ttc, a .dfont — holds several, which number their
55
+ * glyphs alike, and `ntkg1` named a page by the file alone: Helvetica and
56
+ * Helvetica-Bold were one page, and whichever face uploaded a glyph first
57
+ * was what both drew, in every ntk app on the display.
58
+ *
53
59
  * The sha1 is computed from the loaded font buffer, lazily on first shared
54
60
  * use, and cached on the base face (a variation instance hashes the same
55
61
  * file its base was cut from). `null` — no buffer to hash, or no crypto in
@@ -68,7 +74,8 @@ export function fontPageToken(font, size) {
68
74
  base._ntkSha1 = crypto ? crypto.createHash('sha1').update(buffer).digest('hex') : null;
69
75
  }
70
76
  if (!base._ntkSha1) return null;
71
- return `ntkg1:${base._ntkSha1}:${variationKey(font.variationCoords)}:${size}:a8`;
77
+ const face = base.fk?.postscriptName ?? '';
78
+ return `ntkg2:${base._ntkSha1}:${face}:${variationKey(font.variationCoords)}:${size}:a8`;
72
79
  }
73
80
 
74
81
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ntk",
3
- "version": "8.14.3",
3
+ "version": "8.14.4",
4
4
  "description": "Desktop UI toolkit for X11 with canvas-like 2d and OpenGL rendering",
5
5
  "author": "Andrey Sidorov <sidorares@yandex.ru>",
6
6
  "license": "MIT",