@mlightcad/mtext-renderer 0.12.11 → 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 +268 -262
- package/dist/index.umd.cjs +7 -7
- package/dist/mtext-renderer-worker.js +14 -11
- package/lib/font/fontManager.d.ts +4 -2
- package/lib/renderer/mtext.d.ts +4 -3
- package/package.json +1 -1
|
@@ -35761,26 +35761,29 @@ class Da extends Xt {
|
|
|
35761
35761
|
const e = Array.from(Da.getFonts(this._mtextData.text || "", !0));
|
|
35762
35762
|
if (!this._fontsInStyleLoaded) {
|
|
35763
35763
|
if (this._style.font) {
|
|
35764
|
-
const
|
|
35765
|
-
|
|
35764
|
+
const o = this.getFontName(this._style.font);
|
|
35765
|
+
o && e.push(o);
|
|
35766
35766
|
}
|
|
35767
35767
|
if (this._style.bigFont) {
|
|
35768
|
-
const
|
|
35769
|
-
|
|
35768
|
+
const o = this.getFontName(this._style.bigFont);
|
|
35769
|
+
o && e.push(o);
|
|
35770
35770
|
}
|
|
35771
35771
|
if (this._style.extendedFont) {
|
|
35772
|
-
const
|
|
35773
|
-
|
|
35772
|
+
const o = this.getFontName(this._style.extendedFont);
|
|
35773
|
+
o && e.push(o);
|
|
35774
35774
|
}
|
|
35775
35775
|
}
|
|
35776
|
-
const s = (t == null ? void 0 : t.awaitFonts) ?? (!this._fontManager.lazyFontLoading || this._fontManager.awaitFontsBeforeDraw), i =
|
|
35777
|
-
if (i.length > 0 && (this._fontManager.
|
|
35778
|
-
|
|
35776
|
+
const s = (t == null ? void 0 : t.awaitFonts) ?? (!this._fontManager.lazyFontLoading || this._fontManager.awaitFontsBeforeDraw), i = [...new Set(e)], r = new Set(i.map((o) => o.toLowerCase())), a = this._fontManager.getFontsToLoad().filter((o) => !r.has(o.toLowerCase()));
|
|
35777
|
+
if (this._fontManager.lazyFontLoading ? i.length > 0 && (s && a.length > 0 && this._fontManager.requestFonts(a), s ? await this._fontManager.requestFonts(i) : this._fontManager.requestFonts(i)) : (i.length > 0 || a.length > 0) && await this._fontManager.loadFontsByNames([
|
|
35778
|
+
...i,
|
|
35779
|
+
...a
|
|
35780
|
+
]), e.length > 0) {
|
|
35781
|
+
const o = [
|
|
35779
35782
|
this._style.font ? this.getFontName(this._style.font) : void 0,
|
|
35780
35783
|
this._style.bigFont ? this.getFontName(this._style.bigFont) : void 0,
|
|
35781
35784
|
this._style.extendedFont ? this.getFontName(this._style.extendedFont) : void 0
|
|
35782
|
-
].filter((
|
|
35783
|
-
(
|
|
35785
|
+
].filter((h) => !!h);
|
|
35786
|
+
(o.length === 0 || o.every((h) => this._fontManager.isFontLoaded(h))) && (this._fontsInStyleLoaded = !0);
|
|
35784
35787
|
}
|
|
35785
35788
|
this.syncDraw();
|
|
35786
35789
|
}
|
|
@@ -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
|