text-shaper 0.1.2 → 0.1.3

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.
Files changed (62) hide show
  1. package/README.md +1 -0
  2. package/dist/aat/state-machine.d.ts +18 -6
  3. package/dist/buffer/glyph-buffer.d.ts +35 -1
  4. package/dist/buffer/unicode-buffer.d.ts +2 -0
  5. package/dist/fluent/bitmap-builder.d.ts +146 -0
  6. package/dist/fluent/index.d.ts +102 -0
  7. package/dist/fluent/path-builder.d.ts +230 -0
  8. package/dist/fluent/pipe.d.ts +200 -0
  9. package/dist/fluent/types.d.ts +93 -0
  10. package/dist/font/face.d.ts +2 -0
  11. package/dist/font/font.d.ts +14 -0
  12. package/dist/font/tables/cff.d.ts +3 -1
  13. package/dist/font/tables/colr.d.ts +4 -1
  14. package/dist/font/tables/fvar.d.ts +3 -1
  15. package/dist/font/tables/glyf.d.ts +13 -0
  16. package/dist/font/tables/gpos.d.ts +9 -1
  17. package/dist/font/tables/gsub.d.ts +11 -0
  18. package/dist/font/tables/gvar.d.ts +10 -1
  19. package/dist/font/tables/head.d.ts +5 -0
  20. package/dist/font/tables/hhea.d.ts +5 -0
  21. package/dist/font/tables/loca.d.ts +3 -0
  22. package/dist/font/tables/maxp.d.ts +5 -0
  23. package/dist/font/tables/name.d.ts +5 -0
  24. package/dist/font/tables/os2.d.ts +5 -0
  25. package/dist/font/tables/post.d.ts +5 -0
  26. package/dist/index.d.ts +5 -3
  27. package/dist/index.js +12 -10
  28. package/dist/index.js.map +104 -98
  29. package/dist/layout/justify.d.ts +15 -2
  30. package/dist/layout/structures/class-def.d.ts +61 -8
  31. package/dist/layout/structures/coverage.d.ts +57 -10
  32. package/dist/layout/structures/device.d.ts +26 -5
  33. package/dist/layout/structures/layout-common.d.ts +18 -3
  34. package/dist/layout/structures/set-digest.d.ts +59 -0
  35. package/dist/raster/asymmetric-stroke.d.ts +9 -5
  36. package/dist/raster/bitmap-utils.d.ts +67 -0
  37. package/dist/raster/blur.d.ts +11 -0
  38. package/dist/raster/cascade-blur.d.ts +9 -10
  39. package/dist/raster/cell.d.ts +24 -0
  40. package/dist/raster/fixed-point.d.ts +1 -1
  41. package/dist/raster/gradient.d.ts +15 -0
  42. package/dist/raster/gray-raster.d.ts +7 -1
  43. package/dist/raster/lcd-filter.d.ts +15 -0
  44. package/dist/raster/msdf.d.ts +15 -5
  45. package/dist/raster/outline-decompose.d.ts +16 -17
  46. package/dist/raster/rasterize.d.ts +19 -2
  47. package/dist/raster/sdf.d.ts +3 -0
  48. package/dist/raster/stroker.d.ts +3 -0
  49. package/dist/raster/types.d.ts +9 -0
  50. package/dist/render/path.d.ts +56 -1
  51. package/dist/shaper/complex/arabic.d.ts +1 -0
  52. package/dist/shaper/shape-plan.d.ts +11 -8
  53. package/dist/shaper/shaper.d.ts +61 -3
  54. package/dist/unicode/bidi/brackets.d.ts +15 -0
  55. package/dist/unicode/bidi/char-types.d.ts +4 -0
  56. package/dist/unicode/bidi/embedding-levels.d.ts +3 -0
  57. package/dist/unicode/bidi/mirroring.d.ts +10 -0
  58. package/dist/unicode/bidi/reordering.d.ts +15 -0
  59. package/dist/unicode/normalize.d.ts +23 -0
  60. package/dist/unicode/script.d.ts +17 -0
  61. package/dist/unicode/segmentation.d.ts +18 -0
  62. package/package.json +11 -2
@@ -50,10 +50,14 @@ export declare enum WordBreakProperty {
50
50
  }
