vexflow-native 0.2.0 → 1.1.0

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 (259) hide show
  1. package/README.md +267 -37
  2. package/lib/module/base/FontManager.js +139 -0
  3. package/lib/module/base/FontManager.js.map +1 -0
  4. package/lib/module/base/TextMeasureContext.js +46 -0
  5. package/lib/module/base/TextMeasureContext.js.map +1 -0
  6. package/lib/module/base/VexflowCanvas.js +48 -0
  7. package/lib/module/base/VexflowCanvas.js.map +1 -0
  8. package/lib/module/base/VexflowColorScheme.js +16 -0
  9. package/lib/module/base/VexflowColorScheme.js.map +1 -0
  10. package/lib/module/base/VexflowRecordingContext.js +487 -0
  11. package/lib/module/base/VexflowRecordingContext.js.map +1 -0
  12. package/lib/module/base/VexflowRecordingReplay.js +214 -0
  13. package/lib/module/base/VexflowRecordingReplay.js.map +1 -0
  14. package/lib/module/base/VexflowRecordingTypes.js +4 -0
  15. package/lib/module/base/VexflowRecordingTypes.js.map +1 -0
  16. package/lib/module/base/index.js +9 -0
  17. package/lib/module/base/index.js.map +1 -0
  18. package/lib/module/base/setupVexflowReactNative.js +96 -0
  19. package/lib/module/base/setupVexflowReactNative.js.map +1 -0
  20. package/lib/module/base/types.js +4 -0
  21. package/lib/module/base/types.js.map +1 -0
  22. package/lib/module/base/utils.js +18 -0
  23. package/lib/module/base/utils.js.map +1 -0
  24. package/lib/module/musicxml/MusicXmlParser/InternalTypes.js +4 -0
  25. package/lib/module/musicxml/MusicXmlParser/InternalTypes.js.map +1 -0
  26. package/lib/module/musicxml/MusicXmlParser/MeasureParser.js +269 -0
  27. package/lib/module/musicxml/MusicXmlParser/MeasureParser.js.map +1 -0
  28. package/lib/module/musicxml/MusicXmlParser/MusicXmlDirections.js +62 -0
  29. package/lib/module/musicxml/MusicXmlParser/MusicXmlDirections.js.map +1 -0
  30. package/lib/module/musicxml/MusicXmlParser/MusicXmlTiming.js +124 -0
  31. package/lib/module/musicxml/MusicXmlParser/MusicXmlTiming.js.map +1 -0
  32. package/lib/module/musicxml/MusicXmlParser/PartParser.js +41 -0
  33. package/lib/module/musicxml/MusicXmlParser/PartParser.js.map +1 -0
  34. package/lib/module/musicxml/MusicXmlParser/Spanners.js +149 -0
  35. package/lib/module/musicxml/MusicXmlParser/Spanners.js.map +1 -0
  36. package/lib/module/musicxml/MusicXmlParser/XmlOrder.js +106 -0
  37. package/lib/module/musicxml/MusicXmlParser/XmlOrder.js.map +1 -0
  38. package/lib/module/musicxml/MusicXmlParser/index.js +110 -0
  39. package/lib/module/musicxml/MusicXmlParser/index.js.map +1 -0
  40. package/lib/module/musicxml/MusicXmlParser/mappers.js +312 -0
  41. package/lib/module/musicxml/MusicXmlParser/mappers.js.map +1 -0
  42. package/lib/module/musicxml/MusicXmlParser/types.js +10 -0
  43. package/lib/module/musicxml/MusicXmlParser/types.js.map +1 -0
  44. package/lib/module/musicxml/index.js +4 -0
  45. package/lib/module/musicxml/index.js.map +1 -0
  46. package/lib/module/musicxml/testfiles/lg-8102429.xml +79620 -0
  47. package/lib/module/renderer/Layout/DocumentLayout.js +156 -0
  48. package/lib/module/renderer/Layout/DocumentLayout.js.map +1 -0
  49. package/lib/module/renderer/Layout/LayoutMetrics.js +13 -0
  50. package/lib/module/renderer/Layout/LayoutMetrics.js.map +1 -0
  51. package/lib/module/renderer/Layout/VerticalSpacing.js +69 -0
  52. package/lib/module/renderer/Layout/VerticalSpacing.js.map +1 -0
  53. package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js +277 -0
  54. package/lib/module/renderer/ScoreRenderer/ScoreRenderer.js.map +1 -0
  55. package/lib/module/renderer/ScoreRenderer/ScoreScrollbar.js +108 -0
  56. package/lib/module/renderer/ScoreRenderer/ScoreScrollbar.js.map +1 -0
  57. package/lib/module/renderer/ScoreRenderer/index.js +7 -0
  58. package/lib/module/renderer/ScoreRenderer/index.js.map +1 -0
  59. package/lib/module/renderer/ScoreRenderer/types.js +4 -0
  60. package/lib/module/renderer/ScoreRenderer/types.js.map +1 -0
  61. package/lib/module/renderer/ScoreRenderer/useScoreScroll.js +77 -0
  62. package/lib/module/renderer/ScoreRenderer/useScoreScroll.js.map +1 -0
  63. package/lib/module/renderer/colorScheme.js +17 -0
  64. package/lib/module/renderer/colorScheme.js.map +1 -0
  65. package/lib/module/renderer/constants.js +18 -0
  66. package/lib/module/renderer/constants.js.map +1 -0
  67. package/lib/module/renderer/index.js +6 -0
  68. package/lib/module/renderer/index.js.map +1 -0
  69. package/lib/module/renderer/layout.js +153 -0
  70. package/lib/module/renderer/layout.js.map +1 -0
  71. package/lib/module/renderer/measure.js +202 -0
  72. package/lib/module/renderer/measure.js.map +1 -0
  73. package/lib/module/renderer/render.js +184 -0
  74. package/lib/module/renderer/render.js.map +1 -0
  75. package/lib/module/renderer/scoreParsing.js +230 -0
  76. package/lib/module/renderer/scoreParsing.js.map +1 -0
  77. package/lib/module/renderer/types.js +4 -0
  78. package/lib/module/renderer/types.js.map +1 -0
  79. package/lib/module/renderer/useScoreRecording.js +112 -0
  80. package/lib/module/renderer/useScoreRecording.js.map +1 -0
  81. package/lib/module/renderer/viewport.js +26 -0
  82. package/lib/module/renderer/viewport.js.map +1 -0
  83. package/lib/module/shared/Logger.js +67 -0
  84. package/lib/module/shared/Logger.js.map +1 -0
  85. package/lib/module/state/index.js +4 -0
  86. package/lib/module/state/index.js.map +1 -0
  87. package/lib/module/state/types.js +2 -0
  88. package/lib/module/state/types.js.map +1 -0
  89. package/lib/module/types.js +7 -0
  90. package/lib/module/types.js.map +1 -1
  91. package/lib/module/utils.js +42 -77
  92. package/lib/module/utils.js.map +1 -1
  93. package/lib/typescript/src/base/FontManager.d.ts +23 -0
  94. package/lib/typescript/src/base/FontManager.d.ts.map +1 -0
  95. package/lib/typescript/src/base/TextMeasureContext.d.ts +22 -0
  96. package/lib/typescript/src/base/TextMeasureContext.d.ts.map +1 -0
  97. package/lib/typescript/src/base/VexflowCanvas.d.ts +5 -0
  98. package/lib/typescript/src/base/VexflowCanvas.d.ts.map +1 -0
  99. package/lib/typescript/src/base/VexflowColorScheme.d.ts +7 -0
  100. package/lib/typescript/src/base/VexflowColorScheme.d.ts.map +1 -0
  101. package/lib/typescript/src/base/VexflowRecordingContext.d.ts +103 -0
  102. package/lib/typescript/src/base/VexflowRecordingContext.d.ts.map +1 -0
  103. package/lib/typescript/src/base/VexflowRecordingReplay.d.ts +12 -0
  104. package/lib/typescript/src/base/VexflowRecordingReplay.d.ts.map +1 -0
  105. package/lib/typescript/src/base/VexflowRecordingTypes.d.ts +146 -0
  106. package/lib/typescript/src/base/VexflowRecordingTypes.d.ts.map +1 -0
  107. package/lib/typescript/src/base/index.d.ts +7 -0
  108. package/lib/typescript/src/base/index.d.ts.map +1 -0
  109. package/lib/typescript/src/base/setupVexflowReactNative.d.ts +11 -0
  110. package/lib/typescript/src/base/setupVexflowReactNative.d.ts.map +1 -0
  111. package/lib/typescript/src/base/types.d.ts +13 -0
  112. package/lib/typescript/src/base/types.d.ts.map +1 -0
  113. package/lib/typescript/src/base/utils.d.ts +2 -0
  114. package/lib/typescript/src/base/utils.d.ts.map +1 -0
  115. package/lib/typescript/src/musicxml/MusicXmlParser/InternalTypes.d.ts +30 -0
  116. package/lib/typescript/src/musicxml/MusicXmlParser/InternalTypes.d.ts.map +1 -0
  117. package/lib/typescript/src/musicxml/MusicXmlParser/MeasureParser.d.ts +4 -0
  118. package/lib/typescript/src/musicxml/MusicXmlParser/MeasureParser.d.ts.map +1 -0
  119. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlDirections.d.ts +5 -0
  120. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlDirections.d.ts.map +1 -0
  121. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlTiming.d.ts +6 -0
  122. package/lib/typescript/src/musicxml/MusicXmlParser/MusicXmlTiming.d.ts.map +1 -0
  123. package/lib/typescript/src/musicxml/MusicXmlParser/PartParser.d.ts +8 -0
  124. package/lib/typescript/src/musicxml/MusicXmlParser/PartParser.d.ts.map +1 -0
  125. package/lib/typescript/src/musicxml/MusicXmlParser/Spanners.d.ts +4 -0
  126. package/lib/typescript/src/musicxml/MusicXmlParser/Spanners.d.ts.map +1 -0
  127. package/lib/typescript/src/musicxml/MusicXmlParser/XmlOrder.d.ts +20 -0
  128. package/lib/typescript/src/musicxml/MusicXmlParser/XmlOrder.d.ts.map +1 -0
  129. package/lib/typescript/src/musicxml/MusicXmlParser/index.d.ts +5 -0
  130. package/lib/typescript/src/musicxml/MusicXmlParser/index.d.ts.map +1 -0
  131. package/lib/typescript/src/musicxml/MusicXmlParser/mappers.d.ts +15 -0
  132. package/lib/typescript/src/musicxml/MusicXmlParser/mappers.d.ts.map +1 -0
  133. package/lib/typescript/src/musicxml/MusicXmlParser/types.d.ts +13 -0
  134. package/lib/typescript/src/musicxml/MusicXmlParser/types.d.ts.map +1 -0
  135. package/lib/typescript/src/musicxml/index.d.ts +2 -0
  136. package/lib/typescript/src/musicxml/index.d.ts.map +1 -0
  137. package/lib/typescript/src/renderer/Layout/DocumentLayout.d.ts +10 -0
  138. package/lib/typescript/src/renderer/Layout/DocumentLayout.d.ts.map +1 -0
  139. package/lib/typescript/src/renderer/Layout/LayoutMetrics.d.ts +6 -0
  140. package/lib/typescript/src/renderer/Layout/LayoutMetrics.d.ts.map +1 -0
  141. package/lib/typescript/src/renderer/Layout/VerticalSpacing.d.ts +9 -0
  142. package/lib/typescript/src/renderer/Layout/VerticalSpacing.d.ts.map +1 -0
  143. package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts +15 -0
  144. package/lib/typescript/src/renderer/ScoreRenderer/ScoreRenderer.d.ts.map +1 -0
  145. package/lib/typescript/src/renderer/ScoreRenderer/ScoreScrollbar.d.ts +24 -0
  146. package/lib/typescript/src/renderer/ScoreRenderer/ScoreScrollbar.d.ts.map +1 -0
  147. package/lib/typescript/src/renderer/ScoreRenderer/index.d.ts +5 -0
  148. package/lib/typescript/src/renderer/ScoreRenderer/index.d.ts.map +1 -0
  149. package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts +12 -0
  150. package/lib/typescript/src/renderer/ScoreRenderer/types.d.ts.map +1 -0
  151. package/lib/typescript/src/renderer/ScoreRenderer/useScoreScroll.d.ts +13 -0
  152. package/lib/typescript/src/renderer/ScoreRenderer/useScoreScroll.d.ts.map +1 -0
  153. package/lib/typescript/src/renderer/colorScheme.d.ts +9 -0
  154. package/lib/typescript/src/renderer/colorScheme.d.ts.map +1 -0
  155. package/lib/typescript/src/renderer/constants.d.ts +5 -0
  156. package/lib/typescript/src/renderer/constants.d.ts.map +1 -0
  157. package/lib/typescript/src/renderer/index.d.ts +4 -0
  158. package/lib/typescript/src/renderer/index.d.ts.map +1 -0
  159. package/lib/typescript/src/renderer/layout.d.ts +56 -0
  160. package/lib/typescript/src/renderer/layout.d.ts.map +1 -0
  161. package/lib/typescript/src/renderer/measure.d.ts +23 -0
  162. package/lib/typescript/src/renderer/measure.d.ts.map +1 -0
  163. package/lib/typescript/src/renderer/render.d.ts +9 -0
  164. package/lib/typescript/src/renderer/render.d.ts.map +1 -0
  165. package/lib/typescript/src/renderer/scoreParsing.d.ts +76 -0
  166. package/lib/typescript/src/renderer/scoreParsing.d.ts.map +1 -0
  167. package/lib/typescript/src/renderer/types.d.ts +56 -0
  168. package/lib/typescript/src/renderer/types.d.ts.map +1 -0
  169. package/lib/typescript/src/renderer/useScoreRecording.d.ts +21 -0
  170. package/lib/typescript/src/renderer/useScoreRecording.d.ts.map +1 -0
  171. package/lib/typescript/src/renderer/viewport.d.ts +3 -0
  172. package/lib/typescript/src/renderer/viewport.d.ts.map +1 -0
  173. package/lib/typescript/src/shared/Logger.d.ts +18 -0
  174. package/lib/typescript/src/shared/Logger.d.ts.map +1 -0
  175. package/lib/typescript/src/state/index.d.ts +2 -0
  176. package/lib/typescript/src/state/index.d.ts.map +1 -0
  177. package/lib/typescript/src/state/types.d.ts +190 -0
  178. package/lib/typescript/src/state/types.d.ts.map +1 -0
  179. package/lib/typescript/src/types.d.ts +0 -6
  180. package/lib/typescript/src/types.d.ts.map +1 -1
  181. package/lib/typescript/src/utils.d.ts +0 -6
  182. package/lib/typescript/src/utils.d.ts.map +1 -1
  183. package/package.json +41 -14
  184. package/src/base/FontManager.ts +206 -0
  185. package/src/base/TextMeasureContext.ts +59 -0
  186. package/src/base/VexflowCanvas.tsx +60 -0
  187. package/src/base/VexflowColorScheme.ts +32 -0
  188. package/src/base/VexflowRecordingContext.ts +545 -0
  189. package/src/base/VexflowRecordingReplay.ts +327 -0
  190. package/src/base/VexflowRecordingTypes.ts +169 -0
  191. package/src/base/index.ts +7 -0
  192. package/src/base/setupVexflowReactNative.ts +124 -0
  193. package/src/base/types.ts +17 -0
  194. package/src/base/utils.ts +21 -0
  195. package/src/musicxml/MusicXmlParser/InternalTypes.ts +41 -0
  196. package/src/musicxml/MusicXmlParser/MeasureParser.ts +469 -0
  197. package/src/musicxml/MusicXmlParser/MusicXmlDirections.ts +84 -0
  198. package/src/musicxml/MusicXmlParser/MusicXmlTiming.ts +153 -0
  199. package/src/musicxml/MusicXmlParser/PartParser.ts +69 -0
  200. package/src/musicxml/MusicXmlParser/Spanners.ts +215 -0
  201. package/src/musicxml/MusicXmlParser/XmlOrder.ts +170 -0
  202. package/src/musicxml/MusicXmlParser/index.ts +144 -0
  203. package/src/musicxml/MusicXmlParser/mappers.ts +307 -0
  204. package/src/musicxml/MusicXmlParser/types.ts +24 -0
  205. package/src/musicxml/index.ts +5 -0
  206. package/src/musicxml/testfiles/lg-8102429.xml +79620 -0
  207. package/src/renderer/Layout/DocumentLayout.ts +240 -0
  208. package/src/renderer/Layout/LayoutMetrics.ts +21 -0
  209. package/src/renderer/Layout/VerticalSpacing.ts +122 -0
  210. package/src/renderer/ScoreRenderer/ScoreRenderer.tsx +384 -0
  211. package/src/renderer/ScoreRenderer/ScoreScrollbar.tsx +231 -0
  212. package/src/renderer/ScoreRenderer/index.ts +13 -0
  213. package/src/renderer/ScoreRenderer/types.ts +14 -0
  214. package/src/renderer/ScoreRenderer/useScoreScroll.ts +146 -0
  215. package/src/renderer/colorScheme.ts +28 -0
  216. package/src/renderer/constants.ts +19 -0
  217. package/src/renderer/index.ts +3 -0
  218. package/src/renderer/layout.ts +309 -0
  219. package/src/renderer/measure.tsx +304 -0
  220. package/src/renderer/render.tsx +308 -0
  221. package/src/renderer/scoreParsing.tsx +352 -0
  222. package/src/renderer/types.ts +65 -0
  223. package/src/renderer/useScoreRecording.ts +177 -0
  224. package/src/renderer/viewport.ts +45 -0
  225. package/src/shared/Logger.ts +85 -0
  226. package/src/state/index.ts +1 -0
  227. package/src/state/types.ts +295 -0
  228. package/src/types.ts +6 -6
  229. package/src/utils.tsx +32 -98
  230. package/lib/module/SkiaVexflowContext.js +0 -285
  231. package/lib/module/SkiaVexflowContext.js.map +0 -1
  232. package/lib/module/VexflowCanvas.js +0 -103
  233. package/lib/module/VexflowCanvas.js.map +0 -1
  234. package/lib/module/colorUtils.js +0 -34
  235. package/lib/module/colorUtils.js.map +0 -1
  236. package/lib/module/colorUtils.test.js +0 -37
  237. package/lib/module/colorUtils.test.js.map +0 -1
  238. package/lib/module/constants.js +0 -30
  239. package/lib/module/constants.js.map +0 -1
  240. package/lib/module/index.js +0 -8
  241. package/lib/module/index.js.map +0 -1
  242. package/lib/typescript/src/SkiaVexflowContext.d.ts +0 -101
  243. package/lib/typescript/src/SkiaVexflowContext.d.ts.map +0 -1
  244. package/lib/typescript/src/VexflowCanvas.d.ts +0 -17
  245. package/lib/typescript/src/VexflowCanvas.d.ts.map +0 -1
  246. package/lib/typescript/src/colorUtils.d.ts +0 -2
  247. package/lib/typescript/src/colorUtils.d.ts.map +0 -1
  248. package/lib/typescript/src/colorUtils.test.d.ts +0 -2
  249. package/lib/typescript/src/colorUtils.test.d.ts.map +0 -1
  250. package/lib/typescript/src/constants.d.ts +0 -21
  251. package/lib/typescript/src/constants.d.ts.map +0 -1
  252. package/lib/typescript/src/index.d.ts +0 -7
  253. package/lib/typescript/src/index.d.ts.map +0 -1
  254. package/src/SkiaVexflowContext.ts +0 -462
  255. package/src/VexflowCanvas.tsx +0 -145
  256. package/src/colorUtils.test.ts +0 -52
  257. package/src/colorUtils.ts +0 -55
  258. package/src/constants.tsx +0 -34
  259. package/src/index.ts +0 -8
