ultra-text 1.0.2 → 1.0.3

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 (206) hide show
  1. package/README.md +193 -115
  2. package/dist/assets/{cpuSdf.worker--X1Qpmdp.js → cpuSdf.worker-Dy4P5_TI.js} +98 -43
  3. package/dist/assets/cpuSdf.worker-Dy4P5_TI.js.map +1 -0
  4. package/dist/assets/traceOutline.worker-B5uVKmR4.js +1725 -0
  5. package/dist/assets/traceOutline.worker-B5uVKmR4.js.map +1 -0
  6. package/dist/atlas/appendAtlas.js +35 -11
  7. package/dist/atlas/appendAtlas.js.map +1 -1
  8. package/dist/atlas/buildAtlas.js +1 -1
  9. package/dist/atlas/buildAtlas.js.map +1 -1
  10. package/dist/atlas/colorGlyphs.d.ts +0 -10
  11. package/dist/atlas/colorGlyphs.js +97 -155
  12. package/dist/atlas/colorGlyphs.js.map +1 -1
  13. package/dist/atlas/colorTexture.d.ts +1 -0
  14. package/dist/atlas/colorTexture.js +64 -0
  15. package/dist/atlas/colorTexture.js.map +1 -0
  16. package/dist/atlas/cpuAtlas.js +8 -3
  17. package/dist/atlas/cpuAtlas.js.map +1 -1
  18. package/dist/atlas/cpuSdf.d.ts +1 -1
  19. package/dist/atlas/cpuSdf.js +97 -42
  20. package/dist/atlas/cpuSdf.js.map +1 -1
  21. package/dist/atlas/cpuWorker.d.ts +10 -4
  22. package/dist/atlas/cpuWorker.js +99 -49
  23. package/dist/atlas/cpuWorker.js.map +1 -1
  24. package/dist/atlas/gpuAtlas.js +133 -56
  25. package/dist/atlas/gpuAtlas.js.map +1 -1
  26. package/dist/atlas/gpuCommon.d.ts +140 -18
  27. package/dist/atlas/gpuCommon.js +726 -104
  28. package/dist/atlas/gpuCommon.js.map +1 -1
  29. package/dist/atlas/jfaWgsl.d.ts +1 -1
  30. package/dist/atlas/jfaWgsl.js +232 -61
  31. package/dist/atlas/jfaWgsl.js.map +1 -1
  32. package/dist/atlas/rasterize.d.ts +22 -0
  33. package/dist/atlas/rasterize.js +237 -111
  34. package/dist/atlas/rasterize.js.map +1 -1
  35. package/dist/atlas/vanillaCore.js +156 -103
  36. package/dist/atlas/vanillaCore.js.map +1 -1
  37. package/dist/atlas/vanillaCpuAtlas.js +37 -52
  38. package/dist/atlas/vanillaCpuAtlas.js.map +1 -1
  39. package/dist/atlas/vanillaExtras.js +91 -90
  40. package/dist/atlas/vanillaExtras.js.map +1 -1
  41. package/dist/atlas/vanillaGpuHelpers.d.ts +70 -7
  42. package/dist/atlas/vanillaGpuHelpers.js +262 -27
  43. package/dist/atlas/vanillaGpuHelpers.js.map +1 -1
  44. package/dist/dom/DomSdf.js +85 -79
  45. package/dist/dom/DomSdf.js.map +1 -1
  46. package/dist/dom/DomSlug.js +23 -18
  47. package/dist/dom/DomSlug.js.map +1 -1
  48. package/dist/dom/Text.d.ts +4 -1
  49. package/dist/dom/Text.js +5 -1
  50. package/dist/dom/Text.js.map +1 -1
  51. package/dist/dom/browserShaping.js +31 -14
  52. package/dist/dom/browserShaping.js.map +1 -1
  53. package/dist/dom/clusters.js +13 -2
  54. package/dist/dom/clusters.js.map +1 -1
  55. package/dist/dom/cssEffects.d.ts +4 -0
  56. package/dist/dom/cssEffects.js +72 -0
  57. package/dist/dom/cssEffects.js.map +1 -0
  58. package/dist/dom/domAnalytic.d.ts +1 -2
  59. package/dist/dom/domAnalytic.js +1 -1
  60. package/dist/dom/domAnalytic.js.map +1 -1
  61. package/dist/dom/fontCanvas.d.ts +16 -0
  62. package/dist/dom/fontCanvas.js +4 -4
  63. package/dist/dom/fontCanvas.js.map +1 -1
  64. package/dist/dom/layoutSignature.js +28 -12
  65. package/dist/dom/layoutSignature.js.map +1 -1
  66. package/dist/dom/markup.d.ts +10 -0
  67. package/dist/dom/markup.js +16 -1
  68. package/dist/dom/markup.js.map +1 -1
  69. package/dist/dom/pretextLayout.js +27 -19
  70. package/dist/dom/pretextLayout.js.map +1 -1
  71. package/dist/dom/snapshot.d.ts +4 -0
  72. package/dist/dom/snapshot.js +747 -505
  73. package/dist/dom/snapshot.js.map +1 -1
  74. package/dist/dom/snapshotsEqual.d.ts +7 -0
  75. package/dist/dom/snapshotsEqual.js +68 -0
  76. package/dist/dom/snapshotsEqual.js.map +1 -0
  77. package/dist/dom/svgCapture.js +30 -27
  78. package/dist/dom/svgCapture.js.map +1 -1
  79. package/dist/dom/textTransform.d.ts +13 -1
  80. package/dist/dom/textTransform.js +31 -13
  81. package/dist/dom/textTransform.js.map +1 -1
  82. package/dist/dom/tone.js +15 -8
  83. package/dist/dom/tone.js.map +1 -1
  84. package/dist/slug/SlugMaterial.d.ts +6 -0
  85. package/dist/slug/SlugMaterial.js +48 -20
  86. package/dist/slug/SlugMaterial.js.map +1 -1
  87. package/dist/slug/cff.d.ts +5 -0
  88. package/dist/slug/cff.js +780 -0
  89. package/dist/slug/cff.js.map +1 -0
  90. package/dist/slug/coverage.d.ts +3 -3
  91. package/dist/slug/coverage.js +283 -101
  92. package/dist/slug/coverage.js.map +1 -1
  93. package/dist/slug/preprocessCore.d.ts +1 -1
  94. package/dist/slug/preprocessCore.js +100 -80
  95. package/dist/slug/preprocessCore.js.map +1 -1
  96. package/dist/slug/runtime.js +32 -39
  97. package/dist/slug/runtime.js.map +1 -1
  98. package/dist/slug/standaloneRuntime.js +47 -37
  99. package/dist/slug/standaloneRuntime.js.map +1 -1
  100. package/dist/slug/truetype.d.ts +14 -6
  101. package/dist/slug/truetype.js +190 -62
  102. package/dist/slug/truetype.js.map +1 -1
  103. package/dist/slug/vanillaCore.d.ts +74 -4
  104. package/dist/slug/vanillaCore.js +226 -217
  105. package/dist/slug/vanillaCore.js.map +1 -1
  106. package/dist/slug-vanilla.d.ts +1 -1
  107. package/dist/slug-vanilla.js +5 -4
  108. package/dist/slug.d.ts +1 -1
  109. package/dist/slug.js +3 -3
  110. package/dist/text/GlyphTextMaterial.d.ts +5 -0
  111. package/dist/text/GlyphTextMaterial.js +11 -7
  112. package/dist/text/GlyphTextMaterial.js.map +1 -1
  113. package/dist/text/RectMaterial.js +6 -10
  114. package/dist/text/RectMaterial.js.map +1 -1
  115. package/dist/text/SdfTextMaterial.d.ts +9 -3
  116. package/dist/text/SdfTextMaterial.js +122 -37
  117. package/dist/text/SdfTextMaterial.js.map +1 -1
  118. package/dist/text/decorations.d.ts +7 -2
  119. package/dist/text/decorations.js +187 -96
  120. package/dist/text/decorations.js.map +1 -1
  121. package/dist/text/geometryUtils.d.ts +5 -0
  122. package/dist/text/geometryUtils.js +63 -9
  123. package/dist/text/geometryUtils.js.map +1 -1
  124. package/dist/text/glyphGeometry.d.ts +1 -1
  125. package/dist/text/glyphGeometry.js +281 -200
  126. package/dist/text/glyphGeometry.js.map +1 -1
  127. package/dist/text/rectGeometry.js +46 -42
  128. package/dist/text/rectGeometry.js.map +1 -1
  129. package/dist/text/reflow.d.ts +5 -0
  130. package/dist/text/reflow.js +127 -68
  131. package/dist/text/reflow.js.map +1 -1
  132. package/dist/text/snap.d.ts +15 -1
  133. package/dist/text/snap.js +1 -1
  134. package/dist/text/snap.js.map +1 -1
  135. package/dist/text/tone.js +2 -2
  136. package/dist/text/tone.js.map +1 -1
  137. package/dist/types.d.ts +23 -7
  138. package/dist/vanilla.js +1 -1
  139. package/dist/windfoil/WindfoilCompositeMaterial.d.ts +1 -1
  140. package/dist/windfoil/WindfoilCompositeMaterial.js +10 -3
  141. package/dist/windfoil/WindfoilCompositeMaterial.js.map +1 -1
  142. package/dist/windfoil/WindfoilMaterial.d.ts +12 -5
  143. package/dist/windfoil/WindfoilMaterial.js +71 -8
  144. package/dist/windfoil/WindfoilMaterial.js.map +1 -1
  145. package/dist/windfoil/compositeGeometry.js +12 -5
  146. package/dist/windfoil/compositeGeometry.js.map +1 -1
  147. package/dist/windfoil/coverage.d.ts +10 -2
  148. package/dist/windfoil/coverage.js +147 -59
  149. package/dist/windfoil/coverage.js.map +1 -1
  150. package/dist/windfoil/geometry.d.ts +15 -0
  151. package/dist/windfoil/geometry.js +154 -64
  152. package/dist/windfoil/geometry.js.map +1 -1
  153. package/dist/windfoil/layerGrid.js +8 -8
  154. package/dist/windfoil/layerGrid.js.map +1 -1
  155. package/dist/windfoil/mixed.js +13 -4
  156. package/dist/windfoil/mixed.js.map +1 -1
  157. package/dist/windfoil/preprocess.js +2 -2
  158. package/dist/windfoil/preprocessCore.d.ts +1 -0
  159. package/dist/windfoil/preprocessCore.js +63 -36
  160. package/dist/windfoil/preprocessCore.js.map +1 -1
  161. package/dist/windfoil/requests.d.ts +1 -1
  162. package/dist/windfoil/requests.js +11 -4
  163. package/dist/windfoil/requests.js.map +1 -1
  164. package/dist/windfoil/resolveOutline.d.ts +9 -0
  165. package/dist/windfoil/resolveOutline.js +20 -0
  166. package/dist/windfoil/resolveOutline.js.map +1 -0
  167. package/dist/windfoil/runtime.d.ts +1 -0
  168. package/dist/windfoil/runtime.js +8 -24
  169. package/dist/windfoil/runtime.js.map +1 -1
  170. package/dist/windfoil/shapeGeometry.js +80 -34
  171. package/dist/windfoil/shapeGeometry.js.map +1 -1
  172. package/dist/windfoil/sizeSwitch.d.ts +1 -1
  173. package/dist/windfoil/sizeSwitch.js +13 -8
  174. package/dist/windfoil/sizeSwitch.js.map +1 -1
  175. package/dist/windfoil/storage.d.ts +23 -9
  176. package/dist/windfoil/storage.js +49 -30
  177. package/dist/windfoil/storage.js.map +1 -1
  178. package/dist/windfoil/svg/curves.d.ts +20 -0
  179. package/dist/windfoil/svg/curves.js +145 -42
  180. package/dist/windfoil/svg/curves.js.map +1 -1
  181. package/dist/windfoil/svg/document.js +10 -1
  182. package/dist/windfoil/svg/document.js.map +1 -1
  183. package/dist/windfoil/svg/pathConverter.js +66 -50
  184. package/dist/windfoil/svg/pathConverter.js.map +1 -1
  185. package/dist/windfoil/svg/pathData.d.ts +9 -0
  186. package/dist/windfoil/svg/pathData.js +142 -109
  187. package/dist/windfoil/svg/pathData.js.map +1 -1
  188. package/dist/windfoil/svg/winding.js +34 -10
  189. package/dist/windfoil/svg/winding.js.map +1 -1
  190. package/dist/windfoil/trace/contours.js +120 -50
  191. package/dist/windfoil/trace/contours.js.map +1 -1
  192. package/dist/windfoil/trace/fit.js +578 -224
  193. package/dist/windfoil/trace/fit.js.map +1 -1
  194. package/dist/windfoil/trace/traceOutline.worker.d.ts +24 -0
  195. package/dist/windfoil/trace/traceWorker.d.ts +13 -0
  196. package/dist/windfoil/trace/traceWorker.js +192 -0
  197. package/dist/windfoil/trace/traceWorker.js.map +1 -0
  198. package/dist/windfoil/tracedOutlines.d.ts +2 -0
  199. package/dist/windfoil/tracedOutlines.js +335 -70
  200. package/dist/windfoil/tracedOutlines.js.map +1 -1
  201. package/package.json +48 -29
  202. package/skills/ultra-text/SKILL.md +9 -10
  203. package/skills/ultra-text/references/frameworks.md +46 -2
  204. package/skills/ultra-text/references/three-tsl.md +26 -24
  205. package/skills/ultra-text/references/vanilla-webgpu.md +3 -1
  206. package/dist/assets/cpuSdf.worker--X1Qpmdp.js.map +0 -1