51
51
  /**
52
52
  * Get grapheme break property for codepoint
53
+ * @param cp Unicode codepoint to check
54
+ * @returns Grapheme break property for the codepoint
53
55
  */
54
56
  export declare function getGraphemeBreakProperty(cp: number): GraphemeBreakProperty;
55
57
  /**
56
58
  * Get word break property for codepoint
59
+ * @param cp Unicode codepoint to check
60
+ * @returns Word break property for the codepoint
57
61
  */
58
62
  export declare function getWordBreakProperty(cp: number): WordBreakProperty;
59
63
  /**
@@ -67,6 +71,8 @@ export interface GraphemeBoundaries {
67
71
  }
68
72
  /**
69
73
  * Find grapheme cluster boundaries in codepoints
74
+ * @param codepoints Array of Unicode codepoints
75
+ * @returns Object containing boundary positions and grapheme break properties
70
76
  */
71
77
  export declare function findGraphemeBoundaries(codepoints: number[]): GraphemeBoundaries;
72
78
  /**
@@ -80,25 +86,37 @@ export interface WordBoundaries {
80
86
  }
81
87
  /**
82
88
  * Find word boundaries in codepoints
89
+ * @param codepoints Array of Unicode codepoints
90
+ * @returns Object containing boundary positions and word break properties
83
91
  */
84
92
  export declare function findWordBoundaries(codepoints: number[]): WordBoundaries;
85
93
  /**
86
94
  * Split text into grapheme clusters
95
+ * @param text Text string to split
96
+ * @returns Array of grapheme cluster strings
87
97
  */
88
98
  export declare function splitGraphemes(text: string): string[];
89
99
  /**
90
100
  * Split text into words
101
+ * @param text Text string to split
102
+ * @returns Array of word strings (whitespace-only segments are filtered out)
91
103
  */
92
104
  export declare function splitWords(text: string): string[];
93
105
  /**
94
106
  * Count grapheme clusters in text
107
+ * @param text Text string to analyze
108
+ * @returns Number of grapheme clusters in the text
95
109
  */
96
110
  export declare function countGraphemes(text: string): number;
97
111
  /**
98
112
  * Analyze grapheme boundaries for glyph infos
113
+ * @param infos Array of glyph information objects
114
+ * @returns Object containing boundary positions and grapheme break properties
99
115
  */
100
116
  export declare function analyzeGraphemesForGlyphs(infos: GlyphInfo[]): GraphemeBoundaries;
101
117
  /**
102
118
  * Analyze word boundaries for glyph infos
119
+ * @param infos Array of glyph information objects
120
+ * @returns Object containing boundary positions and word break properties
103
121
  */
104
122
  export declare function analyzeWordsForGlyphs(infos: GlyphInfo[]): WordBoundaries;
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "text-shaper",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "devDependencies": {
7
7
  "@biomejs/biome": "2.3.8",
8
8
  "@types/bun": "latest",
9
+ "@types/opentype.js": "^1.3.8",
10
+ "freetype2": "^2.1.0",
11
+ "harfbuzzjs": "^0.4.13",
12
+ "opentype.js": "^1.3.4",
9
13
  "vitepress": "^2.0.0-alpha.15",
10
14
  "vitepress-plugin-llms": "^1.9.3"
11
15
  },
@@ -43,6 +47,8 @@
43
47
  ],
44
48
  "license": "MIT",
45
49
  "scripts": {
50
+ "postinstall": "node scripts/patch-pkg-prebuilds.js",
51
+ "bench": "bun test ./bench/ --timeout 120000",
46
52
  "build": "bun build ./src/index.ts --outdir ./dist --target browser --minify --sourcemap=linked",
47
53
  "build:prod": "bun build ./src/index.ts --outdir ./dist --target browser --production --sourcemap=external",
48
54
  "build:analyze": "bun build ./src/index.ts --outdir ./dist --target browser --minify --metafile=./dist/meta.json",
@@ -56,5 +62,8 @@
56
62
  "docs:preview": "vitepress preview docs"
57
63
  },
58
64
  "type": "module",
59
- "types": "./dist/index.d.ts"
65
+ "types": "./dist/index.d.ts",
66
+ "trustedDependencies": [
67
+ "freetype2"
68
+ ]
60
69
  }