@shopify/react-native-skia 0.1.207 → 0.1.208

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/cpp/api/JsiSkColorFilter.h +1 -1
  2. package/cpp/api/JsiSkContourMeasure.h +1 -1
  3. package/cpp/api/JsiSkContourMeasureIter.h +1 -1
  4. package/cpp/api/JsiSkData.h +1 -1
  5. package/cpp/api/JsiSkFont.h +1 -1
  6. package/cpp/api/JsiSkFontMgr.h +2 -2
  7. package/cpp/api/JsiSkFontStyle.h +11 -5
  8. package/cpp/api/JsiSkImage.h +1 -1
  9. package/cpp/api/JsiSkImageFilter.h +1 -1
  10. package/cpp/api/JsiSkMaskFilter.h +1 -1
  11. package/cpp/api/JsiSkMatrix.h +1 -1
  12. package/cpp/api/JsiSkPaint.h +1 -1
  13. package/cpp/api/JsiSkPath.h +1 -1
  14. package/cpp/api/JsiSkPathEffect.h +1 -1
  15. package/cpp/api/JsiSkPicture.h +1 -1
  16. package/cpp/api/JsiSkPictureRecorder.h +1 -1
  17. package/cpp/api/JsiSkRuntimeEffect.h +1 -1
  18. package/cpp/api/JsiSkSVG.h +1 -1
  19. package/cpp/api/JsiSkShader.h +1 -1
  20. package/cpp/api/JsiSkSurface.h +1 -1
  21. package/cpp/api/JsiSkTextBlob.h +1 -1
  22. package/cpp/api/JsiSkTypeFaceFontProvider.h +4 -2
  23. package/cpp/api/JsiSkTypeface.h +24 -2
  24. package/cpp/api/JsiSkVertices.h +1 -1
  25. package/lib/commonjs/external/reanimated/moduleWrapper.js +1 -1
  26. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  27. package/lib/commonjs/skia/types/Font/FontMgr.d.ts +1 -1
  28. package/lib/commonjs/skia/types/Font/FontMgr.js.map +1 -1
  29. package/lib/commonjs/skia/types/Typeface/Typeface.d.ts +10 -1
  30. package/lib/commonjs/skia/types/Typeface/Typeface.js.map +1 -1
  31. package/lib/commonjs/skia/web/JsiSkTypeface.d.ts +1 -0
  32. package/lib/commonjs/skia/web/JsiSkTypeface.js +4 -0
  33. package/lib/commonjs/skia/web/JsiSkTypeface.js.map +1 -1
  34. package/lib/module/external/reanimated/moduleWrapper.js +1 -1
  35. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  36. package/lib/module/skia/types/Font/FontMgr.d.ts +1 -1
  37. package/lib/module/skia/types/Font/FontMgr.js.map +1 -1
  38. package/lib/module/skia/types/Typeface/Typeface.d.ts +10 -1
  39. package/lib/module/skia/types/Typeface/Typeface.js.map +1 -1
  40. package/lib/module/skia/web/JsiSkTypeface.d.ts +1 -0
  41. package/lib/module/skia/web/JsiSkTypeface.js +4 -0
  42. package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
  43. package/lib/typescript/src/skia/types/Font/FontMgr.d.ts +1 -1
  44. package/lib/typescript/src/skia/types/Typeface/Typeface.d.ts +10 -1
  45. package/lib/typescript/src/skia/web/JsiSkTypeface.d.ts +1 -0
  46. package/package.json +1 -1
  47. package/src/external/reanimated/moduleWrapper.ts +1 -1
  48. package/src/skia/types/Font/FontMgr.ts +1 -1
  49. package/src/skia/types/Typeface/Typeface.ts +10 -1
  50. package/src/skia/web/JsiSkTypeface.ts +4 -0
@@ -23,7 +23,7 @@ public:
23
23
  : JsiSkWrappingSkPtrHostObject<SkColorFilter>(std::move(context),
24
24
  std::move(colorFilter)) {}
25
25
 
26
- EXPORT_JSI_API_TYPENAME(JsiSkColorFilter, "ColorFilter")
26
+ EXPORT_JSI_API_TYPENAME(JsiSkColorFilter, ColorFilter)
27
27
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkColorFilter, dispose))
28
28
  };
29
29
 
@@ -68,7 +68,7 @@ public:
68
68
  return JsiSkPath::toValue(runtime, getContext(), std::move(path));
69
69
  }
70
70
 
71
- EXPORT_JSI_API_TYPENAME(JsiSkContourMeasure, "ContourMeasure")
71
+ EXPORT_JSI_API_TYPENAME(JsiSkContourMeasure, ContourMeasure)
72
72
 
73
73
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkContourMeasure, getPosTan),
74
74
  JSI_EXPORT_FUNC(JsiSkContourMeasure, length),
@@ -40,7 +40,7 @@ public:
40
40
  return jsi::Object::createFromHostObject(runtime, std::move(nextObject));
41
41
  }
42
42
 
43
- EXPORT_JSI_API_TYPENAME(JsiSkContourMeasureIter, "ContourMeasureIter")
43
+ EXPORT_JSI_API_TYPENAME(JsiSkContourMeasureIter, ContourMeasureIter)
44
44
 
45
45
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkContourMeasureIter, next),
46
46
  JSI_EXPORT_FUNC(JsiSkContourMeasureIter, dispose))
@@ -24,7 +24,7 @@ public:
24
24
  JsiSkData(std::shared_ptr<RNSkPlatformContext> context, sk_sp<SkData> asset)
25
25
  : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(asset)) {}
26
26
 
