text-shaper 0.1.5 → 0.1.7

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.
@@ -67,9 +67,16 @@ export declare function contourToPath(contour: Contour): PathCommand[];
67
67
  * Get cached glyph path, computing and caching if not already cached
68
68
  */
69
69
  export declare function getGlyphPath(font: Font, glyphId: GlyphId): GlyphPath | null;
70
+ /**
71
+ * SVG coordinate scaling factor for sub-pixel precision.
72
+ * Path data is output at 10x scale with integer coordinates,
73
+ * viewBox is scaled to match, giving 0.1px precision with integer performance.
74
+ */
75
+ export declare const SVG_SCALE = 10;
70
76
  /**
71
77
  * Convert path commands to SVG path data string
72
- * Uses Math.round for ~40% faster string generation
78
+ * Outputs at SVG_SCALE (10x) with integer coordinates for performance
79
+ * Caches results for default options (flipY=true, scale=1)
73
80
  */
74
81
  export declare function pathToSVG(path: GlyphPath, options?: {
75
82
  flipY?: boolean;
@@ -234,6 +241,6 @@ export declare function matrixToSVGTransform(matrix: Matrix2D): string;
234
241
  /**
235
242
  * Direct SVG serialization with transform applied in single pass
236
243
  * Avoids creating intermediate PathCommand arrays
237
- * Uses Math.round for ~40% faster string generation
244
+ * Outputs at SVG_SCALE (10x) with integer coordinates for performance
238
245
  */
239
246
  export declare function pathToSVGDirect(path: GlyphPath, scale: number, offsetX: number, offsetY: number): string;
package/package.json CHANGED
@@ -1,6 +1,10 @@
1
1
  {
2
2
  "name": "text-shaper",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/wiedymi/text-shaper.git"
7
+ },
4
8
  "main": "./dist/index.js",
5
9
  "module": "./dist/index.js",
6
10
  "devDependencies": {
@@ -8,6 +12,7 @@
8
12
  "@types/bun": "latest",
9
13
  "@types/opentype.js": "^1.3.8",
10
14
  "freetype2": "^2.1.0",
15
+ "graphemer": "^1.4.0",
11
16
  "harfbuzzjs": "^0.4.13",
12
17
  "opentype.js": "^1.3.4",
13
18
  "vitepress": "^2.0.0-alpha.15",
@@ -49,6 +54,7 @@
49
54
  "scripts": {
50
55
  "postinstall": "node scripts/patch-pkg-prebuilds.js",
51
56
  "bench": "bun test ./bench/ --timeout 120000",
57
+ "bench:update": "bun scripts/update-benchmarks.ts",
52
58
  "build": "bun build ./src/index.ts --outdir ./dist --target browser --minify --sourcemap=linked",
53
59
  "build:prod": "bun build ./src/index.ts --outdir ./dist --target browser --production",
54
60
  "build:analyze": "bun build ./src/index.ts --outdir ./dist --target browser --minify --metafile=./dist/meta.json",