@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.
@@ -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 r = this.getFontName(this._style.font);
35765
- r && e.push(r);
35764
+ const o = this.getFontName(this._style.font);
35765
+ o && e.push(o);
35766
35766
  }
35767
35767
  if (this._style.bigFont) {
35768
- const r = this.getFontName(this._style.bigFont);
35769
- r && e.push(r);
35768
+ const o = this.getFontName(this._style.bigFont);
35769
+ o && e.push(o);
35770
35770
  }
35771
35771
  if (this._style.extendedFont) {
35772
- const r = this.getFontName(this._style.extendedFont);
35773
- r && e.push(r);
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 = s ? [.../* @__PURE__ */ new Set([...e, ...this._fontManager.getFontsToLoad()])] : e;
35777
- if (i.length > 0 && (this._fontManager.lazyFontLoading ? s ? await this._fontManager.requestFonts(i) : this._fontManager.requestFonts(i) : await this._fontManager.loadFontsByNames(i), e.length > 0)) {
35778
- const r = [
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((o) => !!o);
35783
- (r.length === 0 || r.every((o) => this._fontManager.isFontLoaded(o))) && (this._fontsInStyleLoaded = !0);
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. Useful with {@link lazyFontLoading} when callers prefer a single
62
- * draw pass instead of redrawing on {@link events.fontLoaded}.
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
  */
@@ -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 and, when awaiting, the
11
- * configured default/symbol fallback chains to finish loading before
12
- * building geometry.
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/mtext-renderer",
3
- "version": "0.12.11",
3
+ "version": "0.12.12",
4
4
  "description": "AutoCAD MText renderer based on Three.js",
5
5
  "license": "MIT",
6
6
  "author": "MLight Lee <mlight.lee@outlook.com>",