@@ -0,0 +1,56 @@
1
+ import type { SkTypefaceFontProvider } from '@shopify/react-native-skia';
2
+ import type { SharedValue } from 'react-native-reanimated';
3
+ import type { VexflowStyleOverride } from '../base';
4
+ import type { Score } from '../state';
5
+ import type { ScoreColorScheme } from './colorScheme';
6
+ export type RendererType = 'infiniteScore' | 'document' | 'documentEven';
7
+ export type ScoreItemStyleOverride = VexflowStyleOverride;
8
+ export type ScoreItemStyleOverrides = Record<string, ScoreItemStyleOverride>;
9
+ export interface ScoreRendererProps {
10
+ score: Score;
11
+ defaultFont: string;
12
+ fontManager: SkTypefaceFontProvider;
13
+ colorScheme?: ScoreColorScheme;
14
+ itemStyleOverrides?: SharedValue<ScoreItemStyleOverrides>;
15
+ rendererType?: RendererType;
16
+ options?: Partial<ScoreOptions>;
17
+ scrollEnabled?: boolean;
18
+ showScrollbars?: boolean;
19
+ }
20
+ export interface Viewport {
21
+ width: number;
22
+ height: number;
23
+ }
24
+ export interface ScoreInsets {
25
+ top: number;
26
+ right: number;
27
+ bottom: number;
28
+ left: number;
29
+ }
30
+ export interface ScoreSpacing {
31
+ staffGap: number;
32
+ minIntrinsicSizeMultiplier: number;
33
+ }
34
+ export interface RenderOptions {
35
+ pixelRatio: number;
36
+ scale: number;
37
+ debug: boolean;
38
+ }
39
+ export interface ScoreOptions {
40
+ spacing: ScoreSpacing;
41
+ insets: ScoreInsets;
42
+ render: RenderOptions;
43
+ }
44
+ export interface RendererPoint {
45
+ x: number;
46
+ y: number;
47
+ }
48
+ export interface RendererSize {
49
+ width: number;
50
+ height: number;
51
+ }
52
+ export interface RendererRect extends RendererPoint, RendererSize {
53
+ }
54
+ export interface VisibleViewport extends RendererRect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AED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAa,SAAQ,aAAa,EAAE,YAAY;CAAG;AAEpE,MAAM,WAAW,eAAgB,SAAQ,YAAY;CAAG"}
@@ -0,0 +1,21 @@
1
+ import type { SkTypefaceFontProvider } from '@shopify/react-native-skia';
2
+ import type { VexflowRecordingCommand } from '../base';
3
+ import type { Score } from '../state';
4
+ import { type ScoreLayoutPlan } from './layout';
5
+ import type { ResolvedScoreColorScheme } from './colorScheme';
6
+ import type { RendererRect, RendererType, ScoreOptions } from './types';
7
+ export interface ScoreRecording {
8
+ commands: readonly VexflowRecordingCommand[];
9
+ layoutPlan: ScoreLayoutPlan;
10
+ }
11
+ export declare function useScoreRecording({ defaultFont, enabled, fontManager, colorScheme, options, rendererType, score, viewport, }: {
12
+ defaultFont: string;
13
+ enabled?: boolean;
14
+ fontManager: SkTypefaceFontProvider;
15
+ colorScheme: ResolvedScoreColorScheme;
16
+ options: ScoreOptions;
17
+ rendererType: RendererType;
18
+ score: Score;
19
+ viewport: RendererRect;
20
+ }): ScoreRecording;
21
+ //# sourceMappingURL=useScoreRecording.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScoreRecording.d.ts","sourceRoot":"","sources":["../../../../src/renderer/useScoreRecording.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEzE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAG7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAExE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IAC7C,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,OAAc,EACd,WAAW,EACX,WAAW,EACX,OAAO,EACP,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,sBAAsB,CAAC;IACpC,WAAW,EAAE,wBAAwB,CAAC;IACtC,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;CACxB,GAAG,cAAc,CAgEjB"}
@@ -0,0 +1,3 @@
1
+ import type { RendererSize, RendererType, Viewport, VisibleViewport } from './types';
2
+ export declare function createVisibleViewport(scrollOffset: number, rendererType: RendererType, viewport: Viewport, contentSize: RendererSize): VisibleViewport;
3
+ //# sourceMappingURL=viewport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../../src/renderer/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,eAAe,EAChB,MAAM,SAAS,CAAC;AAcjB,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,YAAY,GACxB,eAAe,CAoBjB"}
@@ -0,0 +1,18 @@
1
+ export declare enum LogCategory {
2
+ FontManager = "FontManager",
3
+ VexflowRecordingContext = "VexflowRecordingContext",
4
+ VexflowCanvas = "VexflowCanvas",
5
+ Default = "Default"
6
+ }
7
+ declare class Logger {
8
+ private logCategory;
9
+ constructor(category?: LogCategory);
10
+ extend(logCategory: LogCategory): Logger;
11
+ formatMessage(...params: unknown[]): unknown[];
12
+ log(...params: unknown[]): void;
13
+ warn(...params: unknown[]): void;
14
+ error(...params: unknown[]): void;
15
+ }
16
+ declare const _default: Logger;
17
+ export default _default;
18
+ //# sourceMappingURL=Logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../../../src/shared/Logger.ts"],"names":[],"mappings":"AAEA,oBAAY,WAAW;IACrB,WAAW,gBAAgB;IAC3B,uBAAuB,4BAA4B;IACnD,aAAa,kBAAkB;IAC/B,OAAO,YAAY;CACpB;AAuBD,cAAM,MAAM;IACV,OAAO,CAAC,WAAW,CAAS;gBAEhB,QAAQ,GAAE,WAAiC;IAIvD,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM;IAIxC,aAAa,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE;IAkBlC,GAAG,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE;IAQxB,IAAI,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE;IAQzB,KAAK,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE;CAO3B;;AAED,wBAA4B"}
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,190 @@
1
+ export type Id = string;
2
+ export type Clef = 'treble' | 'bass' | 'alto' | 'tenor' | 'soprano' | 'mezzo-soprano' | 'baritone-c' | 'baritone-f' | 'subbass' | 'french' | 'percussion' | 'tab';
3
+ export type Step = 'C' | 'D' | 'E' | 'F' | 'G' | 'A' | 'B';
4
+ export type Accidental = 'bb' | 'b' | 'n' | '#' | '##' | 'x' | 'quarter-flat' | 'quarter-sharp';
5
+ export type NoteLength = 'long' | 'breve' | 'w' | 'h' | 'q' | '8' | '16' | '32' | '64' | '128';
6
+ export type StemDirection = 'up' | 'down' | 'auto';
7
+ export type Barline = 'single' | 'double' | 'end' | 'repeat-begin' | 'repeat-end' | 'final';
8
+ export type Articulation = 'staccato' | 'tenuto' | 'accent' | 'marcato' | 'staccatissimo' | 'fermata';
9
+ export type Dynamic = 'ppp' | 'pp' | 'p' | 'mp' | 'mf' | 'f' | 'ff' | 'fff' | 'sfz';
10
+ export type KeyMode = 'major' | 'minor' | 'dorian' | 'phrygian' | 'lydian' | 'mixolydian' | 'locrian';
11
+ export type VoiceTimingMode = 'strict' | 'soft' | 'free';
12
+ export type StaffGroupRole = 'grandStaff' | 'choir' | 'section' | 'custom';
13
+ export type StaffGroupSymbol = 'brace' | 'bracket' | 'line';
14
+ export interface Fraction {
15
+ num: number;
16
+ den: number;
17
+ }
18
+ export interface Pitch {
19
+ step: Step;
20
+ octave: number;
21
+ accidental?: Accidental;
22
+ }
23
+ export interface DurationValue {
24
+ length: NoteLength;
25
+ dots?: 0 | 1 | 2 | 3;
26
+ }
27
+ export interface KeySignature {
28
+ tonic: Step;
29
+ accidental?: 'b' | '#';
30
+ mode?: KeyMode;
31
+ }
32
+ export interface Meter {
33
+ beats: number;
34
+ beatUnit: number;
35
+ beamGroups?: Fraction[];
36
+ }
37
+ export interface Tempo {
38
+ bpm: number;
39
+ beatUnit?: DurationValue;
40
+ text?: string;
41
+ }
42
+ export interface Note {
43
+ id: Id;
44
+ type: 'note';
45
+ pitch: Pitch;
46
+ duration: DurationValue;
47
+ voiceId: Id;
48
+ targetStaffId?: Id;
49
+ stemDirection?: StemDirection;
50
+ }
51
+ export interface Rest {
52
+ id: Id;
53
+ type: 'rest';
54
+ duration: DurationValue;
55
+ voiceId: Id;
56
+ targetStaffId?: Id;
57
+ kind?: 'visible' | 'spacer' | 'hidden';
58
+ staffLine?: number;
59
+ }
60
+ export interface Chord {
61
+ id: Id;
62
+ type: 'chord';
63
+ pitches: Pitch[];
64
+ duration: DurationValue;
65
+ voiceId: Id;
66
+ targetStaffId?: Id;
67
+ stemDirection?: StemDirection;
68
+ }
69
+ export type VoiceItem = Note | Rest | Chord;
70
+ export interface Voice {
71
+ id: Id;
72
+ name?: string;
73
+ index: number;
74
+ timingMode?: VoiceTimingMode;
75
+ items: VoiceItem[];
76
+ }
77
+ export interface MeasureState {
78
+ clef?: Clef;
79
+ meter?: Meter;
80
+ keySignature?: KeySignature;
81
+ tempo?: Tempo;
82
+ }
83
+ export interface MeasureLeftModifiers {
84
+ showClef?: boolean;
85
+ showMeter?: boolean;
86
+ showKeySignature?: boolean;
87
+ startBarline?: Barline;
88
+ }
89
+ export interface MeasureRightModifiers {
90
+ endBarline?: Barline;
91
+ }
92
+ export interface TextDirection {
93
+ id: Id;
94
+ type: 'text';
95
+ text: string;
96
+ placement?: 'above' | 'below';
97
+ }
98
+ export interface TempoDirection {
99
+ id: Id;
100
+ type: 'tempo';
101
+ tempo: Tempo;
102
+ placement?: 'above' | 'below';
103
+ }
104
+ export type Direction = TextDirection | TempoDirection;
105
+ export interface Measure {
106
+ id: Id;
107
+ number: number;
108
+ state?: MeasureState;
109
+ leftModifiers?: MeasureLeftModifiers;
110
+ rightModifiers?: MeasureRightModifiers;
111
+ directions?: Direction[];
112
+ voices: Voice[];
113
+ }
114
+ export interface Staff {
115
+ id: Id;
116
+ name?: string;
117
+ shortName?: string;
118
+ order: number;
119
+ defaultClef: Clef;
120
+ transposition?: number;
121
+ measures: Measure[];
122
+ }
123
+ export interface StaffGroup {
124
+ id: Id;
125
+ staffIds?: Id[];
126
+ role: StaffGroupRole;
127
+ symbol?: StaffGroupSymbol;
128
+ }
129
+ export interface ScoreMetadata {
130
+ title?: string;
131
+ subtitle?: string;
132
+ composer?: string;
133
+ lyricist?: string;
134
+ arranger?: string;
135
+ copyright?: string;
136
+ }
137
+ export interface ScoreDefaults {
138
+ meter: Meter;
139
+ keySignature?: KeySignature;
140
+ tempo?: Tempo;
141
+ }
142
+ export interface AttachmentBase {
143
+ id: Id;
144
+ ownerId: Id;
145
+ }
146
+ export interface ArticulationAttachment extends AttachmentBase {
147
+ type: 'articulation';
148
+ articulation: Articulation;
149
+ }
150
+ export interface DynamicAttachment extends AttachmentBase {
151
+ type: 'dynamic';
152
+ dynamic: Dynamic;
153
+ placement?: 'above' | 'below';
154
+ }
155
+ export interface LyricAttachment extends AttachmentBase {
156
+ type: 'lyric';
157
+ text: string;
158
+ verse?: number;
159
+ }
160
+ export type NoteAttachment = ArticulationAttachment | DynamicAttachment | LyricAttachment;
161
+ export interface Tie {
162
+ id: Id;
163
+ fromNoteId: Id;
164
+ toNoteId: Id;
165
+ }
166
+ export interface Slur {
167
+ id: Id;
168
+ fromNoteId: Id;
169
+ toNoteId: Id;
170
+ }
171
+ export interface TupletGroup {
172
+ id: Id;
173
+ voiceId: Id;
174
+ itemIds: Id[];
175
+ ratio: Fraction;
176
+ bracketed?: boolean;
177
+ placement?: 'above' | 'below';
178
+ }
179
+ export interface Score {
180
+ id: Id;
181
+ metadata?: ScoreMetadata;
182
+ defaults: ScoreDefaults;
183
+ staves: Staff[];
184
+ staffGroups?: StaffGroup[];
185
+ attachments?: NoteAttachment[];
186
+ ties?: Tie[];
187
+ slurs?: Slur[];
188
+ tuplets?: TupletGroup[];
189
+ }
190
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 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pB,EAAE,EAAE,EAAE,CAAC;IACP,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,aAAa,CAAC;IACxB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB"}
@@ -1,7 +1 @@
1
- export type LineCap = 'butt' | 'round' | 'square';
2
- export type LineJoin = 'miter' | 'round' | 'bevel';
3
- export type ParsedCssFont = {
4
- sizePx: number;
5
- family?: string;
6
- };
7
1
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":""}
@@ -1,7 +1 @@
1
- import { type SkFont } from '@shopify/react-native-skia';
2
- import { type ParsedCssFont } from './types';
3
- export declare function getAdvanceWidth(font: SkFont, text: string): number;
4
- export declare function toPxFontSize(size: number | string | undefined): number;
5
- export declare function parseCssFontShorthand(cssFont: string): ParsedCssFont;
6
- export declare function createFont(size: number, familyName?: string, bravuraFont?: SkFont | null): SkFont;
7
1
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAIlE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAmBtE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAiBpE;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,CAoDR"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.tsx"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,24 +1,35 @@
1
1
  {
2
2
  "name": "vexflow-native",
3
- "version": "0.2.0",
4
- "description": "React native backend for rendering music notation using @shopify/react-native-skiaact-native-skia",
5
- "main": "./lib/module/index.js",
6
- "types": "./lib/typescript/src/index.d.ts",
3
+ "version": "1.1.0",
4
+ "description": "React native backend for rendering music notation using @shopify/react-native-skia",
5
+ "main": "./lib/module/base/index.js",
6
+ "types": "./lib/typescript/src/base/index.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "source": "./src/index.tsx",
10
- "types": "./lib/typescript/src/index.d.ts",
11
- "default": "./lib/module/index.js"
9
+ "source": "./src/base/index.ts",
10
+ "types": "./lib/typescript/src/base/index.d.ts",
11
+ "default": "./lib/module/base/index.js"
12
+ },
13
+ "./state": {
14
+ "source": "./src/state/index.ts",
15
+ "types": "./lib/typescript/src/state/index.d.ts",
16
+ "default": "./lib/module/state/index.js"
17
+ },
18
+ "./renderer": {
19
+ "source": "./src/renderer/index.ts",
20
+ "types": "./lib/typescript/src/renderer/index.d.ts",
21
+ "default": "./lib/module/renderer/index.js"
22
+ },
23
+ "./musicxml": {
24
+ "source": "./src/musicxml/index.ts",
25
+ "types": "./lib/typescript/src/musicxml/index.d.ts",
26
+ "default": "./lib/module/musicxml/index.js"
12
27
  },
