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.
- package/lib/sharedglyphs.js +10 -3
- package/package.json +1 -1
package/lib/sharedglyphs.js
CHANGED
|
@@ -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
|
-
*
|
|
45
|
+
* ntkg2:<sha1 of font file bytes>:<face>:<variation coords>:<px size>:<format>
|
|
46
46
|
*
|
|
47
|
-
* The `
|
|
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
|
-
|
|
77
|
+
const face = base.fk?.postscriptName ?? '';
|
|
78
|
+
return `ntkg2:${base._ntkSha1}:${face}:${variationKey(font.variationCoords)}:${size}:a8`;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
// ---------------------------------------------------------------------------
|