27
- EXPORT_JSI_API_TYPENAME(JsiSkData, "Data")
27
+ EXPORT_JSI_API_TYPENAME(JsiSkData, Data)
28
28
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkData, dispose))
29
29
  };
30
30
  } // namespace RNSkia
@@ -239,7 +239,7 @@ public:
239
239
  return jsi::Value::undefined();
240
240
  }
241
241
 
242
- EXPORT_JSI_API_TYPENAME(JsiSkFont, "Font")
242
+ EXPORT_JSI_API_TYPENAME(JsiSkFont, Font)
243
243
 
244
244
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkFont, getSize),
245
245
  JSI_EXPORT_FUNC(JsiSkFont, getMetrics),
@@ -23,7 +23,7 @@ namespace jsi = facebook::jsi;
23
23
 
24
24
  class JsiSkFontMgr : public JsiSkWrappingSkPtrHostObject<SkFontMgr> {
25
25
  public:
26
- EXPORT_JSI_API_TYPENAME(JsiSkFontMgr, "FontMgr")
26
+ EXPORT_JSI_API_TYPENAME(JsiSkFontMgr, FontMgr)
27
27
 
28
28
  JsiSkFontMgr(std::shared_ptr<RNSkPlatformContext> context,
29
29
  sk_sp<SkFontMgr> fontMgr)
@@ -51,4 +51,4 @@ public:
51
51
  JSI_EXPORT_FUNC(JsiSkFontMgr, matchFamilyStyle))
52
52
  };
53
53
 
54
- } // namespace RNSkia
54
+ } // namespace RNSkia
@@ -36,12 +36,18 @@ public:
36
36
  if (object.isHostObject(runtime)) {
37
37
  return object.asHostObject<JsiSkFontStyle>(runtime)->getObject();
38
38
  } else {
39
- auto weight =
40
- static_cast<int>(object.getProperty(runtime, "weight").asNumber());
41
- auto width =
42
- static_cast<int>(object.getProperty(runtime, "width").asNumber());
39
+ auto weightProp = object.getProperty(runtime, "weight");
40
+ auto weight = static_cast<int>(weightProp.isUndefined()
41
+ ? SkFontStyle::Weight::kNormal_Weight
42
+ : weightProp.asNumber());
43
+ auto widthProp = object.getProperty(runtime, "width");
44
+ auto width = static_cast<int>(widthProp.isUndefined()
45
+ ? SkFontStyle::Width::kNormal_Width
46
+ : widthProp.asNumber());
47
+ auto slantProp = object.getProperty(runtime, "slant");
43
48
  auto slant = static_cast<SkFontStyle::Slant>(
44
- object.getProperty(runtime, "slant").asNumber());
49
+ slantProp.isUndefined() ? SkFontStyle::Slant::kUpright_Slant
50
+ : slantProp.asNumber());
45
51
  SkFontStyle style(weight, width, slant);
46
52
  return std::make_shared<SkFontStyle>(style);
47
53
  }
@@ -131,7 +131,7 @@ public:
131
131
  runtime, std::make_shared<JsiSkImage>(getContext(), std::move(image)));
132
132
  }
133
133
 
134
- EXPORT_JSI_API_TYPENAME(JsiSkImage, "Image")
134
+ EXPORT_JSI_API_TYPENAME(JsiSkImage, Image)
135
135
 
136
136
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width),
137
137
  JSI_EXPORT_FUNC(JsiSkImage, height),
@@ -25,7 +25,7 @@ public:
25
25
  : JsiSkWrappingSkPtrHostObject<SkImageFilter>(std::move(context),
26
26
  std::move(imageFilter)) {}
27
27
 
28
- EXPORT_JSI_API_TYPENAME(JsiSkImageFilter, "ImageFilter")
28
+ EXPORT_JSI_API_TYPENAME(JsiSkImageFilter, ImageFilter)
29
29
  };
30
30
 
31
31
  } // namespace RNSkia
@@ -25,7 +25,7 @@ public:
25
25
  : JsiSkWrappingSkPtrHostObject<SkMaskFilter>(std::move(context),
26
26
  std::move(maskFilter)) {}
27
27
 
28
- EXPORT_JSI_API_TYPENAME(JsiSkMaskFilter, "MaskFilter")
28
+ EXPORT_JSI_API_TYPENAME(JsiSkMaskFilter, MaskFilter)
29
29
  };
30
30
 
31
31
  } // namespace RNSkia
@@ -86,7 +86,7 @@ public:
86
86
  return values;
87
87
  }
88
88
 
89
- EXPORT_JSI_API_TYPENAME(JsiSkMatrix, "Matrix")
89
+ EXPORT_JSI_API_TYPENAME(JsiSkMatrix, Matrix)
90
90
 
91
91
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkMatrix, concat),
92
92
  JSI_EXPORT_FUNC(JsiSkMatrix, translate),
@@ -25,7 +25,7 @@ namespace jsi = facebook::jsi;
25
25
 
26
26
  class JsiSkPaint : public JsiSkWrappingSharedPtrHostObject<SkPaint> {
27
27
  public:
28
- EXPORT_JSI_API_TYPENAME(JsiSkPaint, "Paint")
28
+ EXPORT_JSI_API_TYPENAME(JsiSkPaint, Paint)
29
29
 
30
30
  JSI_HOST_FUNCTION(copy) {
31
31
  const auto *paint = getObject().get();
@@ -523,7 +523,7 @@ public:
523
523
  return cmds;
524
524
  }
525
525
 
526
- EXPORT_JSI_API_TYPENAME(JsiSkPath, "Path")
526
+ EXPORT_JSI_API_TYPENAME(JsiSkPath, Path)
527
527
 
528
528
  JSI_EXPORT_FUNCTIONS(
529
529
  JSI_EXPORT_FUNC(JsiSkPath, addPath), JSI_EXPORT_FUNC(JsiSkPath, addArc),
@@ -25,7 +25,7 @@ public:
25
25
  : JsiSkWrappingSkPtrHostObject<SkPathEffect>(std::move(context),
26
26
  std::move(pathEffect)) {}
27
27
 
28
- EXPORT_JSI_API_TYPENAME(JsiSkPathEffect, "PathEffect")
28
+ EXPORT_JSI_API_TYPENAME(JsiSkPathEffect, PathEffect)
29
29
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkColorFilter, dispose))
30
30
  };