13
28
  "./package.json": "./package.json"
14
29
  },
15
30
  "files": [
16
31
  "src",
17
32
  "lib",
18
- "android",
19
- "ios",
20
- "cpp",
21
- "*.podspec",
22
33
  "react-native.config.js",
23
34
  "!ios/build",
24
35
  "!android/build",
@@ -36,7 +47,9 @@
36
47
  "clean": "del-cli lib",
37
48
  "prepare": "bob build",
38
49
  "typecheck": "tsc",
39
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
50
+ "lint": "eslint src example --ext .js,.ts,.tsx",
51
+ "lint:fix": "yarn lint --fix",
52
+ "format": "prettier --write README.md package.json \"src/**/*.{ts,tsx}\"",
40
53
  "test": "jest",
41
54
  "release": "release-it --only-version"
42
55
  },
@@ -66,7 +79,7 @@
66
79
  "@react-native/babel-preset": "0.83.0",
67
80
  "@react-native/eslint-config": "0.83.0",
68
81
  "@release-it/conventional-changelog": "^10.0.1",
69
- "@shopify/react-native-skia": "^2.4.21",
82
+ "@shopify/react-native-skia": "2.6.2",
70
83
  "@types/jest": "^29.5.14",
71
84
  "@types/react": "^19.1.12",
