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.
@@ -20,17 +20,18 @@ HarfBuzzJS is distributed under the MIT License, with some components
20
20
 
21
21
  ---
22
22
 
23
- 2. libtess2 / tess2-ts
23
+ 2. libtess.js
24
24
 
25
- This software includes tess2-ts (https://github.com/eXponenta/tess2.js), a
26
- TypeScript fork of Mikko Mononen's tess2.js (https://github.com/memononen/tess2.js),
27
- which in turn is a port of libtess2, based on the GLU tesselator by Eric Veach.
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, 2000 Eric Veach, Silicon Graphics, Inc.
30
+ Copyright (C) 1991-2000 Silicon Graphics, Inc.
31
31
 
32
- libtess2 and tess2.js:
33
- Copyright (C) 2012-2013 Mikko Mononen (memon@inside.org)
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, [libtess2](https://github.com/memononen/libtess2) (based on the [OpenGL Utility Library (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/).
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
- - [WebGL](#webgl)
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