31
31
 
@@ -60,7 +60,7 @@ public:
60
60
  return array;
61
61
  }
62
62
 
63
- EXPORT_JSI_API_TYPENAME(JsiSkPicture, "Picture")
63
+ EXPORT_JSI_API_TYPENAME(JsiSkPicture, Picture)
64
64
 
65
65
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPicture, makeShader),
66
66
  JSI_EXPORT_FUNC(JsiSkPicture, serialize),
@@ -40,7 +40,7 @@ public:
40
40
  runtime, std::make_shared<JsiSkPicture>(getContext(), picture));
41
41
  }
42
42
 
43
- EXPORT_JSI_API_TYPENAME(JsiSkPictureRecorder, "PictureRecorder")
43
+ EXPORT_JSI_API_TYPENAME(JsiSkPictureRecorder, PictureRecorder)
44
44
 
45
45
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPictureRecorder, beginRecording),
46
46
  JSI_EXPORT_FUNC(JsiSkPictureRecorder,
@@ -115,7 +115,7 @@ public:
115
115
  return jsi::String::createFromAscii(runtime, getObject()->source());
116
116
  }
117
117
 
118
- EXPORT_JSI_API_TYPENAME(JsiSkRuntimeEffect, "RuntimeEffect")
118
+ EXPORT_JSI_API_TYPENAME(JsiSkRuntimeEffect, RuntimeEffect)
119
119
 
120
120
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkRuntimeEffect, makeShader),
121
121
  JSI_EXPORT_FUNC(JsiSkRuntimeEffect,
@@ -24,7 +24,7 @@ public:
24
24
  : JsiSkWrappingSkPtrHostObject<SkSVGDOM>(std::move(context),
25
25
  std::move(svgdom)) {}
26
26
 
27
- EXPORT_JSI_API_TYPENAME(JsiSkSVG, "SVG")
27
+ EXPORT_JSI_API_TYPENAME(JsiSkSVG, SVG)
28
28
 
29
29
  JSI_HOST_FUNCTION(width) {
30
30
  return static_cast<double>(getObject()->containerSize().width());
@@ -26,7 +26,7 @@ public:
26
26
  : JsiSkWrappingSkPtrHostObject<SkShader>(std::move(context),
27
27
  std::move(shader)) {}
28
28
 
29
- EXPORT_JSI_API_TYPENAME(JsiSkShader, "Shader")
29
+ EXPORT_JSI_API_TYPENAME(JsiSkShader, Shader)
30
30
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkShader, dispose))
31
31
  };
32
32
  } // namespace RNSkia
@@ -28,7 +28,7 @@ public:
28
28
  : JsiSkWrappingSkPtrHostObject<SkSurface>(std::move(context),
29
29
  std::move(surface)) {}
30
30
 
31
- EXPORT_JSI_API_TYPENAME(JsiSkSurface, "Surface")
31
+ EXPORT_JSI_API_TYPENAME(JsiSkSurface, Surface)
32
32
 
33
33
  JSI_HOST_FUNCTION(getCanvas) {
34
34
  return jsi::Object::createFromHostObject(
@@ -25,7 +25,7 @@ public:
25
25
  : JsiSkWrappingSkPtrHostObject<SkTextBlob>(std::move(context),
26
26
  std::move(shader)) {}
27
27
 
28
- EXPORT_JSI_API_TYPENAME(JsiSkTextBlob, "TextBlob")
28
+ EXPORT_JSI_API_TYPENAME(JsiSkTextBlob, TextBlob)
29
29
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTextBlob, dispose))
30
30
  };
31
31
  } // namespace RNSkia
@@ -27,7 +27,8 @@ namespace para = skia::textlayout;
27
27
  class JsiSkTypefaceFontProvider
28
28
  : public JsiSkWrappingSkPtrHostObject<para::TypefaceFontProvider> {
29
29
  public:
30
- EXPORT_JSI_API_TYPENAME(JsiSkTypefaceFontProvider, "FontMgr")
30
+ EXPORT_JSI_API_TYPENAME(JsiSkTypefaceFontProvider, TypefaceFontProvider)
31
+
31
32
  JSI_EXPORT_FUNCTIONS(
32
33
  JSI_EXPORT_FUNC(JsiSkTypefaceFontProvider, dispose),
33
34
  JSI_EXPORT_FUNC(JsiSkTypefaceFontProvider, registerFont),
@@ -46,7 +47,8 @@ public:
46
47
  JSI_HOST_FUNCTION(matchFamilyStyle) {
47
48
  auto name = arguments[0].asString(runtime).utf8(runtime);
48
49
  auto fontStyle = JsiSkFontStyle::fromValue(runtime, arguments[1]);
49
- auto typeface = getObject()->matchFamilyStyle(name.c_str(), *fontStyle);
50
+ sk_sp<SkFontStyleSet> set(getObject()->onMatchFamily(name.c_str()));
51
+ sk_sp<SkTypeface> typeface(set->matchStyle(*fontStyle));
50
52
  return jsi::Object::createFromHostObject(
51
53
  runtime, std::make_shared<JsiSkTypeface>(getContext(), typeface));
52
54
  }
@@ -2,6 +2,7 @@
2
2
 
3
3
  #include <memory>
4
4
  #include <utility>
5
+ #include <vector>
5
6
 
6
7
  #include <jsi/jsi.h>
7
8
 
@@ -22,13 +23,34 @@ namespace jsi = facebook::jsi;
22
23
 
23
24
  class JsiSkTypeface : public JsiSkWrappingSkPtrHostObject<SkTypeface> {
24
25
  public:
25
- EXPORT_JSI_API_TYPENAME(JsiSkTypeface, "Typeface")
26
- JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTypeface, dispose))
26
+ EXPORT_JSI_API_TYPENAME(JsiSkTypeface, Typeface)
27
+ JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTypeface, getGlyphIDs),
28
+ JSI_EXPORT_FUNC(JsiSkTypeface, dispose))
27
29
 
