@mlightcad/mtext-renderer 0.13.1 → 0.13.2
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 +1716 -1649
- package/dist/index.umd.cjs +8 -8
- package/dist/mtext-renderer-worker.js +2191 -2124
- package/lib/font/fontManager.d.ts +15 -0
- package/lib/font/shxLayoutAdvance.d.ts +21 -0
- package/package.json +1 -1
|
@@ -205,6 +205,21 @@ export declare class FontManager {
|
|
|
205
205
|
*/
|
|
206
206
|
requestFonts(fontNames: readonly string[]): Promise<FontLoadStatus[]>;
|
|
207
207
|
private normalizeFontName;
|
|
208
|
+
/**
|
|
209
|
+
* Returns raw mesh font program bytes from IndexedDB when available.
|
|
210
|
+
*
|
|
211
|
+
* Used by PDF text-mode embedding so a face already cached for rendering
|
|
212
|
+
* does not need a second network fetch. No-op when {@link enableFontCache}
|
|
213
|
+
* is false.
|
|
214
|
+
*/
|
|
215
|
+
getCachedMeshFontProgram(fontName: string): Promise<ArrayBuffer | undefined>;
|
|
216
|
+
/**
|
|
217
|
+
* Persists a mesh font program in IndexedDB without loading it for rendering.
|
|
218
|
+
*
|
|
219
|
+
* Used after a PDF resolver network fetch so later exports hit the cache.
|
|
220
|
+
* No-op when {@link enableFontCache} is false.
|
|
221
|
+
*/
|
|
222
|
+
persistMeshFontProgram(data: ArrayBuffer, fileName: string, aliases?: readonly string[]): Promise<void>;
|
|
208
223
|
/**
|
|
209
224
|
* Parses a user-uploaded font file, registers it for rendering, and stores
|
|
210
225
|
* it in IndexedDB when {@link enableFontCache} is true.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ShxAdvanceWidthStrategy, ShxShape } from '@mlightcad/shx-parser';
|
|
2
|
+
/**
|
|
3
|
+
* Horizontal advance for SHX glyphs placed by this renderer.
|
|
4
|
+
*
|
|
5
|
+
* AutoCAD steps by the shape's final pen x. Classic fonts (romans, simplex, txt)
|
|
6
|
+
* encode that step as a pen-up vector, which `@mlightcad/shx-parser` does not mark
|
|
7
|
+
* as {@link ShxShape.hasExplicitAdvance}. The parser default then substitutes
|
|
8
|
+
* ink width plus `0.2 * cellWidth`, so a space (no ink) collapses to the padding
|
|
9
|
+
* and letters pick up a uniform gap.
|
|
10
|
+
*
|
|
11
|
+
* Keep the pen position when it lands on or past the ink. Use ink-width spacing
|
|
12
|
+
* only when the pen stops inside the strokes, so overhangs such as italic `/`
|
|
13
|
+
* still clear the next glyph.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ShxPenAdvanceStrategy extends ShxAdvanceWidthStrategy {
|
|
16
|
+
resolve(shape: ShxShape, cellWidth: number): number;
|
|
17
|
+
/** Store the resolved advance so a later default-strategy pass does not recompute it. */
|
|
18
|
+
markAlignedAdvanceExplicit(_shape: ShxShape): boolean;
|
|
19
|
+
}
|
|
20
|
+
/** Shared strategy passed to `ShxFont.getLayoutCharShape` and {@link resolveAdvanceWidth}. */
|
|
21
|
+
export declare const shxPenAdvanceStrategy: ShxPenAdvanceStrategy;
|