@mlightcad/mtext-renderer 0.12.4 → 0.12.5
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 +14449 -14414
- package/dist/index.umd.cjs +7 -7
- package/dist/mtext-renderer-worker.js +14379 -14343
- package/lib/font/defaultFontLoader.d.ts +12 -0
- package/lib/font/defaultFontsPresets.d.ts +2 -2
- package/lib/font/fontManager.d.ts +7 -0
- package/lib/renderer/mtextProcessor.d.ts +4 -0
- package/package.json +1 -1
|
@@ -9,6 +9,12 @@ export declare class DefaultFontLoader implements FontLoader {
|
|
|
9
9
|
private _avaiableFonts;
|
|
10
10
|
private _baseUrl;
|
|
11
11
|
private _avaiableFontMap;
|
|
12
|
+
/**
|
|
13
|
+
* Shared in-flight metadata fetch. Concurrent {@link getAvailableFonts} /
|
|
14
|
+
* {@link load} callers (common with lazy per-entity font requests) must not
|
|
15
|
+
* each hit `fonts.json` independently.
|
|
16
|
+
*/
|
|
17
|
+
private _availableFontsPromise;
|
|
12
18
|
/**
|
|
13
19
|
* Creates a new instance of DefaultFontLoader
|
|
14
20
|
*/
|
|
@@ -31,6 +37,8 @@ export declare class DefaultFontLoader implements FontLoader {
|
|
|
31
37
|
/**
|
|
32
38
|
* Retrieves information about all available fonts in the system.
|
|
33
39
|
* Loads font metadata from a CDN if not already loaded.
|
|
40
|
+
* Concurrent callers share one in-flight fetch so `fonts.json` is requested
|
|
41
|
+
* at most once per loader instance / baseUrl.
|
|
34
42
|
* @returns Promise that resolves to an array of FontInfo objects
|
|
35
43
|
* @throws {Error} If font metadata cannot be loaded from the CDN
|
|
36
44
|
*/
|
|
@@ -43,6 +51,10 @@ export declare class DefaultFontLoader implements FontLoader {
|
|
|
43
51
|
* @returns Promise that resolves to an array of FontLoadStatus objects
|
|
44
52
|
*/
|
|
45
53
|
load(fontNames: readonly string[]): Promise<FontLoadStatus[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetches and caches remote font metadata for the given base URL.
|
|
56
|
+
*/
|
|
57
|
+
private fetchAvailableFonts;
|
|
46
58
|
/**
|
|
47
59
|
* Build one font map. The key is font name. The value is font info.
|
|
48
60
|
*/
|
|
@@ -9,11 +9,11 @@ export type DefaultFontsPreset =
|
|
|
9
9
|
'minimal'
|
|
10
10
|
/** Classic R12/R14 stack: SHX basics, GB big font, then mesh CJK and AMGDT. */
|
|
11
11
|
| 'r12r14'
|
|
12
|
-
/** Later-era stack:
|
|
12
|
+
/** Later-era stack: simsun first for Latin metrics, then hztxt big font. */
|
|
13
13
|
| 'modern'
|
|
14
14
|
/** Western SHX fonts plus simsun and AMGDT; no CJK-specific SHX big fonts. */
|
|
15
15
|
| 'international'
|
|
16
|
-
/** Broad CJK coverage:
|
|
16
|
+
/** Broad CJK coverage: simsun first, then GB big-font SHX files. */
|
|
17
17
|
| 'cjk';
|
|
18
18
|
/**
|
|
19
19
|
* Predefined text-font fallback chains (primary / big-font substitutes and CJK
|
|
@@ -228,6 +228,13 @@ export declare class FontManager {
|
|
|
228
228
|
* @returns The original font name if found, or the replacement font name if not found
|
|
229
229
|
*/
|
|
230
230
|
findAndReplaceFont(fontName: string): string;
|
|
231
|
+
/**
|
|
232
|
+
* Returns the first loaded font from {@link defaultFonts}.
|
|
233
|
+
*
|
|
234
|
+
* @param skipBigfont When true, ignores SHX BIGFONT faces so ASCII/Latin text
|
|
235
|
+
* is not forced through fullwidth CJK glyph cells.
|
|
236
|
+
*/
|
|
237
|
+
private pickLoadedDefaultFont;
|
|
231
238
|
/**
|
|
232
239
|
* Gets font by font name. Return undefined if not found.
|
|
233
240
|
* @param fontName - The font name to find
|
|
@@ -288,6 +288,10 @@ export declare class MTextProcessor {
|
|
|
288
288
|
private applyColorSnapshotChanges;
|
|
289
289
|
/**
|
|
290
290
|
* Apply width factor changes, resolving relative factors to absolute values.
|
|
291
|
+
*
|
|
292
|
+
* Absolute `\Wvalue;` replaces the current width factor. Relative `\Wvaluex;`
|
|
293
|
+
* multiplies the current width factor (AutoCAD / ezdxf semantics).
|
|
294
|
+
*
|
|
291
295
|
* @param widthFactor Width factor change data.
|
|
292
296
|
*/
|
|
293
297
|
private applyWidthFactorChange;
|