28
30
  JsiSkTypeface(std::shared_ptr<RNSkPlatformContext> context,
29
31
  sk_sp<SkTypeface> typeface)
30
32
  : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(typeface)) {}
31
33
 
34
+ JSI_HOST_FUNCTION(getGlyphIDs) {
35
+ auto str = arguments[0].asString(runtime).utf8(runtime);
36
+ int numGlyphIDs =
37
+ count > 1 && !arguments[1].isNull() && !arguments[1].isUndefined()
38
+ ? static_cast<int>(arguments[1].asNumber())
39
+ : getObject()->textToGlyphs(str.c_str(), str.length(),
40
+ SkTextEncoding::kUTF8, nullptr, 0);
41
+ std::vector<SkGlyphID> glyphIDs;
42
+ glyphIDs.resize(numGlyphIDs);
43
+ getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8,
44
+ static_cast<SkGlyphID *>(glyphIDs.data()),
45
+ numGlyphIDs);
46
+ auto jsiGlyphIDs = jsi::Array(runtime, numGlyphIDs);
47
+ for (int i = 0; i < numGlyphIDs; i++) {
48
+ jsiGlyphIDs.setValueAtIndex(runtime, i,
49
+ jsi::Value(static_cast<int>(glyphIDs[i])));
50
+ }
51
+ return jsiGlyphIDs;
52
+ }
53
+
32
54
  /**
33
55
  Returns the jsi object from a host object of this type
34
56
  */
@@ -25,7 +25,7 @@ public:
25
25
  : JsiSkWrappingSkPtrHostObject<SkVertices>(std::move(context),
26
26
  std::move(vertices)) {}
27
27
 
28
- EXPORT_JSI_API_TYPENAME(JsiSkVertices, "Vertices")
28
+ EXPORT_JSI_API_TYPENAME(JsiSkVertices, Vertices)
29
29
 
