three-text 0.4.5 → 0.4.6

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/dist/p5/index.cjs CHANGED
@@ -52,6 +52,9 @@ if (typeof window !== 'undefined' && window.p5) {
52
52
  this._decrementPreload();
53
53
  });
54
54
  };
55
+ p5.prototype.enableThreeTextWoff2 = function (decoder) {
56
+ Text.Text.enableWoff2(decoder);
57
+ };
55
58
  p5.prototype.loadThreeTextFont = function (fontPath, fontVariations) {
56
59
  const fontRef = {
57
60
  buffer: null,
package/dist/p5/index.js CHANGED
@@ -50,6 +50,9 @@ if (typeof window !== 'undefined' && window.p5) {
50
50
  this._decrementPreload();
51
51
  });
52
52
  };
53
+ p5.prototype.enableThreeTextWoff2 = function (decoder) {
54
+ Text.enableWoff2(decoder);
55
+ };
53
56
  p5.prototype.loadThreeTextFont = function (fontPath, fontVariations) {
54
57
  const fontRef = {
55
58
  buffer: null,
@@ -50,6 +50,7 @@ class Text {
50
50
  static { this.registerPattern = Text$1.Text.registerPattern; }
51
51
  static { this.preloadPatterns = Text$1.Text.preloadPatterns; }
52
52
  static { this.setMaxFontCacheMemoryMB = Text$1.Text.setMaxFontCacheMemoryMB; }
53
+ static { this.enableWoff2 = Text$1.Text.enableWoff2; }
53
54
  // Main API - wraps core result in BufferGeometry
54
55
  static async create(options) {
55
56
  const coreResult = await Text$1.Text.create(options);
@@ -25,6 +25,7 @@ declare class Text {
25
25
  static registerPattern: typeof Text$1.registerPattern;
26
26
  static preloadPatterns: typeof Text$1.preloadPatterns;
27
27
  static setMaxFontCacheMemoryMB: typeof Text$1.setMaxFontCacheMemoryMB;
28
+ static enableWoff2: typeof Text$1.enableWoff2;
28
29
  static create(options: TextOptions): Promise<ThreeTextGeometryInfo>;
29
30
  }
30
31
 
@@ -48,6 +48,7 @@ class Text {
48
48
  static { this.registerPattern = Text$1.registerPattern; }
49
49
  static { this.preloadPatterns = Text$1.preloadPatterns; }
50
50
  static { this.setMaxFontCacheMemoryMB = Text$1.setMaxFontCacheMemoryMB; }
51
+ static { this.enableWoff2 = Text$1.enableWoff2; }
51
52
  // Main API - wraps core result in BufferGeometry
52
53
  static async create(options) {
53
54
  const coreResult = await Text$1.create(options);
@@ -143,6 +143,7 @@ const Text = Object.assign(Text$1, {
143
143
  registerPattern: index.Text.registerPattern,
144
144
  preloadPatterns: index.Text.preloadPatterns,
145
145
  setMaxFontCacheMemoryMB: index.Text.setMaxFontCacheMemoryMB,
146
+ enableWoff2: index.Text.enableWoff2,
146
147
  create: index.Text.create
147
148
  });
148
149
 
@@ -302,6 +302,7 @@ declare class Text$1 {
302
302
  private static fontCacheMemoryBytes;
303
303
  private static maxFontCacheMemoryBytes;
304
304
  private static fontIdCounter;
305
+ static enableWoff2(decoder: (data: ArrayBuffer | Uint8Array) => Uint8Array): void;
305
306
  private static stableStringify;
306
307
  private fontLoader;
307
308
  private loadedFont?;
@@ -362,6 +363,7 @@ declare const Text: react.ForwardRefExoticComponent<ThreeTextProps & react.RefAt
362
363
  registerPattern: typeof Text$1.registerPattern;
363
364
  preloadPatterns: typeof Text$1.preloadPatterns;
364
365
  setMaxFontCacheMemoryMB: typeof Text$1.setMaxFontCacheMemoryMB;
366
+ enableWoff2: typeof Text$1.enableWoff2;
365
367
  create: typeof Text$2.create;
366
368
  };
367
369
 
@@ -122,6 +122,7 @@ const Text = Object.assign(Text$1, {
122
122
  registerPattern: Text$2.registerPattern,
123
123
  preloadPatterns: Text$2.preloadPatterns,
124
124
  setMaxFontCacheMemoryMB: Text$2.setMaxFontCacheMemoryMB,
125
+ enableWoff2: Text$2.enableWoff2,
125
126
  create: Text$2.create
126
127
  });
127
128
 
@@ -13,6 +13,7 @@ export declare class Text {
13
13
  private static fontCacheMemoryBytes;
14
14
  private static maxFontCacheMemoryBytes;
15
15
  private static fontIdCounter;
16
+ static enableWoff2(decoder: (data: ArrayBuffer | Uint8Array) => Uint8Array): void;
16
17
  private static stableStringify;
17
18
  private fontLoader;
18
19
  private loadedFont?;
@@ -1,5 +1,9 @@
1
+ type Woff2Decoder = (data: ArrayBuffer | Uint8Array) => Uint8Array;
2
+ export declare function setWoff2Decoder(decoder: Woff2Decoder): void;
1
3
  export declare class WoffConverter {
2
4
  static detectFormat(buffer: ArrayBuffer): 'woff' | 'woff2' | 'ttf/otf';
3
5
  static decompressWoff(woffBuffer: ArrayBuffer): Promise<ArrayBuffer>;
6
+ static decompressWoff2(woff2Buffer: ArrayBuffer): ArrayBuffer;
4
7
  private static decompressZlib;
5
8
  }
9
+ export {};
@@ -17,6 +17,7 @@ export declare class Text {
17
17
  static registerPattern: typeof TextCore.registerPattern;
18
18
  static preloadPatterns: typeof TextCore.preloadPatterns;
19
19
  static setMaxFontCacheMemoryMB: typeof TextCore.setMaxFontCacheMemoryMB;
20
+ static enableWoff2: typeof TextCore.enableWoff2;
20
21
  static create(options: TextOptions): Promise<ThreeTextGeometryInfo>;
21
22
  }
22
23
  export type { TextOptions, ThreeTextGeometryInfo as TextGeometryInfo, LoadedFont };
@@ -7,5 +7,6 @@ export declare const Text: import("react").ForwardRefExoticComponent<import("./T
7
7
  registerPattern: typeof import("..").Text.registerPattern;
8
8
  preloadPatterns: typeof import("..").Text.preloadPatterns;
9
9
  setMaxFontCacheMemoryMB: typeof import("..").Text.setMaxFontCacheMemoryMB;
10
+ enableWoff2: typeof import("..").Text.enableWoff2;
10
11
  create: typeof ThreeTextCore.create;
11
12
  };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "three-text",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "3D mesh font geometry and text layout engine for the web",
5
5
  "main": "dist/three/index.cjs",
6
6
  "module": "dist/three/index.js",
7
7
  "type": "module",
8
8
  "types": "dist/three/index.d.ts",
9
+ "sideEffects": false,
9
10
  "exports": {
10
11
  ".": {
11
12
  "types": "./dist/three/index.d.ts",
@@ -107,7 +108,8 @@
107
108
  },
108
109
  "dependencies": {
109
110
  "harfbuzzjs": "^0.4.15",
110
- "libtess": "^1.2.2"
111
+ "libtess": "^1.2.2",
112
+ "woff2-decode": "^0.1.4"
111
113
  },
112
114
  "devDependencies": {
113
115
  "@react-three/fiber": ">=8.0.0",