three-text 0.2.2 → 0.2.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/LICENSE_THIRD_PARTY +8 -7
- package/README.md +26 -6
- package/dist/index.cjs +157 -2102
- package/dist/index.js +157 -2102
- package/dist/index.min.cjs +2 -2
- package/dist/index.min.js +2 -2
- package/dist/index.umd.js +157 -2102
- package/dist/index.umd.min.js +2 -2
- package/dist/three/index.cjs +2 -2
- package/dist/three/index.js +3 -3
- package/dist/three/react.cjs +0 -7
- package/dist/three/react.js +0 -7
- package/package.json +2 -2
package/LICENSE_THIRD_PARTY
CHANGED
|
@@ -20,17 +20,18 @@ HarfBuzzJS is distributed under the MIT License, with some components
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
|
-
2.
|
|
23
|
+
2. libtess.js
|
|
24
24
|
|
|
25
|
-
This software includes
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
This software includes libtess.js (https://github.com/brendankenny/libtess.js),
|
|
26
|
+
a JavaScript port of the polygon tessellation library from the OpenGL Utility
|
|
27
|
+
Library (GLU), originally written by Eric Veach while at Silicon Graphics, Inc.
|
|
28
28
|
|
|
29
29
|
Original GLU tesselator:
|
|
30
|
-
Copyright (C) 1991-2000
|
|
30
|
+
Copyright (C) 1991-2000 Silicon Graphics, Inc.
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
Copyright (C)
|
|
32
|
+
libtess.js:
|
|
33
|
+
Copyright (C) 2000 Silicon Graphics, Inc.
|
|
34
|
+
Copyright (C) 2015 Google Inc.
|
|
34
35
|
|
|
35
36
|
The software is licensed under the SGI Free Software License B, Version 2.0
|
|
36
37
|
(See Appendix C for full license text)
|
package/README.md
CHANGED
|
@@ -19,18 +19,15 @@ A high fidelity 3D font renderer and text layout engine for the web
|
|
|
19
19
|
|
|
20
20
|
The library has a framework-agnostic core that returns raw vertex data, with lightweight adapters for [Three.js](https://threejs.org), [React Three Fiber](https://docs.pmnd.rs/react-three-fiber), [p5.js](https://p5js.org), [WebGL](https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API), and [WebGPU](https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API)
|
|
21
21
|
|
|
22
|
-
Under the hood, three-text relies on [HarfBuzz](https://github.com/harfbuzz/harfbuzzjs) for text shaping, [Knuth-Plass](http://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf) line breaking, [Liang](https://tug.org/docs/liang/liang-thesis.pdf) hyphenation, [
|
|
22
|
+
Under the hood, three-text relies on [HarfBuzz](https://github.com/harfbuzz/harfbuzzjs) for text shaping, [Knuth-Plass](http://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf) line breaking, [Liang](https://tug.org/docs/liang/liang-thesis.pdf) hyphenation, [libtess](https://github.com/brendankenny/libtess.js), based on the [GLU tessellator](https://www.songho.ca/opengl/gl_tessellation.html) by Eric Veach) for removing overlaps and triangulation, bezier curve polygonization from Maxim Shemanarev's [Anti-Grain Geometry](https://web.archive.org/web/20060128212843/http://www.antigrain.com/research/adaptive_bezier/index.html), and [Visvalingam-Whyatt](https://hull-repository.worktribe.com/preview/376364/000870493786962263.pdf) [line simplification](https://bost.ocks.org/mike/simplify/).
|
|
23
23
|
|
|
24
24
|
## Table of contents
|
|
25
25
|
|
|
26
26
|
- [Overview](#overview)
|
|
27
27
|
- [Getting started](#getting-started)
|
|
28
28
|
- [Three.js](#threejs)
|
|
29
|
-
- [p5.js](#p5js)
|
|
30
29
|
- [React Three Fiber](#react-three-fiber)
|
|
31
|
-
- [
|
|
32
|
-
- [WebGPU](#webgpu)
|
|
33
|
-
- [Core](#core)
|
|
30
|
+
- [p5.js](#p5js)
|
|
34
31
|
- [Development and examples](#development-and-examples)
|
|
35
32
|
- [Architecture](#architecture)
|
|
36
33
|
- [Why three-text?](#why-three-text)
|
|
@@ -94,6 +91,26 @@ const mesh = new THREE.Mesh(result.geometry, material);
|
|
|
94
91
|
scene.add(mesh);
|
|
95
92
|
```
|
|
96
93
|
|
|
94
|
+
#### React Three Fiber
|
|
95
|
+
|
|
96
|
+
```jsx
|
|
97
|
+
import { Canvas } from '@react-three/fiber';
|
|
98
|
+
import { Text } from 'three-text/three/react';
|
|
99
|
+
|
|
100
|
+
Text.setHarfBuzzPath('/hb/hb.wasm');
|
|
101
|
+
|
|
102
|
+
function App() {
|
|
103
|
+
return (
|
|
104
|
+
<Canvas>
|
|
105
|
+
<ambientLight />
|
|
106
|
+
<Text font="/fonts/Font.woff" size={72} depth={10}>
|
|
107
|
+
Hello React
|
|
108
|
+
</Text>
|
|
109
|
+
</Canvas>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
97
114
|
#### p5.js
|
|
98
115
|
|
|
99
116
|
```javascript
|
|
@@ -123,6 +140,9 @@ function draw() {
|
|
|
123
140
|
}
|
|
124
141
|
```
|
|
125
142
|
|
|
143
|
+
`createThreeTextGeometry()` accepts all the same options as Three.js (`layout`, `fontVariations`, `depth`, etc.) and returns `{ geometry, planeBounds, glyphs }`. Use `planeBounds` to center the text
|
|
144
|
+
|
|
145
|
+
|
|
126
146
|
### Setup
|
|
127
147
|
|
|
128
148
|
The library bundles harfbuzzjs but requires the WASM binary to be available at runtime. You have two options for providing it:
|
|
@@ -969,7 +989,7 @@ The build generates multiple module formats for core and all adapters:
|
|
|
969
989
|
|
|
970
990
|
## Acknowledgements
|
|
971
991
|
|
|
972
|
-
`three-text` is built on HarfBuzz and TeX, and this library would not exist without the authors and communities who contribute to, support, and steward these projects. Thanks to Theo Honohan and Yasi Perera for advice on graphics
|
|
992
|
+
`three-text` is built on HarfBuzz and TeX, and started as a Three.js project; this library would not exist without the authors and communities who contribute to, support, and steward these projects. Thanks to Theo Honohan and Yasi Perera for the advice on graphics
|
|
973
993
|
|
|
974
994
|
## License
|
|
975
995
|
|