@mlightcad/mtext-renderer 0.11.3 → 0.11.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.
@@ -9,6 +9,17 @@ export declare const MIN_REASONABLE_MTEXT_WIDTH_HEIGHT_RATIO = 1.5;
9
9
  * only when estimating a replacement wrap width from explicit line content.
10
10
  */
11
11
  export declare const CJK_MTEXT_CHAR_WIDTH_HEIGHT_RATIO = 0.8;
12
+ /**
13
+ * Maximum width-to-height ratio for a declared MTEXT wrap box. Values above this
14
+ * are treated as corrupt DXF group-code 41 data (often coordinate-scale garbage)
15
+ * rather than an intentional column width.
16
+ */
17
+ export declare const MAX_REASONABLE_MTEXT_WIDTH_HEIGHT_RATIO = 1000000;
18
+ /**
19
+ * Maximum ratio between declared wrap width and the content-estimated width.
20
+ * Catches absurd widths even when text height is also very large.
21
+ */
22
+ export declare const MAX_REASONABLE_MTEXT_WIDTH_CONTENT_EXCESS = 10000;
12
23
  /**
13
24
  * Estimates a usable MTEXT wrap width from the longest explicit line in the raw
14
25
  * MTEXT string while preserving explicit line breaks such as `\P`.
@@ -23,5 +34,10 @@ export declare function estimateMTextWrapWidth(text: string, height: number): nu
23
34
  * the word-wrap width forces CJK text to wrap one character per line. When the
24
35
  * width is clearly impossible as a layout width, estimate a usable width from
25
36
  * the longest explicit MTEXT line and preserve explicit line breaks such as `\P`.
37
+ *
38
+ * Other exports carry absurdly large group-code 41 values. Using those widths for
39
+ * middle/center attachment shifts glyph geometry by tens of millions of drawing
40
+ * units and destroys float32 precision. Replace those with the same content-based
41
+ * estimate when the declared width far exceeds the rendered text.
26
42
  */
27
43
  export declare function resolveMTextWrapWidth(mtextData: Pick<MTextData, 'text' | 'height' | 'width'>): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mlightcad/mtext-renderer",
3
- "version": "0.11.3",
3
+ "version": "0.11.5",
4
4
  "description": "AutoCAD MText renderer based on Three.js",
5
5
  "license": "MIT",
6
6
  "author": "MLight Lee <mlight.lee@outlook.com>",
@@ -44,7 +44,7 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "@mlightcad/mtext-parser": "^1.5.0",
47
- "@mlightcad/shx-parser": "^1.3.4",
47
+ "@mlightcad/shx-parser": "^1.3.5",
48
48
  "iconv-lite": "^0.7.0",
49
49
  "idb": "^8.0.3",
50
50
  "opentype.js": "^2.0.0"