72
85
  "commitlint": "^19.8.1",
@@ -80,6 +93,9 @@
80
93
  "react": "19.1.0",
81
94
  "react-native": "0.81.5",
82
95
  "react-native-builder-bob": "^0.40.18",
96
+ "react-native-gesture-handler": "^2.30.0",
97
+ "react-native-reanimated": "^4.2.2",
98
+ "react-native-worklets": "^0.7.4",
83
99
  "release-it": "^19.0.4",
84
100
  "turbo": "^2.5.6",
85
101
  "typescript": "^5.9.2",
@@ -89,6 +105,9 @@
89
105
  "@shopify/react-native-skia": "*",
90
106
  "react": "*",
91
107
  "react-native": "*",
108
+ "react-native-gesture-handler": "*",
109
+ "react-native-reanimated": "*",
110
+ "react-native-worklets": "*",
92
111
  "vexflow": "*"
93
112
  },
94
113
  "workspaces": [
@@ -124,7 +143,12 @@
124
143
  "preset": "react-native",
125
144
  "modulePathIgnorePatterns": [
126
145
  "<rootDir>/example/node_modules",
127
- "<rootDir>/lib/"
146
+ "<rootDir>/lib/",
147
+ "<rootDir>/prev-implementation/"
148
+ ],
149
+ "testPathIgnorePatterns": [
150
+ "<rootDir>/example/",
151
+ "<rootDir>/prev-implementation/"
128
152
  ]
129
153
  },
