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/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 LRUCache<K, V> {
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
- private evictIfNeeded;
40
- private evictTail;
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
- getCacheStatistics(): (CacheStats & {
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
- separateGlyphsWithAttributes?: boolean;
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
- getCacheStatistics(): (CacheStats & {
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: LRUCache<string, GlyphData>;
484
- declare function createGlyphCache(maxCacheSizeMB?: number): LRUCache<string, GlyphData>;
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 };