three-text 0.2.19 → 0.3.0
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 +6 -2
- package/dist/index.cjs +185 -332
- package/dist/index.d.ts +10 -38
- package/dist/index.js +185 -332
- package/dist/index.min.cjs +704 -723
- package/dist/index.min.js +705 -724
- package/dist/index.umd.js +185 -332
- package/dist/index.umd.min.js +710 -729
- package/dist/three/index.cjs +3 -1
- package/dist/three/index.d.ts +1 -12
- package/dist/three/index.js +3 -1
- package/dist/three/react.d.ts +5 -13
- package/dist/types/core/Text.d.ts +1 -4
- package/dist/types/core/cache/GlyphGeometryBuilder.d.ts +4 -7
- package/dist/types/core/cache/sharedCaches.d.ts +6 -7
- package/dist/types/core/geometry/Extruder.d.ts +0 -1
- package/dist/types/core/shaping/TextShaper.d.ts +1 -4
- package/dist/types/core/types.d.ts +5 -6
- package/dist/types/index.d.ts +1 -1
- package/dist/types/three/index.d.ts +1 -5
- package/dist/types/utils/Cache.d.ts +14 -0
- package/dist/types/webgl/index.d.ts +12 -0
- package/dist/types/webgpu/index.d.ts +10 -0
- package/dist/webgl/index.cjs +18 -0
- package/dist/webgl/index.d.ts +12 -0
- package/dist/webgl/index.js +18 -0
- package/dist/webgpu/index.cjs +80 -1
- package/dist/webgpu/index.d.ts +10 -0
- package/dist/webgpu/index.js +80 -1
- package/package.json +9 -4
package/dist/index.d.ts
CHANGED
|
@@ -5,43 +5,19 @@ interface HyphenationTrieNode {
|
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
interface LRUCacheOptions<K, V> {
|
|
9
|
-
maxEntries?: number;
|
|
10
|
-
maxMemoryBytes?: number;
|
|
11
|
-
calculateSize?: (value: V) => number;
|
|
12
|
-
onEvict?: (key: K, value: V) => void;
|
|
13
|
-
}
|
|
14
8
|
interface CacheStats {
|
|
15
|
-
hits: number;
|
|
16
|
-
misses: number;
|
|
17
|
-
evictions: number;
|
|
18
9
|
size: number;
|
|
19
|
-
memoryUsage: number;
|
|
20
10
|
}
|
|
21
|
-
declare class
|
|
11
|
+
declare class Cache<K, V> {
|
|
22
12
|
private cache;
|
|
23
|
-
private head;
|
|
24
|
-
private tail;
|
|
25
|
-
private stats;
|
|
26
|
-
private options;
|
|
27
|
-
constructor(options?: LRUCacheOptions<K, V>);
|
|
28
13
|
get(key: K): V | undefined;
|
|
29
14
|
has(key: K): boolean;
|
|
30
15
|
set(key: K, value: V): void;
|
|
31
16
|
delete(key: K): boolean;
|
|
32
17
|
clear(): void;
|
|
33
|
-
getStats(): CacheStats & {
|
|
34
|
-
hitRate: number;
|
|
35
|
-
memoryUsageMB: number;
|
|
36
|
-
};
|
|
37
|
-
keys(): K[];
|
|
38
18
|
get size(): number;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
private addToHead;
|
|
42
|
-
private removeNode;
|
|
43
|
-
private removeTail;
|
|
44
|
-
private moveToHead;
|
|
19
|
+
keys(): K[];
|
|
20
|
+
getStats(): CacheStats;
|
|
45
21
|
}
|
|
46
22
|
|
|
47
23
|
interface BoundingBox {
|
|
@@ -251,6 +227,8 @@ interface TextGeometryInfo {
|
|
|
251
227
|
glyphCenter: Float32Array;
|
|
252
228
|
glyphIndex: Float32Array;
|
|
253
229
|
glyphLineIndex: Float32Array;
|
|
230
|
+
glyphProgress: Float32Array;
|
|
231
|
+
glyphBaselineY: Float32Array;
|
|
254
232
|
};
|
|
255
233
|
glyphs: GlyphGeometryInfo[];
|
|
256
234
|
planeBounds: BoundingBox;
|
|
@@ -269,10 +247,7 @@ interface TextGeometryInfo {
|
|
|
269
247
|
}
|
|
270
248
|
interface TextHandle extends TextGeometryInfo {
|
|
271
249
|
getLoadedFont(): LoadedFont | undefined;
|
|
272
|
-
|
|
273
|
-
hitRate: number;
|
|
274
|
-
memoryUsageMB: number;
|
|
275
|
-
}) | null;
|
|
250
|
+
getCacheSize(): number;
|
|
276
251
|
clearCache(): void;
|
|
277
252
|
measureTextWidth(text: string, letterSpacing?: number): number;
|
|
278
253
|
update(options: Partial<TextOptions>): Promise<TextHandle>;
|
|
@@ -316,7 +291,7 @@ interface TextOptions {
|
|
|
316
291
|
depth?: number;
|
|
317
292
|
lineHeight?: number;
|
|
318
293
|
letterSpacing?: number;
|
|
319
|
-
|
|
294
|
+
perGlyphAttributes?: boolean;
|
|
320
295
|
fontVariations?: {
|
|
321
296
|
[key: string]: number;
|
|
322
297
|
};
|
|
@@ -415,10 +390,7 @@ declare class Text {
|
|
|
415
390
|
static setMaxFontCacheMemoryMB(limitMB: number): void;
|
|
416
391
|
getLoadedFont(): LoadedFont | undefined;
|
|
417
392
|
measureTextWidth(text: string, letterSpacing?: number): number;
|
|
418
|
-
|
|
419
|
-
hitRate: number;
|
|
420
|
-
memoryUsageMB: number;
|
|
421
|
-
}) | null;
|
|
393
|
+
getCacheSize(): number;
|
|
422
394
|
clearCache(): void;
|
|
423
395
|
private createGlyphAttributes;
|
|
424
396
|
private resetHelpers;
|
|
@@ -480,7 +452,7 @@ declare class FontMetadataExtractor {
|
|
|
480
452
|
static getFontMetrics(metrics: ExtractedMetrics): FontMetrics;
|
|
481
453
|
}
|
|
482
454
|
|
|
483
|
-
declare const globalGlyphCache:
|
|
484
|
-
declare function createGlyphCache(
|
|
455
|
+
declare const globalGlyphCache: Cache<string, GlyphData>;
|
|
456
|
+
declare function createGlyphCache(): Cache<string, GlyphData>;
|
|
485
457
|
|
|
486
458
|
export { CacheStats, ColorByRange, ColorOptions, ColoredRange, CurveFidelityConfig, DEFAULT_CURVE_FIDELITY, ExtractedMetrics, FontMetadataExtractor, FontMetrics, GeometryOptimizationOptions, GlyphData, GlyphGeometryInfo, HarfBuzzAPI, HarfBuzzBlob, HarfBuzzBuffer, HarfBuzzFace, HarfBuzzFont, HarfBuzzInstance, HarfBuzzModule, HyphenationPatternsMap, HyphenationTrieNode, LayoutOptions, LineInfo, LoadedFont, PathInfo, ProcessedGeometry, Text, TextAlign, TextDirection, TextGeometryInfo, TextHandle, TextOptions, TextQueryOptions, TextRange, Triangles, VariationAxis, VerticalMetrics, createGlyphCache, globalGlyphCache };
|