@weasel-js/text-shaping 1.14.2 → 1.15.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.
- package/README.md +15 -12
- package/dist/harfbuzz-WAS5ONVP.js +643 -0
- package/dist/harfbuzz-WAS5ONVP.js.map +1 -0
- package/dist/harfbuzz.wasm +0 -0
- package/dist/harfbuzzjs-GV2DMLBC.js +2175 -0
- package/dist/harfbuzzjs-GV2DMLBC.js.map +1 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -21,10 +21,14 @@ registerBidi(bidi);
|
|
|
21
21
|
registerShaper(await loadShaper()); // once, at startup, before text is laid out
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Shaping reaches text set in a face
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
and is
|
|
24
|
+
Shaping reaches text set in a face whose TrueType or OpenType bytes are registered with
|
|
25
|
+
`registerFontOutlines`. That face can also be a baked atlas (`registerFont`) or a canvas face
|
|
26
|
+
(`registerCanvasFont`): register the same family and variant with `registerFontOutlines` too,
|
|
27
|
+
and its text is shaped from that file. A baked atlas must be cut from the same file, or its
|
|
28
|
+
advances disagree with the shaper's. On an atlas face, a letter the shaping leaves as its own
|
|
29
|
+
glyph still draws from the atlas; a shaped cluster (a conjunct, a joining form, a placed mark)
|
|
30
|
+
draws from its outline, and on a canvas face below the outline size from a tile baked from that
|
|
31
|
+
outline. A face loaded from WOFF, whose bytes HarfBuzz cannot read, is laid out as before.
|
|
28
32
|
Right-to-left text also needs the bidi engine, which puts its letters in visual order.
|
|
29
33
|
|
|
30
34
|
With a shaper registered, `fontVariantCaps: 'small-caps'` on a face that has an `smcp`
|
|
@@ -50,12 +54,11 @@ against it.
|
|
|
50
54
|
|
|
51
55
|
## Bundling
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
import.meta.url)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
The package ships HarfBuzz's WebAssembly as `dist/harfbuzz.wasm` and finds it with
|
|
58
|
+
`new URL('harfbuzz.wasm', import.meta.url)` from its own JavaScript. Vite needs no
|
|
59
|
+
configuration for it: a production build emits the file as an asset and points the URL at
|
|
60
|
+
it. In Node, `loadShaper` reads the copy in the `harfbuzzjs` package instead.
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Vite 8 warns and leaves the `await` in place.
|
|
62
|
+
No top-level `await` reaches the bundle, so any target esbuild accepts works, ES2020
|
|
63
|
+
included: harfbuzzjs's JavaScript is vendored here with its initialization left to
|
|
64
|
+
`loadShaper`, since its published module awaits the WebAssembly at the top level.
|