130
154
  "commitlint": {
@@ -161,5 +185,8 @@
161
185
  "release-it"
162
186
  ],
163
187
  "version": "0.57.2"
188
+ },
189
+ "dependencies": {
190
+ "fast-xml-parser": "^5.7.3"
164
191
  }
165
192
  }
@@ -0,0 +1,206 @@
1
+ import type { FontInfo } from 'vexflow';
2
+ import {
3
+ FontWeight,
4
+ FontSlant,
5
+ FontWidth,
6
+ Skia,
7
+ } from '@shopify/react-native-skia';
8
+ import type {
9
+ SkFont,
10
+ SkTypefaceFontProvider,
11
+ } from '@shopify/react-native-skia';
12
+
13
+ // import Logger, { LogCategory } from '../shared/Logger';
14
+
15
+ // const Log = Logger.extend(LogCategory.FontManager);
16
+
17
+ interface ResolvedFont {
18
+ family: string;
19
+ size: number;
20
+ weight: FontWeight;
21
+ slant: FontSlant;
22
+ width: FontWidth;
23
+ }
24
+
25
+ const PT_TO_PX = 4 / 3; // 1pt = 1.333px
26
+
27
+ function parseSize(size?: string | number): number {
28
+ 'worklet';
29
+
30
+ if (typeof size === 'number') {
31
+ return size;
32
+ }
33
+
34
+ if (typeof size === 'string') {
35
+ const match = size.trim().match(/^(\d+(?:\.\d+)?)(px|pt|em|%)?$/);
36
+
37
+ if (match) {
38
+ const value = parseFloat(match?.[1] || '30');
39
+ const unit = match[2] || 'pt';
40
+
41
+ switch (unit) {
42
+ case 'px':
43
+ return value * 0.75; // 1px = 0.75pt
44
+ case 'em':
45
+ return value * 12; // Assuming 1em = 16px = 12pt
46
+ case '%':
47
+ return value * 0.12; // Assuming 100% = 12pt
48
+ case 'pt':
49
+ default:
50
+ return value;
51
+ }
52
+ }
53
+ }
54
+
55
+ return 30; // Default font size in pixels
56
+ }
57
+
58
+ function parseWeight(weight?: string | number): FontWeight {
59
+ 'worklet';
60
+
61
+ const weightStr = String(weight || 'normal').toLowerCase();
62
+
63
+ return (
64
+ {
65
+ 'normal': FontWeight.Normal,
66
+ 'bold': FontWeight.Bold,
67
+ '100': FontWeight.Thin,
68
+ '200': FontWeight.ExtraLight,
69
+ '300': FontWeight.Light,
70
+ '400': FontWeight.Normal,
71
+ '500': FontWeight.Medium,
72
+ '600': FontWeight.SemiBold,
73
+ '700': FontWeight.Bold,
74
+ '800': FontWeight.ExtraBold,
75
+ '900': FontWeight.Black,
76
+ }[weightStr] || FontWeight.Normal
77
+ );
78
+ }
79
+
80
+ function parseSlant(style?: string): FontSlant {
81
+ 'worklet';
82
+
83
+ const styleStr = String(style || 'normal').toLowerCase();
84
+
85
+ return (
86
+ {
87
+ normal: FontSlant.Upright,
88
+ italic: FontSlant.Italic,
89
+ oblique: FontSlant.Oblique,
90
+ }[styleStr] || FontSlant.Upright
91
+ );
92
+ }
93
+
94
+ export default class FontManager {
95
+ __workletClass = true;
96
+
97
+ private fontProvider: SkTypefaceFontProvider;
98
+ private defaultFontName: string;
99
+
100
+ constructor(fontProvider: SkTypefaceFontProvider, defaultFontName: string) {
101
+ this.fontProvider = fontProvider;
102
+ this.defaultFontName = defaultFontName;
103
+
104
+ const families: string[] = [];
105
+
106
+ for (let i = 0; i < fontProvider.countFamilies(); i++) {
107
+ families.push(fontProvider.getFamilyName(i));
108
+ }
109
+
110
+ if (!families.includes(defaultFontName)) {
111
+ throw new Error(
112
+ `Default font "${defaultFontName}" is not available in the font provider. Available fonts: ${families.join(
113
+ ', '
114
+ )}`
115
+ );
116
+ }
117
+ }
118
+
119
+ private isFamilyAvailable(family: string): boolean {
120
+ for (let i = 0; i < this.fontProvider.countFamilies(); i++) {
121
+ if (
122
+ this.fontProvider.getFamilyName(i).toLowerCase() ===
123
+ family.toLowerCase()
124
+ ) {
125
+ return true;
126
+ }
127
+ }
128
+
129
+ return false;
130
+ }
131
+
132
+ private getFamiliesFromFont(font: string | FontInfo): string[] {
133
+ if (typeof font === 'string') {
134
+ return font.split(',').map((f) => f.trim());
135
+ }
136
+
137
+ return (font as FontInfo).family
138
+ ? (font as FontInfo).family!.split(',').map((f) => f.trim())
139
+ : [];
140
+ }
141
+
142
+ private matchFontFamilyName(font: string | FontInfo): string {
143
+ if (!font) {
144
+ return this.defaultFontName;
145
+ }
146
+
147
+ const families = this.getFamiliesFromFont(font);
148
+
149
+ for (const family of families) {
150
+ if (this.isFamilyAvailable(family)) {
151
+ return family;
152
+ }
153
+ }
154
+
155
+ return this.defaultFontName;
156
+ }
157
+
158
+ resolveFontDescriptor(
159
+ font?: string | FontInfo,
160
+ size?: string | number,
161
+ weight?: string | number,
162
+ style?: string
163
+ ): ResolvedFont {
164
+ return {
165
+ family: this.matchFontFamilyName(font || ''),
166
+ size: parseSize(
167
+ typeof font === 'string' ? size : (font as FontInfo).size || size
168
+ ),
169
+ weight: parseWeight(weight),
170
+ slant: parseSlant(style),
171
+ width: FontWidth.Normal,
172
+ };
173
+ }
174
+
175
+ createSkFont(
176
+ font?: string | FontInfo,
177
+ size?: string | number,
178
+ weight?: string | number,
179
+ style?: string
180
+ ): SkFont {
181
+ const {
182
+ family,
183
+ size: resolvedSize,
184
+ weight: resolvedWeight,
185
+ slant,
186
+ } = this.resolveFontDescriptor(font, size, weight, style);
187
+
188
+ const typeface = this.fontProvider.matchFamilyStyle(family, {
189
+ weight: resolvedWeight,
190
+ slant,
191
+ width: FontWidth.Normal,
192
+ });
193
+
194
+ if (!typeface) {
195
+ throw new Error(
196
+ `Failed to create SkFont. No matching typeface found for family "${family}" with weight "${resolvedWeight}" and slant "${slant}".`
197
+ );
198
+ }
199
+
200
+ // Log.log(
201
+ // `Created SkFont with family "${family}", size ${resolvedSize}px, weight ${resolvedWeight}, slant ${slant}.`
202
+ // );
203
+
204
+ return Skia.Font(typeface, resolvedSize * PT_TO_PX); // Convert from points to pixels
205
+ }
206
+ }