30
30
  JSI_HOST_FUNCTION(bounds) {
31
31
  const auto &result = getObject()->bounds();
@@ -35,7 +35,7 @@ exports.HAS_REANIMATED3 = HAS_REANIMATED3;
35
35
  function throwOnMissingReanimated2() {
36
36
  if (!HAS_REANIMATED2) {
37
37
  throw new Error("Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
38
- react-naitve-skia's integration layer API.");
38
+ react-native-skia's integration layer API.");
39
39
  }
40
40
  }
41
41
 
@@ -1 +1 @@
1
- {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated2","Error","throwOnMissingReanimated3","useSharedValue","value","useMemo","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated2: any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nfunction throwOnMissingReanimated2() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-naitve-skia's integration layer API.\"\n );\n }\n}\n\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n throwOnMissingReanimated2();\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\n\nexport const startMapper =\n Reanimated2?.startMapper || throwOnMissingReanimated2;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated2;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated2;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;;;;;;AAAA;;;;AAIA;AACA;AACA;AACA,IAAIA,WAAJ,C,CACA;;AACA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEP,SAASQ,yBAAT,GAAqC;EACnC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;;EACDO,yBAAyB;AAC1B;;AAEM,MAAMG,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmB,IAAAC,cAAA,EAAQ,OAAO;EAAED;AAAF,CAAP,CAAR,EAA2B,CAACA,KAAD,CAA3B,CADpB,CADK;;;AAIA,MAAME,WAAW,GACtB,iBAAAf,WAAW,UAAX,oDAAae,WAAb,KAA4BN,yBADvB;;AAEA,MAAMO,UAAU,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,UAAb,KAA2BP,yBAA9C;;AACA,MAAMQ,OAAO,GAAG,iBAAAjB,WAAW,UAAX,oDAAaiB,OAAb,KAAwBR,yBAAxC;;;AACA,MAAMS,aAAa,GACxBL,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACiB,aAAZ,CAA0BL,KAA1B,CAAlB;AACD,CALM"}
1
+ {"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated2","Error","throwOnMissingReanimated3","useSharedValue","value","useMemo","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated2: any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nfunction throwOnMissingReanimated2() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n throwOnMissingReanimated2();\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\n\nexport const startMapper =\n Reanimated2?.startMapper || throwOnMissingReanimated2;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated2;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated2;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;;;;;;AAAA;;;;AAIA;AACA;AACA;AACA,IAAIA,WAAJ,C,CACA;;AACA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEP,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;;AACA,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;;AAEP,SAASQ,yBAAT,GAAqC;EACnC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;;EACDO,yBAAyB;AAC1B;;AAEM,MAAMG,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmB,IAAAC,cAAA,EAAQ,OAAO;EAAED;AAAF,CAAP,CAAR,EAA2B,CAACA,KAAD,CAA3B,CADpB,CADK;;;AAIA,MAAME,WAAW,GACtB,iBAAAf,WAAW,UAAX,oDAAae,WAAb,KAA4BN,yBADvB;;AAEA,MAAMO,UAAU,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,UAAb,KAA2BP,yBAA9C;;AACA,MAAMQ,OAAO,GAAG,iBAAAjB,WAAW,UAAX,oDAAaiB,OAAb,KAAwBR,yBAAxC;;;AACA,MAAMS,aAAa,GACxBL,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACiB,aAAZ,CAA0BL,KAA1B,CAAlB;AACD,CALM"}
@@ -4,5 +4,5 @@ import type { FontStyle } from "./Font";
4
4
  export interface SkFontMgr extends SkJSIInstance<"FontMgr"> {
5
5
  countFamilies(): number;
6
6
  getFamilyName(index: number): string;
7
- matchFamilyStyle(name: string, style: FontStyle): SkTypeface;
7
+ matchFamilyStyle(name?: string, style?: FontStyle): SkTypeface;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["FontMgr.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkTypeface } from \"../Typeface\";\n\nimport type { FontStyle } from \"./Font\";\n\nexport interface SkFontMgr extends SkJSIInstance<\"FontMgr\"> {\n countFamilies(): number;\n getFamilyName(index: number): string;\n matchFamilyStyle(name: string, style: FontStyle): SkTypeface;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["FontMgr.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkTypeface } from \"../Typeface\";\n\nimport type { FontStyle } from \"./Font\";\n\nexport interface SkFontMgr extends SkJSIInstance<\"FontMgr\"> {\n countFamilies(): number;\n getFamilyName(index: number): string;\n matchFamilyStyle(name?: string, style?: FontStyle): SkTypeface;\n}\n"],"mappings":""}
@@ -1,2 +1,11 @@
1
1
  import type { SkJSIInstance } from "../JsiInstance";
2
- export declare type SkTypeface = SkJSIInstance<"Typeface">;
2
+ export interface SkTypeface extends SkJSIInstance<"Typeface"> {
3
+ /**
4
+ * Retrieves the glyph ids for each code point in the provided string. This call is passed to
5
+ * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces
6
+ * may have different ids for the same code point.
7
+ * @param str
8
+ * @param numCodePoints - the number of code points in the string. Defaults to str.length.
9
+ */
10
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
11
+ }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Typeface.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type SkTypeface = SkJSIInstance<\"Typeface\">;\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Typeface.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport interface SkTypeface extends SkJSIInstance<\"Typeface\"> {\n /**\n * Retrieves the glyph ids for each code point in the provided string. This call is passed to\n * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces\n * may have different ids for the same code point.\n * @param str\n * @param numCodePoints - the number of code points in the string. Defaults to str.length.\n */\n getGlyphIDs(str: string, numCodePoints?: number): number[];\n}\n"],"mappings":""}
@@ -5,5 +5,6 @@ export declare class JsiSkTypeface extends HostObject<Typeface, "Typeface"> impl
5
5
  constructor(CanvasKit: CanvasKit, ref: Typeface);
6
6
  get bold(): boolean;
7
7
  get italic(): boolean;
8
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
8
9
  dispose: () => void;
9
10
  }
@@ -28,6 +28,10 @@ class JsiSkTypeface extends _Host.HostObject {
28
28
  return false;
29
29
  }
30
30
 
31
+ getGlyphIDs(str, numCodePoints) {
32
+ return Array.from(this.ref.getGlyphIDs(str, numCodePoints));
33
+ }
34
+
31
35
  }
32
36
 
33
37
  exports.JsiSkTypeface = JsiSkTypeface;
