@mlightcad/mtext-renderer 0.3.3 → 0.3.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/font/defaultFontLoader.d.ts +5 -4
- package/dist/font/fontManager.d.ts +6 -0
- package/dist/index.js +273 -184
- package/dist/index.umd.cjs +3 -3
- package/dist/renderer/mtextProcessor.d.ts +11 -1
- package/dist/renderer/types.d.ts +33 -2
- package/package.json +2 -2
|
@@ -58,6 +58,16 @@ export declare class MTextProcessor {
|
|
|
58
58
|
private _contextStack;
|
|
59
59
|
private _currentContext;
|
|
60
60
|
private _maxFontSize;
|
|
61
|
+
/**
|
|
62
|
+
* The current horizontal alignment for the paragraph.
|
|
63
|
+
*
|
|
64
|
+
* In AutoCAD MText, paragraph-level formatting commands (such as \pqr, \pql, \pqc)
|
|
65
|
+
* persist for the entire paragraph and are not scoped to inline formatting groups ({} blocks).
|
|
66
|
+
* Only character-level formatting (font, bold, italic, color, etc.) is scoped to {} and managed via Context.
|
|
67
|
+
* Therefore, paragraph alignment is maintained at the MTextProcessor level and not in Context,
|
|
68
|
+
* so it persists until explicitly changed by another paragraph alignment command.
|
|
69
|
+
*/
|
|
70
|
+
private _currentHorizontalAlignment;
|
|
61
71
|
/**
|
|
62
72
|
* Construct one instance of this class and initialize some properties with default values.
|
|
63
73
|
* @param style Input text style
|
|
@@ -177,7 +187,7 @@ export declare class MTextProcessor {
|
|
|
177
187
|
private processStack;
|
|
178
188
|
private processBlank;
|
|
179
189
|
private processChar;
|
|
180
|
-
processLastLine
|
|
190
|
+
private processLastLine;
|
|
181
191
|
private initLineParams;
|
|
182
192
|
private changeFont;
|
|
183
193
|
/**
|
package/dist/renderer/types.d.ts
CHANGED
|
@@ -25,38 +25,69 @@ export declare enum MTextAttachmentPoint {
|
|
|
25
25
|
BottomCenter = 8,
|
|
26
26
|
BottomRight = 9
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Represents the data structure for multiline text (MText) entities.
|
|
30
|
+
* Contains all necessary properties to define the appearance and positioning of text.
|
|
31
|
+
*/
|
|
28
32
|
export interface MTextData {
|
|
33
|
+
/** The actual text content to be displayed */
|
|
29
34
|
text: string;
|
|
35
|
+
/** The height of the text characters in drawing units */
|
|
30
36
|
height: number;
|
|
37
|
+
/** The width of the text box in drawing units. Text will wrap if it exceeds this width */
|
|
31
38
|
width: number;
|
|
39
|
+
/** The 3D insertion point coordinates where the text will be placed */
|
|
32
40
|
position: Point3d;
|
|
41
|
+
/** The rotation angle of the text in radians. Default is 0 (horizontal) */
|
|
33
42
|
rotation?: number;
|
|
43
|
+
/** The normal vector that defines the plane in which the text lies. Used for 3D orientation */
|
|
34
44
|
directionVector?: Point3d;
|
|
45
|
+
/** Specifies which point of the text boundary is aligned with the insertion point */
|
|
35
46
|
attachmentPoint?: MTextAttachmentPoint;
|
|
47
|
+
/** Determines the primary direction in which text flows */
|
|
36
48
|
drawingDirection?: MTextFlowDirection;
|
|
49
|
+
/** Factor that controls the spacing between text lines. Default is 1.0 */
|
|
37
50
|
lineSpaceFactor?: number;
|
|
51
|
+
/** The width scaling factor applied to each character. Default is 1.0 */
|
|
38
52
|
widthFactor?: number;
|
|
39
53
|
}
|
|
40
54
|
/**
|
|
41
|
-
*
|
|
55
|
+
* Represents a text style configuration that defines the visual appearance and formatting of text.
|
|
56
|
+
* This interface contains properties that control various aspects of text rendering including font,
|
|
57
|
+
* dimensions, and display characteristics.
|
|
42
58
|
*/
|
|
43
59
|
export interface TextStyle {
|
|
60
|
+
/** The unique name identifier for this text style */
|
|
44
61
|
name: string;
|
|
62
|
+
/** Flag indicating standard text style settings. Controls various text generation behaviors */
|
|
45
63
|
standardFlag: number;
|
|
64
|
+
/** The fixed height of the text in drawing units. Used when text height should remain constant */
|
|
46
65
|
fixedTextHeight: number;
|
|
66
|
+
/** The horizontal scaling factor applied to text characters. Default is 1.0 for normal width */
|
|
47
67
|
widthFactor: number;
|
|
68
|
+
/** The angle in radians for italic text. 0.0 represents vertical text, positive values slant to the right */
|
|
48
69
|
obliqueAngle: number;
|
|
70
|
+
/** Bit-coded flag controlling text generation options (e.g., mirroring, upside-down) */
|
|
49
71
|
textGenerationFlag: number;
|
|
72
|
+
/** The most recently used text height for this style */
|
|
50
73
|
lastHeight: number;
|
|
74
|
+
/** The primary font name or file to be used for text rendering */
|
|
51
75
|
font: string;
|
|
76
|
+
/** The font name or file to be used for wide characters (typically used for CJK characters) */
|
|
52
77
|
bigFont: string;
|
|
78
|
+
/** Optional extended font settings or alternative font specification */
|
|
53
79
|
extendedFont?: string;
|
|
80
|
+
/** The color index or value for the text. May reference a color table or direct color value */
|
|
54
81
|
color: number;
|
|
55
82
|
}
|
|
56
83
|
/**
|
|
57
|
-
*
|
|
84
|
+
* Defines the default color settings for special color modes in text rendering.
|
|
85
|
+
* These settings are used to resolve color values when text uses layer-dependent
|
|
86
|
+
* or block-dependent coloring.
|
|
58
87
|
*/
|
|
59
88
|
export interface ColorSettings {
|
|
89
|
+
/** The color value to use when text is set to "by layer" color mode */
|
|
60
90
|
byLayerColor: number;
|
|
91
|
+
/** The color value to use when text is set to "by block" color mode */
|
|
61
92
|
byBlockColor: number;
|
|
62
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mlightcad/mtext-renderer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "AutoCAD MText renderer based on Three.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@mlightcad/mtext-parser": "^1.1.
|
|
24
|
+
"@mlightcad/mtext-parser": "^1.1.6",
|
|
25
25
|
"@mlightcad/shx-parser": "^1.0.4",
|
|
26
26
|
"opentype.js": "^1.3.4",
|
|
27
27
|
"idb": "^8.0.3"
|