@mlightcad/mtext-renderer 0.12.10 → 0.12.12
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.js +854 -794
- package/dist/index.umd.cjs +8 -8
- package/dist/mtext-renderer-worker.js +290 -242
- package/lib/font/defaultFontLoader.d.ts +12 -0
- package/lib/font/fontManager.d.ts +4 -2
- package/lib/renderer/mtext.d.ts +4 -3
- package/lib/worker/unifiedRenderer.d.ts +2 -0
- package/package.json +1 -1
|
@@ -15,6 +15,12 @@ export declare class DefaultFontLoader implements FontLoader {
|
|
|
15
15
|
* each hit `fonts.json` independently.
|
|
16
16
|
*/
|
|
17
17
|
private _availableFontsPromise;
|
|
18
|
+
/**
|
|
19
|
+
* At most one forced `fonts.json` revalidation per baseUrl. Used when a
|
|
20
|
+
* requested face is missing from a possibly stale HTTP-cached catalog
|
|
21
|
+
* (e.g. jsDelivr `@main` with a long max-age).
|
|
22
|
+
*/
|
|
23
|
+
private _catalogRefreshAttempted;
|
|
18
24
|
/**
|
|
19
25
|
* Creates a new instance of DefaultFontLoader
|
|
20
26
|
*/
|
|
@@ -51,6 +57,12 @@ export declare class DefaultFontLoader implements FontLoader {
|
|
|
51
57
|
* @returns Promise that resolves to an array of FontLoadStatus objects
|
|
52
58
|
*/
|
|
53
59
|
load(fontNames: readonly string[]): Promise<FontLoadStatus[]>;
|
|
60
|
+
private clearAvailableFontsCache;
|
|
61
|
+
/**
|
|
62
|
+
* Drops the in-memory catalog and refetches `fonts.json`, bypassing the HTTP
|
|
63
|
+
* cache so CDN updates are visible after a miss.
|
|
64
|
+
*/
|
|
65
|
+
private refreshAvailableFontsFromNetwork;
|
|
54
66
|
/**
|
|
55
67
|
* Fetches and caches remote font metadata for the given base URL.
|
|
56
68
|
*/
|
|
@@ -58,8 +58,10 @@ export declare class FontManager {
|
|
|
58
58
|
/**
|
|
59
59
|
* When true, {@link MText.asyncDraw} / {@link Shape.asyncDraw} wait for fonts
|
|
60
60
|
* referenced by the content and style to finish loading before building
|
|
61
|
-
* geometry.
|
|
62
|
-
*
|
|
61
|
+
* geometry. Default/symbol fallback chains are still requested in the
|
|
62
|
+
* background (not awaited) under {@link lazyFontLoading}, so unused preset
|
|
63
|
+
* faces do not block the draw; redraw on {@link events.fontLoaded} if those
|
|
64
|
+
* faces are needed for the final glyphs.
|
|
63
65
|
*
|
|
64
66
|
* Has no effect when {@link lazyFontLoading} is false (draw already awaits).
|
|
65
67
|
*/
|
package/lib/renderer/mtext.d.ts
CHANGED
|
@@ -7,9 +7,10 @@ import * as THREE from 'three';
|
|
|
7
7
|
*/
|
|
8
8
|
export interface MTextDrawOptions {
|
|
9
9
|
/**
|
|
10
|
-
* Wait for fonts referenced by the content/style
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Wait for fonts referenced by the content/style to finish loading before
|
|
11
|
+
* building geometry. Default/symbol fallback chains are requested in the
|
|
12
|
+
* background under lazy loading (not awaited) so open-time draws are not
|
|
13
|
+
* blocked on unused preset faces.
|
|
13
14
|
*
|
|
14
15
|
* Defaults to `true` when {@link FontManager.lazyFontLoading} is false, or
|
|
15
16
|
* when {@link FontManager.awaitFontsBeforeDraw} is true. Otherwise fonts are
|
|
@@ -19,6 +19,8 @@ export declare class UnifiedRenderer {
|
|
|
19
19
|
private workerLazyFontLoading;
|
|
20
20
|
/** Last awaitFontsBeforeDraw value pushed to the worker pool, if any. */
|
|
21
21
|
private workerAwaitFontsBeforeDraw;
|
|
22
|
+
/** Last font base URL pushed to the worker pool, if any. */
|
|
23
|
+
private workerFontUrl;
|
|
22
24
|
/**
|
|
23
25
|
* Constructor
|
|
24
26
|
*
|