@@ -1 +1 @@
1
- {"version":3,"names":["JsiSkTypeface","HostObject","constructor","CanvasKit","ref","delete","bold","console","warn","italic"],"sources":["JsiSkTypeface.ts"],"sourcesContent":["import type { CanvasKit, Typeface } from \"canvaskit-wasm\";\n\nimport type { SkTypeface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkTypeface\n extends HostObject<Typeface, \"Typeface\">\n implements SkTypeface\n{\n constructor(CanvasKit: CanvasKit, ref: Typeface) {\n super(CanvasKit, ref, \"Typeface\");\n }\n\n get bold(): boolean {\n console.warn(\n \"Typeface.bold is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n get italic(): boolean {\n console.warn(\n \"Typeface.italic is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n dispose = () => {\n this.ref.delete();\n };\n}\n"],"mappings":";;;;;;;AAIA;;;;AAEO,MAAMA,aAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAsC;IAC/C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,UAAtB;;IAD+C,iCAkBvC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CApBgD;EAEhD;;EAEO,IAAJC,IAAI,GAAY;IAClBC,OAAO,CAACC,IAAR,CACE,sGADF;IAGA,OAAO,KAAP;EACD;;EAES,IAANC,MAAM,GAAY;IACpBF,OAAO,CAACC,IAAR,CACE,wGADF;IAGA,OAAO,KAAP;EACD;;AAjBH"}
1
+ {"version":3,"names":["JsiSkTypeface","HostObject","constructor","CanvasKit","ref","delete","bold","console","warn","italic","getGlyphIDs","str","numCodePoints","Array","from"],"sources":["JsiSkTypeface.ts"],"sourcesContent":["import type { CanvasKit, Typeface } from \"canvaskit-wasm\";\n\nimport type { SkTypeface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkTypeface\n extends HostObject<Typeface, \"Typeface\">\n implements SkTypeface\n{\n constructor(CanvasKit: CanvasKit, ref: Typeface) {\n super(CanvasKit, ref, \"Typeface\");\n }\n\n get bold(): boolean {\n console.warn(\n \"Typeface.bold is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n get italic(): boolean {\n console.warn(\n \"Typeface.italic is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n getGlyphIDs(str: string, numCodePoints?: number) {\n return Array.from(this.ref.getGlyphIDs(str, numCodePoints));\n }\n\n dispose = () => {\n this.ref.delete();\n };\n}\n"],"mappings":";;;;;;;AAIA;;;;AAEO,MAAMA,aAAN,SACGC,gBADH,CAGP;EACEC,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAsC;IAC/C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,UAAtB;;IAD+C,iCAsBvC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAxBgD;EAEhD;;EAEO,IAAJC,IAAI,GAAY;IAClBC,OAAO,CAACC,IAAR,CACE,sGADF;IAGA,OAAO,KAAP;EACD;;EAES,IAANC,MAAM,GAAY;IACpBF,OAAO,CAACC,IAAR,CACE,wGADF;IAGA,OAAO,KAAP;EACD;;EAEDE,WAAW,CAACC,GAAD,EAAcC,aAAd,EAAsC;IAC/C,OAAOC,KAAK,CAACC,IAAN,CAAW,KAAKV,GAAL,CAASM,WAAT,CAAqBC,GAArB,EAA0BC,aAA1B,CAAX,CAAP;EACD;;AArBH"}
@@ -25,7 +25,7 @@ export const HAS_REANIMATED3 = !!Reanimated3;
25
25
  function throwOnMissingReanimated2() {
26
26
  if (!HAS_REANIMATED2) {
27
27
  throw new Error("Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
28
- react-naitve-skia's integration layer API.");
28
+ react-native-skia's integration layer API.");
29
29
  }
30
30
  }
31
31
 
@@ -1 +1 @@
1
- {"version":3,"names":["useMemo","Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated2","Error","throwOnMissingReanimated3","useSharedValue","value","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated2: any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nfunction throwOnMissingReanimated2() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-naitve-skia's integration layer API.\"\n );\n }\n}\n\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n throwOnMissingReanimated2();\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\n\nexport const startMapper =\n Reanimated2?.startMapper || throwOnMissingReanimated2;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated2;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated2;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;AAAA,SAASA,OAAT,QAAwB,OAAxB;AAIA;AACA;AACA;AACA,IAAIC,WAAJ,C,CACA;;AACA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEd,OAAO,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;AACP,OAAO,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;AAEP,SAASQ,yBAAT,GAAqC;EACnC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;;EACDO,yBAAyB;AAC1B;;AAED,OAAO,MAAMG,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmBd,OAAO,CAAC,OAAO;EAAEc;AAAF,CAAP,CAAD,EAAoB,CAACA,KAAD,CAApB,CAD3B,CADK;AAIP,OAAO,MAAMC,WAAW,GACtB,iBAAAd,WAAW,UAAX,oDAAac,WAAb,KAA4BL,yBADvB;AAEP,OAAO,MAAMM,UAAU,GAAG,iBAAAf,WAAW,UAAX,oDAAae,UAAb,KAA2BN,yBAA9C;AACP,OAAO,MAAMO,OAAO,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,OAAb,KAAwBP,yBAAxC;AACP,OAAO,MAAMQ,aAAa,GACxBJ,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACgB,aAAZ,CAA0BJ,KAA1B,CAAlB;AACD,CALM"}
1
+ {"version":3,"names":["useMemo","Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated2","Error","throwOnMissingReanimated3","useSharedValue","value","startMapper","stopMapper","runOnJS","isSharedValue"],"sources":["moduleWrapper.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport type { SharedValueType } from \"../../renderer/processors/Animations\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated2: any;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion =\n // eslint-disable-next-line import/extensions\n require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nfunction throwOnMissingReanimated2() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nfunction throwOnMissingReanimated3() {\n if (!HAS_REANIMATED3) {\n throw new Error(\n `Reanimated version ${reanimatedVersion} is not supported, please upgrade to 3.0.0 or newer.`\n );\n }\n throwOnMissingReanimated2();\n}\n\nexport const useSharedValue =\n Reanimated2?.useSharedValue ||\n ((value: number) => useMemo(() => ({ value }), [value]));\n\nexport const startMapper =\n Reanimated2?.startMapper || throwOnMissingReanimated2;\nexport const stopMapper = Reanimated2?.stopMapper || throwOnMissingReanimated2;\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated2;\nexport const isSharedValue = <T>(\n value: unknown\n): value is SharedValueType<T> => {\n throwOnMissingReanimated3();\n return !!value && Reanimated3.isSharedValue(value);\n};\n"],"mappings":";;AAAA,SAASA,OAAT,QAAwB,OAAxB;AAIA;AACA;AACA;AACA,IAAIC,WAAJ,C,CACA;;AACA,IAAIC,WAAJ;AACA,IAAIC,iBAAJ;;AAEA,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAD,CAArB;EACAD,iBAAiB,GACf;EACAC,OAAO,CAAC,sCAAD,CAAP,CAAgDC,OAFlD;;EAGA,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAArB,IAAgCA,iBAAiB,CAACG,QAAlB,CAA2B,QAA3B,CADhB,CADnB,EAGE;IACAJ,WAAW,GAAGD,WAAd;EACD;AACF,CAXD,CAWE,OAAOM,CAAP,EAAU,CAAE;;AAEd,OAAO,MAAMC,eAAe,GAAG,CAAC,CAACP,WAA1B;AACP,OAAO,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAA1B;;AAEP,SAASQ,yBAAT,GAAqC;EACnC,IAAI,CAACF,eAAL,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CACJ;AACN,iDAFU,CAAN;EAID;AACF;;AAED,SAASC,yBAAT,GAAqC;EACnC,IAAI,CAACH,eAAL,EAAsB;IACpB,MAAM,IAAIE,KAAJ,CACH,sBAAqBR,iBAAkB,sDADpC,CAAN;EAGD;;EACDO,yBAAyB;AAC1B;;AAED,OAAO,MAAMG,cAAc,GACzB,gBAAAZ,WAAW,UAAX,kDAAaY,cAAb,MACEC,KAAD,IAAmBd,OAAO,CAAC,OAAO;EAAEc;AAAF,CAAP,CAAD,EAAoB,CAACA,KAAD,CAApB,CAD3B,CADK;AAIP,OAAO,MAAMC,WAAW,GACtB,iBAAAd,WAAW,UAAX,oDAAac,WAAb,KAA4BL,yBADvB;AAEP,OAAO,MAAMM,UAAU,GAAG,iBAAAf,WAAW,UAAX,oDAAae,UAAb,KAA2BN,yBAA9C;AACP,OAAO,MAAMO,OAAO,GAAG,iBAAAhB,WAAW,UAAX,oDAAagB,OAAb,KAAwBP,yBAAxC;AACP,OAAO,MAAMQ,aAAa,GACxBJ,KAD2B,IAEK;EAChCF,yBAAyB;EACzB,OAAO,CAAC,CAACE,KAAF,IAAWZ,WAAW,CAACgB,aAAZ,CAA0BJ,KAA1B,CAAlB;AACD,CALM"}
@@ -4,5 +4,5 @@ import type { FontStyle } from "./Font";
4
4
  export interface SkFontMgr extends SkJSIInstance<"FontMgr"> {
5
5
  countFamilies(): number;
6
6
  getFamilyName(index: number): string;
7
- matchFamilyStyle(name: string, style: FontStyle): SkTypeface;
7
+ matchFamilyStyle(name?: string, style?: FontStyle): SkTypeface;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["FontMgr.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkTypeface } from \"../Typeface\";\n\nimport type { FontStyle } from \"./Font\";\n\nexport interface SkFontMgr extends SkJSIInstance<\"FontMgr\"> {\n countFamilies(): number;\n getFamilyName(index: number): string;\n matchFamilyStyle(name: string, style: FontStyle): SkTypeface;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["FontMgr.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { SkTypeface } from \"../Typeface\";\n\nimport type { FontStyle } from \"./Font\";\n\nexport interface SkFontMgr extends SkJSIInstance<\"FontMgr\"> {\n countFamilies(): number;\n getFamilyName(index: number): string;\n matchFamilyStyle(name?: string, style?: FontStyle): SkTypeface;\n}\n"],"mappings":""}
@@ -1,2 +1,11 @@
1
1
  import type { SkJSIInstance } from "../JsiInstance";
2
- export declare type SkTypeface = SkJSIInstance<"Typeface">;
2
+ export interface SkTypeface extends SkJSIInstance<"Typeface"> {
3
+ /**
4
+ * Retrieves the glyph ids for each code point in the provided string. This call is passed to
5
+ * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces
6
+ * may have different ids for the same code point.
7
+ * @param str
8
+ * @param numCodePoints - the number of code points in the string. Defaults to str.length.
9
+ */
10
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
11
+ }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["Typeface.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport type SkTypeface = SkJSIInstance<\"Typeface\">;\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["Typeface.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\n\nexport interface SkTypeface extends SkJSIInstance<\"Typeface\"> {\n /**\n * Retrieves the glyph ids for each code point in the provided string. This call is passed to\n * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces\n * may have different ids for the same code point.\n * @param str\n * @param numCodePoints - the number of code points in the string. Defaults to str.length.\n */\n getGlyphIDs(str: string, numCodePoints?: number): number[];\n}\n"],"mappings":""}
@@ -5,5 +5,6 @@ export declare class JsiSkTypeface extends HostObject<Typeface, "Typeface"> impl
5
5
  constructor(CanvasKit: CanvasKit, ref: Typeface);
6
6
  get bold(): boolean;
7
7
  get italic(): boolean;
8
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
8
9
  dispose: () => void;
9
10
  }