package/README.md CHANGED
@@ -4,50 +4,78 @@
4
4
  [![npm](https://img.shields.io/npm/v/ultra-text)](https://www.npmjs.com/package/ultra-text)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-2f81f7.svg)](./LICENSE)
6
6
 
7
- **DOM to WebGPU/TSL.** Real HTML, laid out by the browser, becomes live 3D text in the Three.js
8
- `WebGPURenderer`, drawn by TSL shaders from a retained SDF atlas or analytic Windfoil outlines.
7
+ **Real HTML & CSS, rendered as live 3D WebGPU text in 1 draw call.**
9
8
 
10
- [Gallery](https://ultra-text.makio.io/) ·
11
- [Documentation](https://ultra-text.makio.io/docs) ·
12
- [HTML/3D demo](https://ultra-text.makio.io/demo) ·
9
+ Keep browser typography, webfonts, CSS layout, colour emoji, and accessibility—with zero font-file
10
+ fetching or offline baking. Built for Three.js `WebGPURenderer` + TSL (R3F, TresJS), Mini3, and raw
11
+ WebGPU.
12
+
13
+ [Live HTML/3D Demo](https://ultra-text.makio.io/demo) ·
14
+ [3D Gallery](https://ultra-text.makio.io/) ·
15
+ [Docs](https://ultra-text.makio.io/docs) ·
16
+ [Agent Skill](https://ultra-text.makio.io/skills) ·
17
+ [Benchmarks](#comparison-with-other-3d-web-text-libraries) ·
13
18
  [Changelog](https://github.com/Makio64/ultra-text/blob/main/CHANGELOG.md)
14
19
 
15
20
  [![The ultra-text WebGPU gallery](https://ultra-text.makio.io/og.png)](https://ultra-text.makio.io/)
16
21
 
17
- `ultra-text` measures marked HTML or a CSS-styled string with the browser and returns a retained
18
- `THREE.Group` (or packed typed arrays via `ultra-text/vanilla`). Default rendering bakes a
19
- single-channel SDF atlas; experimental `windfoil` and `slug` backends retain quadratic curves.
22
+ `ultra-text` measures marked HTML or a CSS-styled string with the browser (`Range`, or lazy Pretext
23
+ Canvas layout) and returns a retained `THREE.Group` (or packed typed arrays via
24
+ `ultra-text/vanilla`).
25
+
26
+ - **0.090 ms / 1 draw call** for 200 HUD labels (`0.067 ms` E2 hardware GPU pass; `0.088 ms` E1 /
27
+ `0.065 ms` E2 GPU for a 1,000-glyph paragraph) — **1.76×** faster E1 (**2.70×** E2 GPU) than
28
+ `troika` `BatchedText` and **2.42×** faster than `@pmndrs/glyph` MSDF on Apple M3 Max / Chrome 158
29
+ ([full benchmarks](#comparison-with-other-3d-web-text-libraries)).
30
+ - **Zero DOM reads per frame & `0.031 ms` width `reflow()`** (`1.49 ms` end-to-end): retained
31
+ instanced GPU geometry with automatic DOM/resize/font observers and transactional async rebuilds.
32
+ - **Two GPU backends, four tree-shaken entries:** `0.42 MiB` single-channel SDF atlas (exact separable
33
+ 2D Gustavson AA-EDT / tier-1 direct `textureLoad` tiled pass + SPD mipmaps + GPU colour bleed +
34
+ demand pool, with multi-worker narrow-LUT CPU fallback verified on WebGL2) or `0.19 MiB` analytic
35
+ **Slug** / **Windfoil** quadratic curves for infinite zoom (`textBackend: 'auto'` switches between
36
+ Slug and SDF on WebGPU and falls back to SDF on WebGL2) — **50.7 kB** min+gzip (**45.1 kB**
37
+ brotli; **41.7 kB** gzip / **36.7 kB** brotli Three-free `ultra-text/vanilla`).
38
+ - **Browser-matched ink & TSL shaders:** `tone` matches browser ink weight; compose custom TSL
39
+ `fill`/`vertex` hooks, `motion`, soft-blurred or CSS-captured `outline`/`dropShadow` (`blur`,
40
+ `'css'`), solid CSS decorations, inline SVG, and native colour emoji.
41
+ - **Built for the AI era:** coding agents already master HTML & CSS—ship the progressive
42
+ [Agent Skill](https://ultra-text.makio.io/skills) (`SKILL.md` + stack references in git and npm)
43
+ so they get WebGPU 3D text right on the first try.
44
+
45
+ ## Install
20
46
 
21
- - Browser-native layout and line breaking (`Range`, or lazy Pretext Canvas layout)
22
- - Retained instanced geometry with zero DOM reads in the render loop
23
- - Single-pass tiled GPU SDF baking (with exact CPU worker fallback) or analytic quadratic outlines
24
- - TSL motion, clipping, antialiasing, custom `fill`/`vertex` hooks, `outline`, `dropShadow`,
25
- solid CSS decorations, and [browser-matched ink weight](#matching-the-browser) (`tone`)
26
- - Tree-shaken `DomText + Text`: **41.1 kB** min+gzip (**36.6 kB** brotli; Vite build). Enforced
27
- `size-limit` IIFE budget: **44.1 kB** min+brotli (limit 46 kB, excluding Three.js and lazy chunks),
28
- plus **3.6 kB** CPU fallback (limit 4.5 kB) and **2.2 kB** worker asset (limit 2.5 kB).
47
+ ```sh
48
+ # Coding agents (Claude Code, Cursor, Codex, Antigravity, Windsurf):
49
+ npx skills add Makio64/ultra-text
29
50
 
30
- > [!NOTE]
31
- > The SDF atlas is single-channel (not MSDF). Analytic backends (`slug`, `windfoil`) are WebGPU-only
32
- > and experimental. See [Limitations](#limitations).
51
+ # Three.js WebGPU / R3F / TresJS:
52
+ npm install ultra-text three@0.187
53
+ npm install --save-dev @types/three@0.187
54
+
55
+ # Three-free engines (Mini3, custom WebGPU):
56
+ npm install ultra-text
57
+ ```
33
58
 
34
- ## Requirements and install
59
+ **Requirements & budgets:**
35
60
 
36
61
  - ESM only (`require()` unsupported), Canvas 2D, font-loading APIs, `Range`, and
37
62
  `ResizeObserver`/`MutationObserver` (unless `observe: false`).
38
63
  - Three.js r187 (`>=0.187.0 <0.188.0`) with `WebGPURenderer` (classic `WebGLRenderer` is
39
64
  unsupported). Three-free engines use `ultra-text/vanilla` or `ultra-text/slug-vanilla` (`three`
40
65
  optional).
41
- - `atlasMode: 'auto'` falls back to CPU EDT on WebGL2 or unsupported GPU limits; `windfoil`/`slug`
42
- require WebGPU unless `fallback: 'sdf'` is set.
66
+ - `atlasMode: 'auto'` falls back to CPU EDT on WebGL2 or unsupported GPU limits; `textBackend: 'auto'`
67
+ selects hybrid Slug + SDF on WebGPU and falls back to `'sdf'` on WebGL2, while explicit
68
+ `windfoil`/`slug` require WebGPU unless `fallback: 'sdf'` is set.
69
+ - `@chenglou/pretext` (`^1.0.0`) is the only runtime dependency, loaded dynamically (~38 kB
70
+ min+brotli) only when `layoutEngine: 'pretext'` is requested.
71
+ - Enforced `size-limit` IIFE budget: **54.2 kB** min+brotli (limit 57 kB, excluding Three.js and
72
+ lazy chunks), plus **4.5 kB** CPU fallback (limit 4.8 kB), **2.6 kB** CPU worker asset (limit
73
+ 2.8 kB), **0.7 kB** CSS text effects (limit 1 kB), and **9.3 kB** outline trace worker (limit
74
+ 9.8 kB).
43
75
 
44
- ```sh
45
- npm install ultra-text three@0.187
46
- npm install --save-dev @types/three@0.187 # TypeScript declarations
47
- ```
48
-
49
- `@chenglou/pretext` (`^1.0.0`) is the only runtime dependency, loaded dynamically (~38 kB
50
- min+brotli) only when `layoutEngine: 'pretext'` is requested.
76
+ > [!NOTE]
77
+ > The SDF atlas is single-channel (not MSDF). Analytic backends (`slug`, `windfoil`) are WebGPU-only
78
+ > and experimental. See [Limitations](#limitations).
51
79
 
52
80
  ## Quick start
53
81
 
@@ -93,12 +121,12 @@ The source must stay connected and have a non-zero layout box while it is captur
93
121
  ## String text with CSS
94
122
 
95
123
  Use `Text` to create a Three.js group directly from a string. Pass the initialized renderer
96
- and ordinary CSS properties:
124
+ and ordinary CSS properties (with `await Text.create(...)` or `new Text(...)`):
97
125
 
98
126
  ```ts
99
127
  import { Text } from 'ultra-text'
100
128
 
101
- const text = new Text('Hello, WebGPU!', {
129
+ const text = await Text.create('Hello, WebGPU!', {
102
130
  renderer,
103
131
  css: {
104
132
  fontFamily: 'Arial, sans-serif',
@@ -108,8 +136,6 @@ const text = new Text('Hello, WebGPU!', {
108
136
  },
109
137
  cssClass: 'headline',
110
138
  })
111
-
112
- await text.ready
113
139
  scene.add(text)
114
140
 
115
141
  // Later:
@@ -139,10 +165,11 @@ up GPU resources, observers, and the owned DOM node. Types `TextOptions`, `TextC
139
165
 
140
166
  ## TresJS, React Three Fiber, Mini3, and Vanilla JS
141
167
 
142
- Copy a starter once, then use `<UltraText source={source} />` (React/Vue) or
143
- `await UltraText.create(renderer, source)` (Mini3):
168
+ Copy a starter once, then use declarative `<UltraText css={...}>Hello WebGPU</UltraText>` or live
169
+ HTML capture `<UltraText source={source} />` (React/Vue), or `UltraText.createText(...)` /
170
+ `UltraText.create(...)` (Mini3):
144
171
 
145
- - [TresJS guide](https://ultra-text.makio.io/docs-tres) — TresJS 5.10.0 · Vue 3.5.44
172
+ - [TresJS guide](https://ultra-text.makio.io/docs-tres) — TresJS 5.12.0 · Vue 3.5.46
146
173
  - [React Three Fiber guide](https://ultra-text.makio.io/docs-r3f) — R3F 9.8.2 · React 19.3.1 (plus R3F 10 alpha)
147
174
  - [Mini3 & Vanilla JS guide](https://ultra-text.makio.io/docs-mini3) — Mini3 0.1.0-alpha.0 · `ultra-text/vanilla`
148
175
  - [Agent skills](https://ultra-text.makio.io/skills) — `npx skills add Makio64/ultra-text` (`skills/ultra-text/` in git and npm)
@@ -151,9 +178,50 @@ Starters are MIT copyable source, not framework subpaths. Keep one Three.js copy
151
178
  or zero Three.js with `ultra-text/vanilla`; see
152
179
  [agent instructions](https://ultra-text.makio.io/integrations/AGENTS.md).
153
180
 
181
+ ```tsx
182
+ // React Three Fiber (after copying UltraText.tsx)
183
+ <UltraTextCanvas>
184
+ <UltraText css={{ fontSize: 48, color: '#ffffff', width: 400, textAlign: 'center' }}>
185
+ Hello WebGPU
186
+ </UltraText>
187
+ <UltraText source={sourceElement} />
188
+ </UltraTextCanvas>
189
+ ```
190
+
191
+ ```vue
192
+ <!-- TresJS / Vue 3 (after copying UltraText.vue & UltraTextCanvas.vue) -->
193
+ <UltraTextCanvas>
194
+ <UltraText text="Hello WebGPU" :css="{ fontSize: 48, color: '#ffffff' }" />
195
+ <UltraText :source="sourceElement" />
196
+ </UltraTextCanvas>
197
+ ```
198
+
199
+ ```ts
200
+ // Mini3 (after copying mini3/UltraText.ts)
201
+ const text = await UltraText.createText(renderer, 'Hello WebGPU', {
202
+ css: { fontSize: 48, color: '#ffffff' },
203
+ })
204
+ scene.add(text)
205
+ ```
206
+
207
+ ### Migrating from `troika-three-text` / `@react-three/drei <Text>`
208
+
209
+ | `troika` / `drei <Text>` | `ultra-text` equivalent |
210
+ | ----------------------------------- | ------------------------------------------------------------------------------------------ |
211
+ | `fontSize={0.48}` | `css={{ fontSize: 48 }}` (CSS px divided by `pixelsPerUnit`, `100` by default in starters) |
212
+ | `color="#ff5500"` | `css={{ color: '#ff5500' }}` |
213
+ | `maxWidth={4}` | `css={{ width: 400 }}` (add `reflowable: true` for fast width-only `reflow(width)`) |
214
+ | `textAlign="center"` | `css={{ textAlign: 'center' }}` (`'left' \| 'center' \| 'right' \| 'justify'`) |
215
+ | `outlineWidth={0.02}` | `outline: { width: 2 }` + `padding: 24` (local units) |
216
+ | `outlineColor="#000"` | `outline: { color: '#000', opacity: 1 }` |
217
+ | `outlineBlur` | `outline: { width: 2, blur: 1, color: '#000' }` + `padding: 24` |
218
+ | `anchorX="center" anchorY="middle"` | `center={true}` on framework starters, or `text.position.set(-w * ax, -h * ay, 0)` |
219
+ | `onSync={fn}` | `await text.ready`, `await DomText.create(...)`, or `await text.rebuild()` |
220
+ | `font="/Inter.ttf"` | Browser CSS `@font-face` (`document.fonts.ready`), or `slug: { outlineProvider }` |
221
+
154
222
  ### Engine-agnostic Vanilla JS (`ultra-text/vanilla`)
155
223
 
156
- No Three.js dependency (`31.7 kB` min+gzip / `28.4 kB` brotli for `DomText + Text`):
224
+ No Three.js dependency (**36.7 kB** brotli / **41.7 kB** min+gzip for `DomText + Text`):
157
225
 
158
226
  ```ts
159
227
  import { DomText } from 'ultra-text/vanilla'
@@ -175,24 +243,23 @@ Exports `DomText` (`DomSdf`, `VanillaDomText`), `Text` (`VanillaText`), `collect
175
243
 
176
244
  ### Slug-only entries (`ultra-text/slug` and `ultra-text/slug-vanilla`)
177
245
 
178
- Dedicated WebGPU curve entries with zero SDF/JFA/worker code and `0.17 MiB` paragraph VRAM:
179
- `ultra-text/slug` (`40.9 kB` gz / `36.1 kB` br) and Three-free `ultra-text/slug-vanilla` (`33.7 kB`
180
- gz / `30.1 kB` br):
246
+ Dedicated WebGPU curve entries with zero SDF/worker code and `0.19 MiB` paragraph VRAM:
247
+ `ultra-text/slug` (**48.7 kB** gz / **42.8 kB** brotli) and Three-free `ultra-text/slug-vanilla`
248
+ (**40.9 kB** gz / **36.1 kB** brotli):
181
249
 
182
250
  ```ts
183
- import { DomText, Text, createTrueTypeOutlineProvider } from 'ultra-text/slug'
251
+ import { DomText, Text, createFontOutlineProvider } from 'ultra-text/slug'
184
252
 
185
- // Zero-config: lazily traces loaded fonts via Canvas 2D
253
+ // Zero-config: lazily traces loaded fonts via Canvas 2D in background workers
186
254
  const traced = await DomText.create(renderer, source)
187
255
 
188
- // Exact outlines from an uncompressed .ttf ArrayBuffer
189
- const ttfBuffer = await fetch('/fonts/Inter-Regular.ttf').then((r) => r.arrayBuffer())
190
- const exact = new Text('Infinite zoom, zero SDF atlas', {
256
+ // Exact outlines from .ttf or .otf (CFF), plus optional decodeWoff2 hook for .woff2
257
+ const fontBytes = await fetch('/fonts/Inter-Regular.otf').then((r) => r.arrayBuffer())
258
+ const exact = await Text.create('Infinite zoom, zero SDF atlas', {
191
259
  renderer,
192
- slug: { outlineProvider: createTrueTypeOutlineProvider(ttfBuffer) },
260
+ slug: { outlineProvider: createFontOutlineProvider(fontBytes) },
193
261
  css: { fontFamily: 'Inter', fontSize: 64, color: '#ffffff' },
194
262
  })
195
- await exact.ready
196
263
  ```
197
264
 
198
265
  `ultra-text/slug-vanilla` exports `DomText`/`Text` (`VanillaDomSlug`/`VanillaSlugText`),
@@ -271,8 +338,8 @@ domSdf.reflow(560)
271
338
 
272
339
  `reflow()` preserves `text-align` and `text-align-last` (`left`, `center`, `right`, `justify`,
273
340
  `start`/`end`), matches Chrome within 0.04 px (`0.06 px` justify) across 200–560 px tests, and
274
- recomputes stagger in place (`0.041 ms` standalone CPU median at 1,000 glyphs / `0.326 ms` at
275
- 10,000 glyphs on Apple M3 Max, `2026-11-23`). It is a
341
+ recomputes stagger in place (`0.031 ms` standalone CPU median at 1,000 glyphs / `0.276 ms` at
342
+ 10,000 glyphs on Apple M3 Max, `2026-11-28`). It is a
276
343
  block-flow pass: it skips `text-indent`, mixed line sizes, hyphenation, mixed bidi (RTL needs
277
344
  `rtlReflow: true`, CJK `cjkLineBreaking: true`), floats, and rect geometry; call `rebuild()` when
278
345
  CSS changes.
@@ -284,9 +351,9 @@ in-place after their first miss:
284
351
  glyphs into free rows (`6.7 ms` vs `9.0 ms` GPU, `2.9 ms` vs `11.0 ms` CPU on 188 glyphs in
285
352
  Chrome 156); full rebuilds occur on new fonts, colour/SVG glyphs, overflow (`rebuild({ atlas: true })`),
286
353
  or `ultra-text/vanilla`.
287
- - Analytic instances allocate tight cold buffers (`0.17 MiB` paragraph) and add headroom on the
288
- first miss, cutting unseen-glyph Slug rebuilds from `8.61 → 2.89 ms` (TTF) and `10.91 → 4.14 ms`
289
- (traced) in `2026-11-19` `vs-ecosystem`.
354
+ - Analytic instances allocate tight cold buffers (`0.19 MiB` TTF paragraph) and add headroom on the
355
+ first miss, keeping unseen-glyph Slug rebuilds at `3.20 ms` (TTF, `1.26 ms` ready) and `4.05 ms`
356
+ (traced, `2.32 ms` ready) in `2026-11-28` `vs-ecosystem`.
290
357
 
291
358
  ## Layout engines
292
359
 
@@ -374,7 +441,7 @@ not a copy with defaults filled in.
374
441
  | ----------------------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
375
442
  | `layoutEngine` | `'range'` | Browser Range layout or Canvas/Pretext layout. |
376
443
  | `textShaping` | `'none'` | Opt-in `'browser'` shaping of retained text runs; see [language support](#optional-language-support). |
377
- | `textBackend` | `'sdf'` | Retained SDF coverage or experimental, WebGPU-only `'windfoil'` or `'slug'`. |
444
+ | `textBackend` | `'sdf'` | Retained SDF coverage, WebGPU-only `'windfoil'` / `'slug'`, or `'auto'` (hybrid Slug + SDF on WebGPU, SDF fallback on WebGL2). |
378
445
  | `svg` | `false` | Capture SVG paths/layers using Range; object options select policy, budget, bitmap rendering and images. |
379
446
  | `windfoil` | — | Optional outline provider (without one, glyphs are traced from the browser's own rendering and `fallback` defaults to `'sdf-glyphs'`), `'error'`, `'sdf'` or `'sdf-glyphs'` fallback, band tuning and the `sdfBelowPx` size switch for Windfoil. |
380
447
  | `slug` | — | Optional outline provider (traced glyphs without one), fallback, band tuning and the `sdfBelowPx` size switch for Slug (or falls back to `windfoil` options when omitted). |
@@ -399,8 +466,8 @@ not a copy with defaults filled in.
399
466
  | `fill` | — | TSL callback returning a linear RGBA fill inside each letter; works with every text backend and `createWindfoilShapes`. |
400
467
  | `vertex` | — | TSL callback returning a local `vec3` corner position for glyphs and text decorations; works with every text backend and `createWindfoilShapes`. |
401
468
  | `tone` | on | Text ink at the weight the browser gives it, on every backend: `{ strength, backdrop, model }`, or `false` for exact coverage; see [Matching the browser](#matching-the-browser). |
402
- | `outline` | — | Optional outline with local-unit `width`, `color`, and `opacity`, drawn from an SDF on every text backend. |
403
- | `dropShadow` | — | Optional hard shadow with local-unit `offsetX`/`offsetY`, `color`, and `opacity`, drawn from an SDF on every text backend. |
469
+ | `outline` | — | Optional outline with local-unit `width`, `blur`, `color`, and `opacity`, or `'css'` to auto-capture CSS `-webkit-text-stroke`, drawn from an SDF on every text backend. |
470
+ | `dropShadow` | — | Optional drop shadow with local-unit `offsetX`/`offsetY`, `blur`, `color`, and `opacity`, or `'css'` to auto-capture CSS `text-shadow`, drawn from an SDF on every text backend. |
404
471
  | `threshold` | `0.5` | Sampled SDF edge threshold: the baked outline. Left unset, colour glyphs keep `0.515`, which hides the faint shading around some emoji. Text weight comes from `tone`. |
405
472
  | `shadowCutoff` | `0.5` | Coverage needed for a glyph to contribute to the shadow silhouette. |
406
473
  | `shadowFloor` | `0.24` | Brightness of a fully shadowed captured rectangle, from `0` to `1`. |
@@ -451,17 +518,18 @@ const text = await DomText.create(renderer, source, {
451
518
 
452
519
  - **`fill({ uv, position, color, colorWeight, glyphIndex })`** → linear RGBA `vec4`. Coverage, DOM opacity, clipping, motion, and shadow masking remain applied. Pass `tone: false` for textured/painted fills; on SDF, mix via `colorWeight` to keep emoji colours.
453
520
  - **`vertex({ position, center, uv, glyphIndex, sequence, rect, clip })`** → displaced local `vec3`. Clipping runs pre-hook so Z waves do not get clipped; runs across beauty, shadow passes, decorations, and companions.
454
- - **Outlines & drop shadows**: rendered from SDF on every backend (analytic backends add an SDF companion underlay batch in 2 draws: e.g. 45,840 B in 1 draw vs 551,824 B in 2 draws on 77 glyphs in Chrome 156 / M3 Max). Outlines cap below half `padding`; drop shadows are hard silhouettes (no blur). Empty `outline` defaults to black `1` unit; empty `dropShadow` to black `0.5` opacity at `(2, -2)`.
521
+ - **Outlines & drop shadows**: rendered from SDF on every backend (analytic backends add an SDF companion underlay batch in 2 draws: e.g. 45,840 B in 1 draw vs 551,824 B in 2 draws on 77 glyphs in Chrome 156 / M3 Max). Pass `blur` for soft-edged outlines/shadows (clamped inside `pxRange` with zero extra texture reads), or pass `outline: 'css'` / `dropShadow: 'css'` to auto-capture CSS `-webkit-text-stroke` and `text-shadow` lazily (`cssEffects` loads only when `'css'` is requested). Outlines cap below half `padding`; empty `outline` defaults to black `1` unit; empty `dropShadow` to black `0.5` opacity at `(2, -2)`.
455
522
  - **Decorations**: solid CSS `underline`, `overline`, and `line-through` capture into an instanced batch that tracks `reflow()` and motion (wavy/dotted/double/skip-ink omitted). See the [text effects lab](https://ultra-text.makio.io/text-effects).
456
523
 
457
524
  ### Experimental Windfoil and Slug backends
458
525
 
459
- Supply OpenType Y-up closed quadratic outlines (`outlineProvider`), or omit it to trace browser glyphs at 256 px/em (~0.006 em accuracy, ~0.5–0.6 ms Latin / 1.1–1.2 ms CJK on main thread in ~8 ms slices, cached per instance):
526
+ Supply OpenType Y-up closed quadratic outlines (`outlineProvider`), or omit it to trace browser glyphs at 256 px/em (~0.006 em accuracy, sharded across up to 4 background module workers by default via `worker: true`; 64-glyph 256 px worker tracing dropped **31.8%** from `10.875 → 7.415 ms` vs `12.985 ms` single-threaded, keeping cold 1,000-glyph `U-slug-auto` main-thread time at `48.6 ms` / `72.6 ms` TTFF on Apple M3 Max):
460
527
 
461
528
  ```ts
462
529
  import { DomText, type WindfoilOutlineProvider } from 'ultra-text'
463
530
 
464
- const traced = await DomText.create(renderer, source, { textBackend: 'slug' })
531
+ // Hybrid Slug + SDF on WebGPU, automatic SDF fallback on WebGL2
532
+ const autoText = await DomText.create(renderer, source, { textBackend: 'auto' })
465
533
 
466
534
  const outlineProvider: WindfoilOutlineProvider = (request, signal) =>
467
535
  myFontRegistry.resolveQuadraticOutline(request, signal)
@@ -472,7 +540,7 @@ const domText = await DomText.create(renderer, source, {
472
540
  })
473
541
  ```
474
542
 
475
- `ultra-text/slug` and `ultra-text/slug-vanilla` export `createTrueTypeOutlineProvider` (uncompressed `.ttf`) and `createTracedOutlineProvider`. Missing/colour outlines use whole-capture `fallback: 'sdf'` or per-glyph `'sdf-glyphs'` companion (companion paints above vectors). Lower `targetPiecesPerBand` trades more storage for less fragment work. Windfoil upstream advises assessing patent risk ([texel-org/windfoil](https://github.com/texel-org/windfoil), [Apache-2.0 notice](./THIRD_PARTY_NOTICES.md)).
543
+ `ultra-text/slug` and `ultra-text/slug-vanilla` export `parseFont` / `createFontOutlineProvider` (plus `parseTrueTypeFont` / `createTrueTypeOutlineProvider`) for uncompressed `.ttf` and `.otf` (CFF Type 2) buffers, an optional `decodeWoff2` hook on `FontOutlineProviderOptions` for `.woff2`, and `createTracedOutlineProvider`. Missing/colour outlines use whole-capture `fallback: 'sdf'` or per-glyph `'sdf-glyphs'` companion (companion paints above vectors). Lower `targetPiecesPerBand` trades more storage for less fragment work. Windfoil upstream advises assessing patent risk ([texel-org/windfoil](https://github.com/texel-org/windfoil), [Apache-2.0 notice](./THIRD_PARTY_NOTICES.md)).
476
544
 
477
545
  #### Size switch: SDF while small (experimental)
478
546
 
@@ -517,10 +585,10 @@ Identical outline containers share GPU buffers across calls; `compositing: 'shad
517
585
  ## Text backends and atlas modes
518
586
 
519
587
  - **SDF (`textBackend: 'sdf'`, default)**: `DOM → layout snapshot → Canvas glyph mask → SDF atlas → instanced geometry + TSL materials`.
520
- - GPU bake (`atlasMode: 'gpu'` / `'auto'`): writes mask once into a buffer, runs a **single tiled compute pass** (`tiledStoreMain`) directly to the `r8unorm` storage texture on `texture-formats-tier1` when `padding <= 12` (**1 lazily compiled compute pipeline** instead of 4; multi-pass `seed`/`jump`/`resolve` compile lazily only for larger `padding` or non-tier1 fallback). On Apple M3 Max / Chrome 157: **4.56 ms** GPU bake (`2026-11-22` W5; `5.35 ms` in `2026-11-19` `33.9 ms` cold full run), **`5.3 MiB`** peak VRAM (`0.64 MiB` resident). `sdfTrim` trims empty quad padding (~60% fewer fragments).
521
- - CPU bake (`atlasMode: 'cpu'` or automatic fallback): exact EDT in a cancellable Worker (`cpuWorker: true`), uploading the identical R8 `DataTexture`.
588
+ - GPU bake (`atlasMode: 'gpu'` / `'auto'`): writes mask once, runs exact separable 2D Gustavson AA-EDT (`sepHorizPx12` / `sepVertPx12` for atlases `> 450k` texels; `16×16` shared-memory `sepVertStoreMain` up to `padding = 32`; tier-1 direct `textureLoad` single-pass `tiledStoreMain` for `<= 450k` texels at `padding <= 12`, saving `4–8 MiB` temp storage), generates single-pass `16×16` SPD compute mipmaps (`mipSpdMain`), applies GPU `rgba8unorm-srgb` color-band bleed (`COLOR_BLEED_WGSL`, `3.27 → 2.36 ms`), retains GPU pools on demand after the first reuse, and applies tight vertical ink-metric trimming. On Apple M3 Max / Chrome 158: **6.20 ms** GPU bake (`atlasBuildMs` in the `34.8 ms` cold `U-sdf` run; `0.166 ms` `1024×1024 px12` kernel), **`1.81 MiB`** (`1,849 KiB`) peak VRAM (**`0.42 MiB`** / `428 KiB` resident, `1968×192` atlas), `-6.8%..-22.2%` analytic contour RMSE at `px12` (`noto_latin` max byte delta vs CPU EDT `40 → 29`), and `quality: 'high'` cuts GPU cost `-37%..-44%` with `-5%..-35%` 8×8 RMSE vs Slug TTF. `sdfTrim` trims empty quad padding (~60% fewer fragments).
589
+ - CPU bake (`atlasMode: 'cpu'` or automatic fallback): exact row-striped EDT across up to 6 warm background workers (`cpuWorker: true`), reusing active row-band scratch space and exact narrow-LUT encoding for `padding <= 2` (**2.98×** Latin / **4.78×** CJK), uploading the identical R8 `DataTexture` (`21.02 ms` `atlasBuildMs` / `49.6 ms` cold TTFF in `2026-11-28` `vs-ecosystem`).
522
590
  - Colour glyphs (`colorGlyphs: 'emoji'` / `'all'`) share an optional sRGB RGBA band (~80 KB/emoji at `bakeSize: 96`; Apple Color Emoji max strike is 160 px on macOS).
523
- - **Analytic (`'slug'` / `'windfoil'`)**: monotone-split curve buffers (`0.17 MiB` TTF / `0.21 MiB` traced for 1,000 glyphs); no atlas texture unless `outline`, `dropShadow`, or `sdf-glyphs` creates an SDF companion.
591
+ - **Analytic (`'slug'` / `'windfoil'`)**: monotone-split curve buffers (`0.19 MiB` TTF / `0.23 MiB` traced for 1,000 glyphs); no atlas texture unless `outline`, `dropShadow`, or `sdf-glyphs` creates an SDF companion.
524
592
 
525
593
  Perf-sensitive HUDs should set `atlasMode: 'gpu'`, `maxAtlasSize: 1024`, `extraGlyphs`, `observe: false`, `castShadow: false`, and `motion: { enabled: false, mode: 'none' }`.
526
594
 
@@ -556,7 +624,7 @@ defines public contracts.
556
624
  | `DomTextOptions`, `DomSdfOptions` | Every option accepted by `DomText.create` and `collectDomSnapshot`. |
557
625
  | `DomTextRebuildOptions`, `DomSdfRebuildOptions` | Options for `rebuild()`; `atlas: true` forces a fresh atlas. |
558
626
  | `DomTextStats`, `DomSdfStats` | Timings and counts from the most recent build, exposed as `stats`. |
559
- | `DomTextBackend` | Retained coverage name: `'sdf'` or `'windfoil'`. |
627
+ | `DomTextBackend` | Retained coverage name: `'sdf'`, `'windfoil'`, `'slug'`, or `'auto'`. |
560
628
  | `DomTextLayoutEngine` | Layout engine name: `'range'` or `'pretext'`. |
561
629
  | `FontStyleSnapshot` | One captured font style, keyed for atlas sharing across identical styles. |
562
630
  | `GlyphBreak` | Where a line may break before a glyph: `'none'`, `'soft'`, or `'hard'`. |
@@ -572,8 +640,8 @@ defines public contracts.
572
640
  | `SdfAtlasMode` | Atlas generator selection: `'auto'`, `'gpu'`, or `'cpu'`. |
573
641
  | `SdfColorLayer` | Owned sRGB companion texture and atlas row bounds. |
574
642
  | `SdfMotionOptions` | Motion controls: enabled, mode, strength, speed, and stagger. |
575
- | `SdfOutlineOptions` | Outward outline width, color, and opacity. |
576
- | `SdfDropShadowOptions` | Hard drop-shadow offsets, color, and opacity. |
643
+ | `SdfOutlineOptions` | Outward outline `width`, `blur`, `color`, and `opacity`. |
644
+ | `SdfDropShadowOptions` | Drop-shadow `offsetX`, `offsetY`, `blur`, `color`, and `opacity`. |
577
645
  | `SdfTextMaterialOptions` | Constructor options for the standalone `SdfTextMaterial`. |
578
646
  | `SdfTextQuality` | Sampling quality: `'standard'` or `'high'`. |
579
647
  | `TextBlockLayout` | Per-block wrap metrics that `reflowSnapshot` re-wraps from. |
@@ -616,74 +684,74 @@ Selective visual reconstruction, not a general DOM renderer:
616
684
 
617
685
  ## Browser support
618
686
 
619
- | Browser | Status | Notes |
620
- | ------------------- | ------------------ | ---------------------------------------------------------------------------------------------------- |
621
- | Chrome / Edge 128+ | Tested | Chromium WebGPU end-to-end suite (local and manual CI). |
622
- | Safari 26+ | Expected, untested | Ships WebGPU by default; not automated. |
623
- | Firefox 141+ | Expected, untested | Ships WebGPU; not automated. |
624
- | Non-WebGPU browsers | SDF only, untested | `WebGPURenderer` falls back to WebGL2 with `atlasMode: 'auto'` or `'cpu'`; Windfoil and Slug cannot. |
687
+ | Browser | Status | Notes |
688
+ | ------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
689
+ | Chrome / Edge 128+ | Tested | Chromium WebGPU end-to-end suite (local and manual CI). |
690
+ | Safari 26+ | Expected, untested | Ships WebGPU by default; Playwright `webkit-webgpu` project configured (not run in default Chromium CI). |
691
+ | Firefox 141+ | Expected, untested | Ships WebGPU; Playwright `firefox-webgpu` project configured (not run in default Chromium CI). |
692
+ | Non-WebGPU browsers | SDF verified | Playwright `chromium-webgl2-fallback` verifies `WebGPURenderer` WebGL2 fallback with `atlasMode: 'auto'` CPU EDT and `textBackend: 'auto'` / `slug.fallback: 'sdf'`. |
625
693
 
626
694
  Serve over HTTPS in production, await `renderer.init()`, guard SSR (`DomSdf.create()` is browser-only), and inspect the active backend.
627
695
 
628
696
  ## Comparison with other 3D web text libraries
629
697
 
630
- `ultra-text` renders browser HTML/CSS and loaded fonts directly—zero offline bake or font-file fetch—in 1 draw call per subtree. Compared head-to-head on [the online benchmark summary](https://ultra-text.makio.io/docs#comparison) (headless Chrome 157, Apple M3 Max / macOS 15.8, `three` `0.188.0-dev.29c99f4`, Noto Sans Regular, 1,000-glyph paragraph & 200 HUD labels, `3200×2400` RGBA8 sRGB): steady frames from the uncontended `2026-11-15` `--full` baseline (`U-sdf` A/A within ±1% `E2`), cold/update/relayout from `2026-11-19` `--full` (`n=10/30/32`, W4 `P-tilt`/`D-160` had external load so `2026-11-15` holds steady cells), GPU memory from `2026-11-22` (`ultimate-perf-1122` W5), and payloads/reflow CPU from `2026-11-23`. `three-mesh-ui` and drei `<Html>` were not measured.
698
+ `ultra-text` renders browser HTML/CSS and loaded fonts directly—zero offline bake or font-file fetch—in 1 draw call per subtree. Compared head-to-head on [the online benchmark summary](https://ultra-text.makio.io/docs#comparison) (`2026-11-28`, headless Chrome `158.0.8127.88`, Apple M3 Max / macOS `15.8.3`, `three` `0.188.0-dev.29c99f4`, Noto Sans Regular, 1,000-glyph paragraph & 200 HUD labels, `3200×2400` RGBA8 sRGB, with the `three@0.187.0` package build verified on WebGPU Chrome with byte-identical VRAM): W1 cold (`n=10`), W2 updates (`n=30`), W3 relayout (`n=32`), W5 GPU memory, and W6 zoom come from the post-merge `2026-11-28` `--full` run; W4 steady (`n=8` rounds, hardware `E2` GPU pass timestamps matching uncontended baseline `0.065 / 0.070 / 0.067 ms`) comes from the `2026-11-28` `--phases steady` run, and payloads/`reflow()` CPU were run `2026-11-28`. `three-mesh-ui` and drei `<Html>` were not measured.
631
699
 
632
700
  ```text
633
701
  Steady frame · 200 HUD labels (3200×2400, E1 ms/frame — lower is faster)
634
- ultra-text SDF (1 capture) █ 0.074 ms · 1 draw
635
- troika BatchedText ██ 0.153 ms · 1 draw
636
- @pmndrs/glyph MSDF ×200 ███ 0.211 ms · 2 draws
637
- troika 200 Text ████████████████████████ 1.69 ms · 200 draws
702
+ ultra-text SDF (1 capture) █ 0.090 ms · 1 draw
703
+ troika BatchedText ██ 0.158 ms · 1 draw
704
+ @pmndrs/glyph MSDF ×200 ███ 0.217 ms · 2 draws
705
+ troika 200 Text ████████████████████████ 1.730 ms · 200 draws
638
706
 
639
707
  Steady frame · 1,000-glyph paragraph (3200×2400, E1 ms/frame — lower is faster)
640
- ultra-text SDF █████████ 0.075 ms · 1 draw
641
- @pmndrs/glyph MSDF ███████████████ 0.129 ms · 2 draws
708
+ ultra-text SDF ██████████ 0.088 ms · 1 draw
709
+ @pmndrs/glyph MSDF ████████████████ 0.140 ms · 2 draws
642
710
  troika Text (WebGL2) █████████████████ 0.144 ms · 1 draw
643
- ultra-text Slug (vector) ██████████████████ 0.158 ms · 1 draw
644
- @pmndrs/glyph Slug (vector) ████████████████████████ 0.206 ms · 2 draws
711
+ ultra-text Slug (vector) ████████████████████ 0.170 ms · 1 draw
712
+ @pmndrs/glyph Slug (vector) ████████████████████████ 0.207 ms · 2 draws
645
713
 
646
714
  Width relayout · 1,000 glyphs (480–720 px cycle — lower is faster)
647
- ultra-text reflow() █████████ 1.46 ms
648
- @pmndrs/glyph MSDF █████████████ 1.95 ms
649
- @pmndrs/glyph Slug ███████████████ 2.31 ms
650
- troika Text ███████████████ 2.37 ms
651
- ultra-text CSS + rebuild() ████████████████████████ 3.71 ms
715
+ ultra-text reflow() █████████ 1.49 ms
716
+ @pmndrs/glyph MSDF ██████████████ 2.30 ms
717
+ troika Text ████████████████ 2.69 ms
718
+ @pmndrs/glyph Slug █████████████████ 2.89 ms
719
+ ultra-text CSS + rebuild() ████████████████████████ 4.07 ms
652
720
 
653
721
  Resident GPU memory · 1,000-glyph paragraph (lower is leaner)
654
- ultra-text Slug (TTF) ██ 0.17 MiB
655
- @pmndrs/glyph Slug (ASCII) ███ 0.24 MiB (0.17 MiB subsetted to 49 chars)
656
- ultra-text SDF (96 px R8) ████████ 0.64 MiB
657
- @pmndrs/glyph MSDF (ASCII) █████████████████ 1.44 MiB (0.85 MiB subsetted to 49 chars)
722
+ ultra-text Slug (TTF) ██ 0.19 MiB
723
+ @pmndrs/glyph Slug (ASCII) ███ 0.24 MiB
724
+ ultra-text SDF (96 px R8) █████ 0.42 MiB
725
+ @pmndrs/glyph MSDF (ASCII) █████████████████ 1.44 MiB
658
726
  troika Text (slab + canvas) ████████████████████████ 2.04 MiB
659
727
  ```
660
728
 
661
- | | `ultra-text` 1.0 (SDF) | `ultra-text` 1.0 (Slug) | `@pmndrs/glyph` 0.1.0 | `troika-three-text` 0.53.1 (drei `<Text>`) |
662
- | :------------------------------------- | :----------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- |
663
- | three.js renderer | `WebGPURenderer`; raw WebGPU through `ultra-text/vanilla` | `WebGPURenderer`; raw WebGPU through `ultra-text/slug-vanilla` | `WebGPURenderer` (classic `WebGLRenderer` unsupported) | classic `WebGLRenderer` only (GLSL through `onBeforeCompile`) |
664
- | Fonts | whatever the page loaded (WOFF2, variable, system fonts, colour emoji); no bake step | runtime font outlines or zero-file Canvas 2D glyph trace; no offline bake step | a `.font.glb` from its CLI (Noto Sans ASCII, 132 glyphs: 3.1 s, 1.55 MB, 295 kB brotli) or a runtime bake of TTF/OTF; no WOFF/WOFF2 or variable fonts | a `.ttf`/`.otf`/`.woff` URL (`.woff2` throws); missing characters load from a CDN |
665
- | Layout | the browser's own CSS layout (Range) or Pretext | the browser's own CSS layout (Range) or Pretext | its own shaping and layout (HarfRust in Wasm) | its own layout in a worker |
666
- | First frame, 1,000-glyph paragraph [1] | 33.9 ms (GPU), 58.9 ms (CPU) | 35.7 ms (TTF), 74.8 ms (traced) | 48.8 ms (MSDF), 56.4 ms (Slug) | **23.4 ms** |
667
- | First frame, 200 labels [1] | 39.7 ms (one capture) | one capture over all 200 | 75.5 ms | 39.1 ms (200 `Text`), **26.2 ms** (`BatchedText`) |
668
- | Edit 10 letters already drawn [2] | 3.0 ms (GPU), **2.4 ms** (CPU) | 2.7 ms (TTF), 2.8 ms (traced) | 2.5 ms MSDF, 2.8 ms Slug | 2.5 ms |
669
- | Edit adding a never-drawn letter [2] | 4.3 ms (GPU atlas), 3.1 ms (CPU atlas), 2.6 ms with `extraGlyphs` | **2.9 ms** (TTF, `#ga` in-place), 4.1 ms (traced) | **2.2 ms** MSDF, 2.7 ms Slug (baked ahead) | 3.0 ms |
670
- | Width change, 1,000 glyphs [2] | **1.46 ms** with `reflow()` (0.041 ms CPU only); 3.7 ms with CSS + `rebuild()` | 3.5–3.6 ms with CSS + `rebuild()` | 1.95 ms (MSDF), 2.31 ms (Slug) | 2.37 ms |
671
- | Frame, 1,000 glyphs / 160 px [3] | **0.075 ms** / **0.087 ms** | 0.158 ms / 0.168 ms (0.053 ms net GPU at 160 px) | 0.129 / 0.156 ms (MSDF); 0.206 / 0.213 ms (Slug) | 0.144 ms / 0.142 ms |
672
- | Frame, 200 labels [3] | **0.074 ms** | 1 draw per subtree | 0.211 ms | 1.69 ms (200 `Text`), 0.153 ms (`BatchedText`) |
673
- | Draw calls, paragraph / 200 labels | **1 / 1** | **1 / 1** | 2 / 2 (double-sided text in two passes) | 1 / 200 (1 with `BatchedText`) |
674
- | GPU memory, paragraph [4] | **0.64 MiB** (5.3 MiB GPU JFA peak; 0.64 MiB CPU peak) | **0.17 MiB** TTF (0.21 MiB traced) | 1.44 MiB MSDF, 0.24 MiB Slug for ASCII bake (0.85 / 0.17 MiB for the paragraph's 49 chars) | 2.04 MiB (1.04 MiB 256-glyph RGBA slab & buffers + 1.00 MiB SDF generator canvas) |
675
- | Zoom 10× / 100× [5] | sharp / soft SDF stems (`textBackend: 'windfoil'` also analytic) | **exact quadratic curves** at 100× | MSDF keeps corners; Slug exact | sharp / corners round |
676
- | Outline and drop shadow | on every backend | on every backend (SDF underlay) | MSDF only | outline with blur and offset, inner stroke |
677
- | Colour emoji | **yes**, the browser's own | **yes**, SDF colour companion | not yet (roadmap) | monochrome |
678
- | JS + Wasm, min+gzip | **41.1 kB** `DomText + Text` (36.6 kB brotli; 56.3 kB gzip full root; **31.7 kB** vanilla) | +17.1 kB lazy (+15.5 kB brotli; `ultra-text/slug`: 40.9 kB, 36.1 kB brotli; vanilla: 33.7 kB, 30.1 kB brotli) | 122.3 kB JS + 501.0 kB shaper Wasm (623.3 kB; 494.6 kB brotli) | 42.2 kB `Text` (36.6 kB brotli; 44.3 kB with `BatchedText` + `preloadFont`) |
679
-
680
- 1. Cold authoring call → first frame GPU completion, fonts preloaded, warm shader cache (`n = 10`). `ultra-text` SDF builds in `5.35 ms` GPU (`4.56 ms` in `2026-11-22` W5) + `6.66 ms` layout + `13.3 ms` first submit (`4.30 / 5.89 / 15.1 ms` on Slug TTF).
681
- 2. Mutation → GPU completion (`n = 30` edits, `n = 32` width changes). `reflow()` avoids DOM reads (**`0.041 ms`** standalone CPU median on Apple M3 Max, `2026-11-23`; **`1.46 ms`** end-to-end). Headroom-on-first-miss cuts unseen-glyph Slug rebuilds to `2.89 ms` (TTF) and `4.14 ms` (traced).
682
- 3. Whole `3200×2400` frame batches (`E1`, `n = 8`), `E2` GPU timestamps, `E3` `ioreg` (`troika ÷ ultra-text` `1.67–2.02`, `glyph MSDF ÷ ultra-text` `1.10–1.73`, `glyph Slug ÷ ultra-text SDF` `2.06–2.76`; 160 px net GPU Slug `0.053 ms` vs `glyph` `0.090 ms`). Net text cost over empty frame: `0.010–0.016 ms` (`ultra-text` SDF) vs `0.008 ms` (`troika`) vs `0.017–0.071 ms` (`glyph` MSDF). 200 `troika Text` calls are CPU-bound (`1.68 ms` CPU/frame vs `0.012 ms`).
683
- 4. Post-renderer GPU allocations: `glyph` ASCII bake `1.44 / 0.24 MiB` (`0.85 / 0.17 MiB` at 49 chars); `troika` allocates `2048×128` 256-glyph RGBA slab + buffers (`1.04 MiB`) + auxiliary generator canvas (`1.00 MiB`).
684
- 5. Verified on the `shots/zoom-grid.png` contact sheet (`"Rag Kerning quartz 0.5% Ж"` at 1×/10×/100× vs Chrome DOM).
685
-
686
- Payloads (Vite 8, `es2022`, `NODE_ENV=production`, `three/*` external, `1 kB = 1,000 B`, run `2026-11-23`). Qualitative notes checked `2026-11-15` in [glyph](https://github.com/pmndrs/glyph) and [troika](https://github.com/protectwise/troika/tree/main/packages/troika-three-text).
729
+ | | `ultra-text` 1.0.3 (SDF) | `ultra-text` 1.0.3 (Slug) | `@pmndrs/glyph` 0.1.0 | `troika-three-text` 0.53.1 (drei `<Text>`) |
730
+ | :------------------------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------- |
731
+ | three.js renderer | `WebGPURenderer`; raw WebGPU through `ultra-text/vanilla` | `WebGPURenderer`; raw WebGPU through `ultra-text/slug-vanilla` | `WebGPURenderer` (classic `WebGLRenderer` unsupported) | classic `WebGLRenderer` only (GLSL through `onBeforeCompile`) |
732
+ | Fonts | whatever the page loaded (WOFF2, variable, system fonts, colour emoji); no bake step | runtime font outlines or zero-file Canvas 2D glyph trace; no offline bake step | a `.font.glb` from its CLI (Noto Sans ASCII, 132 glyphs: 3.1 s, 1.55 MB, 295 kB brotli) or a runtime bake of TTF/OTF; no WOFF/WOFF2 or variable fonts | a `.ttf`/`.otf`/`.woff` URL (`.woff2` throws); missing characters load from a CDN |
733
+ | Layout | the browser's own CSS layout (Range) or Pretext | the browser's own CSS layout (Range) or Pretext | its own shaping and layout (HarfRust in Wasm) | its own layout in a worker |
734
+ | First frame, 1,000-glyph paragraph [1] | 34.8 ms (GPU), 49.6 ms (CPU) | 37.2 ms (TTF), 72.6 ms (traced) | 48.7 ms (MSDF), 57.1 ms (Slug) | **24.8 ms** |
735
+ | First frame, 200 labels [1] | 40.8 ms (one capture) | one capture over all 200 | 78.7 ms | 40.2 ms (200 `Text`), **27.8 ms** (`BatchedText`) |
736
+ | Edit 10 letters already drawn [2] | 4.05 ms (GPU), 3.67 ms (CPU) | 3.69 ms (TTF), 3.43 ms (traced) | 3.21 ms MSDF, 4.22 ms Slug | **3.04 ms** |
737
+ | Edit adding a never-drawn letter [2] | 3.95 ms (GPU atlas), 3.67 ms (CPU atlas), 3.30 ms with `extraGlyphs` | **3.20 ms** (TTF, `#ga` in-place), 4.05 ms (traced) | 3.32 ms MSDF, 4.38 ms Slug (baked ahead) | 3.64 ms |
738
+ | Width change, 1,000 glyphs [2] | **1.49 ms** with `reflow()` (0.031 ms CPU only); 4.07 ms with CSS + `rebuild()` | 4.44 ms (TTF), 3.98 ms (traced) with CSS + `rebuild()` | 2.30 ms (MSDF), 2.89 ms (Slug) | 2.69 ms |
739
+ | Frame, 1,000 glyphs / 160 px [3] | **0.088 ms** / **0.085 ms** | 0.170 ms / 0.177 ms (0.049 ms net GPU at 160 px) | 0.140 / 0.163 ms (MSDF); 0.207 / 0.206 ms (Slug) | 0.144 ms / 0.146 ms |
740
+ | Frame, 200 labels [3] | **0.090 ms** | 1 draw per subtree | 0.217 ms | 1.730 ms (200 `Text`), 0.158 ms (`BatchedText`) |
741
+ | Draw calls, paragraph / 200 labels | **1 / 1** | **1 / 1** | 2 / 2 (double-sided text in two passes) | 1 / 200 (1 with `BatchedText`) |
742
+ | GPU memory, paragraph [4] | **0.42 MiB** (1.81 MiB GPU peak; 0.42 MiB CPU peak) | **0.19 MiB** TTF (0.23 MiB traced) | 1.44 MiB MSDF, 0.24 MiB Slug for ASCII bake | 2.04 MiB (1.04 MiB 256-glyph RGBA slab & buffers + 1.00 MiB SDF generator canvas) |
743
+ | Zoom 10× / 100× [5] | sharp / soft SDF stems (`textBackend: 'windfoil'` also analytic) | **exact quadratic curves** at 100× | MSDF keeps corners; Slug exact | sharp / corners round |
744
+ | Outline and drop shadow | on every backend | on every backend (SDF underlay) | MSDF only | outline with blur and offset, inner stroke |
745
+ | Colour emoji | **yes**, the browser's own | **yes**, SDF colour companion | not yet (roadmap) | monochrome |
746
+ | JS + Wasm, min+gzip | 50.7 kB `DomText + Text` (45.1 kB brotli; 67.1 kB gzip full root; **41.7 kB** gzip / **36.7 kB** brotli vanilla) | +19.2 kB lazy (+17.4 kB brotli; `ultra-text/slug`: 48.7 kB, 42.8 kB brotli; vanilla: **40.9 kB**, **36.1 kB** brotli) | 122.3 kB JS + 501.0 kB shaper Wasm (623.3 kB; 494.6 kB brotli) | 42.2 kB `Text` (36.6 kB brotli; 44.3 kB with `BatchedText` + `preloadFont`) |
747
+
748
+ 1. Cold authoring call → first frame GPU completion, fonts preloaded, warm shader cache (`n = 10`). `ultra-text` SDF builds in `6.20 ms` GPU (`1968×192` atlas) + `6.78 ms` layout + `13.8 ms` first submit (`4.95 / 6.66 / 15.9 ms` on Slug TTF).
749
+ 2. Mutation → GPU completion (`n = 30` edits, `n = 32` width changes). `reflow()` avoids DOM reads (**`0.031 ms`** standalone CPU median on Apple M3 Max, `2026-11-28`; **`1.49 ms`** end-to-end / `0.11 ms` ready). Headroom-on-first-miss keeps unseen-glyph Slug rebuilds at `3.20 ms` (TTF, `1.26 ms` ready) and `4.05 ms` (traced, `2.32 ms` ready).
750
+ 3. Whole `3200×2400` frame batches (`E1`, `n = 8`), `E2` GPU timestamps (`0.065 / 0.070 / 0.067 ms` on `P-flat` / `D-160` / `L-hud`), `E3` `ioreg` (`troika ÷ ultra-text` `1.64–2.08` on `P-flat` / `1.76–2.70` on `L-hud`, `glyph MSDF ÷ ultra-text` `1.17–1.71` on `P-flat` / `1.19–2.42` on `L-hud`, `glyph Slug ÷ ultra-text SDF` `2.22–2.36`; 160 px net GPU Slug `0.049 ms` vs `glyph` `0.088 ms`). Net text cost (`E2` net) over empty frame: `0.007–0.012 ms` (`ultra-text` SDF) vs `0.003–0.011 ms` (`troika`) vs `0.018–0.027 ms` (`glyph` MSDF). 200 `troika Text` calls are CPU-bound (`1.726 ms` CPU/frame vs `0.012 ms`). Note: background CI runner load (`load1 6.5–17.3`) lifted CPU-bound `E1` waits during the post-merge `--phases steady` pass while `E2` GPU pass times matched uncontended runs.
751
+ 4. Post-renderer GPU allocations: `glyph` ASCII bake `1.44 / 0.24 MiB`; `troika` allocates `2048×128` 256-glyph RGBA slab + buffers (`1.04 MiB`) + auxiliary generator canvas (`1.00 MiB`).
752
+ 5. Verified on the zoom contact sheet (`"Rag Kerning quartz 0.5% Ж"` at 1×/10×/100× vs Chrome DOM).
753
+
754
+ Payloads (Vite 8, `es2022`, `NODE_ENV=production`, `three/*` external, `1 kB = 1,000 B`, run `2026-11-28`). Qualitative notes checked `2026-11-15` in [glyph](https://github.com/pmndrs/glyph) and [troika](https://github.com/protectwise/troika/tree/main/packages/troika-three-text).
687
755
 
688
756
  ## Demo and documentation
689
757
 
@@ -712,6 +780,16 @@ pnpm install --frozen-lockfile && pnpm test
712
780
  The unit suite does not render; prefer local WebGPU hardware for rendering checks. See
713
781
  [`CONTRIBUTING.md`](./CONTRIBUTING.md) and [`AGENTS.md`](./AGENTS.md).
714
782
 
783
+ ## Built by Makio64 · Commercial support
784
+
785
+ Created and maintained by [David Ronai (Makio64)](https://makio.io)
786
+ ([X](https://x.com/makio64) · [LinkedIn](https://www.linkedin.com/in/davidronai/)).
787
+
788
+ `ultra-text` is MIT-licensed and free for personal and commercial projects. Need a custom WebGPU
789
+ or Three.js interactive experience, graphics R&D, performance audit, or priority integration
790
+ support for your studio? Reach out via [makio.io](https://makio.io) or
791
+ [ultra-text.makio.io/connect](https://ultra-text.makio.io/connect).
792
+
715
793
  ## License
716
794
 
717
795
  [MIT](./LICENSE) © David Ronai. Windfoil-derived preprocessing and shader portions are Apache-2.0,