@mlightcad/mtext-renderer 0.13.7 → 0.13.8
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 +450 -374
- package/dist/index.umd.cjs +8 -8
- package/dist/mtext-renderer-worker.js +854 -778
- package/lib/font/fontManager.d.ts +24 -0
- package/lib/renderer/mtextProcessor.d.ts +18 -11
- package/package.json +1 -1
|
@@ -319,6 +319,30 @@ export declare class FontManager {
|
|
|
319
319
|
* Used after primary and optional bigFont lookups per AutoCAD text-style semantics.
|
|
320
320
|
*/
|
|
321
321
|
getCharShapeFromDefaults(char: string, size: number): BaseTextShape | undefined;
|
|
322
|
+
/**
|
|
323
|
+
* Looks up `char` in every loaded SHX BIGFONT face (and BIGFONT names listed
|
|
324
|
+
* in {@link defaultFonts}), using each face's own scale factor.
|
|
325
|
+
*
|
|
326
|
+
* AutoCAD text styles bind one Big Font file, but when that face's code page
|
|
327
|
+
* cannot represent a glyph (e.g. simplified Chinese on Japanese `bigfont.shx`)
|
|
328
|
+
* viewers still find the character in another available Big Font such as
|
|
329
|
+
* `gbcbig.shx`. A hand-maintained simplified→Japanese character map cannot
|
|
330
|
+
* cover the repertoire; searching loaded BIGFONT faces does.
|
|
331
|
+
*
|
|
332
|
+
* @param char - Character to resolve.
|
|
333
|
+
* @param layoutSize - MTEXT layout height (cap-height), before per-font scale.
|
|
334
|
+
* @param excludeFontName - Optional style Big Font already tried.
|
|
335
|
+
* @returns Shape plus the font that supplied it, or `undefined`.
|
|
336
|
+
*/
|
|
337
|
+
getCharShapeFromLoadedBigfonts(char: string, layoutSize: number, excludeFontName?: string): {
|
|
338
|
+
shape: BaseTextShape;
|
|
339
|
+
fontName: string;
|
|
340
|
+
} | undefined;
|
|
341
|
+
/**
|
|
342
|
+
* Horizontal BIGFONT cell width at `layoutSize` for the named face, or
|
|
343
|
+
* `undefined` when the face is missing / not a BIGFONT.
|
|
344
|
+
*/
|
|
345
|
+
getBigfontCellWidth(fontName: string, layoutSize: number): number | undefined;
|
|
322
346
|
/**
|
|
323
347
|
* Gets the text shape from configured GDT / symbol fonts (e.g. `amgdt.shx`)
|
|
324
348
|
* by font-internal character code.
|
|
@@ -485,7 +485,8 @@ export declare class MTextProcessor {
|
|
|
485
485
|
* Lays out and renders one parser word token, breaking to a new visual line when needed.
|
|
486
486
|
*
|
|
487
487
|
* - CJK / non-Latin: no whole-word wrap — {@link processChar} breaks between
|
|
488
|
-
* characters when the
|
|
488
|
+
* characters when the pen has already reached the defined width (a glyph
|
|
489
|
+
* that starts inside may slightly overshoot).
|
|
489
490
|
* - Latin/ASCII: wrap only at word boundaries (spaces). AutoCAD/GstarCAD do
|
|
490
491
|
* not hyphenate: a token wider than the column stays on one visual line and
|
|
491
492
|
* overflows the box (e.g. part numbers like `1157*25*1.5`). A short run that
|
|
@@ -560,10 +561,14 @@ export declare class MTextProcessor {
|
|
|
560
561
|
* Renders one character glyph, including decorations and line-break handling.
|
|
561
562
|
*
|
|
562
563
|
* Missing glyphs are treated as spaces. Soft wrap is decided before placement:
|
|
563
|
-
*
|
|
564
|
-
*
|
|
565
|
-
*
|
|
566
|
-
*
|
|
564
|
+
* break when the pen has already reached the defined width so the next glyph
|
|
565
|
+
* cannot *start* inside the column (CJK may break between any two characters).
|
|
566
|
+
* A glyph that starts inside the column is kept even if its advance slightly
|
|
567
|
+
* overshoots — AutoCAD title-block cells are often sized to N capital-A CJK
|
|
568
|
+
* advances within a fraction of a percent, and wrapping on end-past-width
|
|
569
|
+
* falsely pushes the last ideograph onto the next line. Latin/ASCII word
|
|
570
|
+
* tokens suppress this so they overflow instead of hyphenating. The first
|
|
571
|
+
* glyph on an empty line is always placed even when wider than the box.
|
|
567
572
|
*
|
|
568
573
|
* @param char Character to render.
|
|
569
574
|
* @param geometries Mesh geometry accumulator.
|
|
@@ -618,15 +623,17 @@ export declare class MTextProcessor {
|
|
|
618
623
|
*/
|
|
619
624
|
private resolvePercentSymbolShape;
|
|
620
625
|
/**
|
|
621
|
-
*
|
|
626
|
+
* Drawing-space glyph size for a specific face.
|
|
622
627
|
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
*
|
|
626
|
-
*
|
|
627
|
-
* @returns Renderable text shape and the font that supplied it.
|
|
628
|
+
* {@link currentFontSize} is inflated by the *primary* style font's scale
|
|
629
|
+
* factor (SHX cap-height or TrueType capital-A). BIGFONT / fallback faces
|
|
630
|
+
* have their own scale — fetching them at the primary size stretches CJK
|
|
631
|
+
* cells and shifts mixed runs.
|
|
628
632
|
*/
|
|
633
|
+
private shapeSizeForFont;
|
|
629
634
|
private resolveCharShape;
|
|
635
|
+
/** CJK Unified Ideographs and common compatibility blocks used in CAD text. */
|
|
636
|
+
private isCjkIdeograph;
|
|
630
637
|
private canProbeFontOwnership;
|
|
631
638
|
private fontHasChar;
|
|
632
639
|
/**
|