@@ -20,5 +20,9 @@ export class JsiSkTypeface extends HostObject {
20
20
  return false;
21
21
  }
22
22
 
23
+ getGlyphIDs(str, numCodePoints) {
24
+ return Array.from(this.ref.getGlyphIDs(str, numCodePoints));
25
+ }
26
+
23
27
  }
24
28
  //# sourceMappingURL=JsiSkTypeface.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["HostObject","JsiSkTypeface","constructor","CanvasKit","ref","delete","bold","console","warn","italic"],"sources":["JsiSkTypeface.ts"],"sourcesContent":["import type { CanvasKit, Typeface } from \"canvaskit-wasm\";\n\nimport type { SkTypeface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkTypeface\n extends HostObject<Typeface, \"Typeface\">\n implements SkTypeface\n{\n constructor(CanvasKit: CanvasKit, ref: Typeface) {\n super(CanvasKit, ref, \"Typeface\");\n }\n\n get bold(): boolean {\n console.warn(\n \"Typeface.bold is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n get italic(): boolean {\n console.warn(\n \"Typeface.italic is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n dispose = () => {\n this.ref.delete();\n };\n}\n"],"mappings":";;AAIA,SAASA,UAAT,QAA2B,QAA3B;AAEA,OAAO,MAAMC,aAAN,SACGD,UADH,CAGP;EACEE,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAsC;IAC/C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,UAAtB;;IAD+C,iCAkBvC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CApBgD;EAEhD;;EAEO,IAAJC,IAAI,GAAY;IAClBC,OAAO,CAACC,IAAR,CACE,sGADF;IAGA,OAAO,KAAP;EACD;;EAES,IAANC,MAAM,GAAY;IACpBF,OAAO,CAACC,IAAR,CACE,wGADF;IAGA,OAAO,KAAP;EACD;;AAjBH"}
1
+ {"version":3,"names":["HostObject","JsiSkTypeface","constructor","CanvasKit","ref","delete","bold","console","warn","italic","getGlyphIDs","str","numCodePoints","Array","from"],"sources":["JsiSkTypeface.ts"],"sourcesContent":["import type { CanvasKit, Typeface } from \"canvaskit-wasm\";\n\nimport type { SkTypeface } from \"../types\";\n\nimport { HostObject } from \"./Host\";\n\nexport class JsiSkTypeface\n extends HostObject<Typeface, \"Typeface\">\n implements SkTypeface\n{\n constructor(CanvasKit: CanvasKit, ref: Typeface) {\n super(CanvasKit, ref, \"Typeface\");\n }\n\n get bold(): boolean {\n console.warn(\n \"Typeface.bold is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n get italic(): boolean {\n console.warn(\n \"Typeface.italic is deprecated and will be removed in a future release. The property will return false.\"\n );\n return false;\n }\n\n getGlyphIDs(str: string, numCodePoints?: number) {\n return Array.from(this.ref.getGlyphIDs(str, numCodePoints));\n }\n\n dispose = () => {\n this.ref.delete();\n };\n}\n"],"mappings":";;AAIA,SAASA,UAAT,QAA2B,QAA3B;AAEA,OAAO,MAAMC,aAAN,SACGD,UADH,CAGP;EACEE,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAsC;IAC/C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,UAAtB;;IAD+C,iCAsBvC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAxBgD;EAEhD;;EAEO,IAAJC,IAAI,GAAY;IAClBC,OAAO,CAACC,IAAR,CACE,sGADF;IAGA,OAAO,KAAP;EACD;;EAES,IAANC,MAAM,GAAY;IACpBF,OAAO,CAACC,IAAR,CACE,wGADF;IAGA,OAAO,KAAP;EACD;;EAEDE,WAAW,CAACC,GAAD,EAAcC,aAAd,EAAsC;IAC/C,OAAOC,KAAK,CAACC,IAAN,CAAW,KAAKV,GAAL,CAASM,WAAT,CAAqBC,GAArB,EAA0BC,aAA1B,CAAX,CAAP;EACD;;AArBH"}
@@ -4,5 +4,5 @@ import type { FontStyle } from "./Font";
4
4
  export interface SkFontMgr extends SkJSIInstance<"FontMgr"> {
5
5
  countFamilies(): number;
6
6
  getFamilyName(index: number): string;
7
- matchFamilyStyle(name: string, style: FontStyle): SkTypeface;
7
+ matchFamilyStyle(name?: string, style?: FontStyle): SkTypeface;
8
8
  }
@@ -1,2 +1,11 @@
1
1
  import type { SkJSIInstance } from "../JsiInstance";
2
- export declare type SkTypeface = SkJSIInstance<"Typeface">;
2
+ export interface SkTypeface extends SkJSIInstance<"Typeface"> {
3
+ /**
4
+ * Retrieves the glyph ids for each code point in the provided string. This call is passed to
5
+ * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces
6
+ * may have different ids for the same code point.
7
+ * @param str
8
+ * @param numCodePoints - the number of code points in the string. Defaults to str.length.
9
+ */
10
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
11
+ }
@@ -5,5 +5,6 @@ export declare class JsiSkTypeface extends HostObject<Typeface, "Typeface"> impl
5
5
  constructor(CanvasKit: CanvasKit, ref: Typeface);
6
6
  get bold(): boolean;
7
7
  get italic(): boolean;
8
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
8
9
  dispose: () => void;
9
10
  }
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "0.1.207",
10
+ "version": "0.1.208",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "files": [
@@ -30,7 +30,7 @@ function throwOnMissingReanimated2() {
30
30
  if (!HAS_REANIMATED2) {
31
31
  throw new Error(
32
32
  "Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
33
- react-naitve-skia's integration layer API."
33
+ react-native-skia's integration layer API."
34
34
  );
35
35
  }
36
36
  }
@@ -6,5 +6,5 @@ import type { FontStyle } from "./Font";
6
6
  export interface SkFontMgr extends SkJSIInstance<"FontMgr"> {
7
7
  countFamilies(): number;
8
8
  getFamilyName(index: number): string;
9
- matchFamilyStyle(name: string, style: FontStyle): SkTypeface;
9
+ matchFamilyStyle(name?: string, style?: FontStyle): SkTypeface;
10
10
  }
@@ -1,3 +1,12 @@
1
1
  import type { SkJSIInstance } from "../JsiInstance";
2
2
 
3
- export type SkTypeface = SkJSIInstance<"Typeface">;
3
+ export interface SkTypeface extends SkJSIInstance<"Typeface"> {
4
+ /**
5
+ * Retrieves the glyph ids for each code point in the provided string. This call is passed to
6
+ * the typeface of this font. Note that glyph IDs are typeface-dependent; different faces
7
+ * may have different ids for the same code point.
8
+ * @param str
9
+ * @param numCodePoints - the number of code points in the string. Defaults to str.length.
10
+ */
11
+ getGlyphIDs(str: string, numCodePoints?: number): number[];
12
+ }
@@ -26,6 +26,10 @@ export class JsiSkTypeface
26
26
  return false;
27
27
  }
28
28
 
29
+ getGlyphIDs(str: string, numCodePoints?: number) {
30
+ return Array.from(this.ref.getGlyphIDs(str, numCodePoints));
31
+ }
32
+
29
33
  dispose = () => {
30
34
  this.ref.delete();
31
35
  };