@shopify/react-native-skia 2.4.7 → 2.4.14

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 (117) hide show
  1. package/android/cpp/jni/JniPlatformContext.cpp +1 -1
  2. package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +11 -1
  3. package/apple/RNSkApplePlatformContext.h +4 -0
  4. package/apple/RNSkApplePlatformContext.mm +69 -0
  5. package/apple/SkiaCVPixelBufferUtils.mm +8 -4
  6. package/cpp/api/JsiSkFontMgr.h +30 -6
  7. package/cpp/api/JsiSkImageFilterFactory.h +4 -2
  8. package/cpp/api/JsiSkPictureFactory.h +9 -6
  9. package/cpp/api/recorder/RNRecorder.h +33 -55
  10. package/cpp/rnskia/RNSkPlatformContext.h +16 -0
  11. package/cpp/skia/include/codec/SkAndroidCodec.h +3 -2
  12. package/cpp/skia/include/codec/SkAvifDecoder.h +2 -2
  13. package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
  14. package/cpp/skia/include/codec/SkCodec.h +2 -8
  15. package/cpp/skia/include/codec/SkEncodedOrigin.h +17 -0
  16. package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
  17. package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
  18. package/cpp/skia/include/codec/SkJpegDecoder.h +8 -1
  19. package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
  20. package/cpp/skia/include/codec/SkPngDecoder.h +8 -1
  21. package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
  22. package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
  23. package/cpp/skia/include/codec/SkWebpDecoder.h +8 -1
  24. package/cpp/skia/include/core/SkCPURecorder.h +1 -0
  25. package/cpp/skia/include/core/SkCanvas.h +3 -2
  26. package/cpp/skia/include/core/SkColorTable.h +1 -1
  27. package/cpp/skia/include/core/SkColorType.h +4 -0
  28. package/cpp/skia/include/core/SkDocument.h +1 -1
  29. package/cpp/skia/include/core/SkGraphics.h +7 -2
  30. package/cpp/skia/include/core/SkImage.h +5 -1
  31. package/cpp/skia/include/core/SkImageGenerator.h +5 -3
  32. package/cpp/skia/include/core/SkM44.h +3 -3
  33. package/cpp/skia/include/core/SkMatrix.h +0 -23
  34. package/cpp/skia/include/core/SkMilestone.h +1 -1
  35. package/cpp/skia/include/core/SkOverdrawCanvas.h +1 -1
  36. package/cpp/skia/include/core/SkPath.h +216 -185
  37. package/cpp/skia/include/core/SkPathBuilder.h +97 -47
  38. package/cpp/skia/include/core/SkPathTypes.h +7 -1
  39. package/cpp/skia/include/core/SkPixmap.h +8 -8
  40. package/cpp/skia/include/core/SkRRect.h +24 -3
  41. package/cpp/skia/include/core/SkRecorder.h +3 -1
  42. package/cpp/skia/include/core/SkScalar.h +1 -1
  43. package/cpp/skia/include/core/SkSerialProcs.h +8 -4
  44. package/cpp/skia/include/core/SkStream.h +16 -9
  45. package/cpp/skia/include/core/SkString.h +1 -1
  46. package/cpp/skia/include/core/SkStrokeRec.h +1 -1
  47. package/cpp/skia/include/core/SkYUVAInfo.h +3 -0
  48. package/cpp/skia/include/docs/SkPDFDocument.h +1 -1
  49. package/cpp/skia/include/docs/SkPDFJpegHelpers.h +1 -1
  50. package/cpp/skia/include/docs/SkXPSDocument.h +18 -2
  51. package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -1
  52. package/cpp/skia/include/encode/SkPngRustEncoder.h +18 -0
  53. package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +1 -1
  54. package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +1 -1
  55. package/cpp/skia/include/gpu/ganesh/GrRecordingContext.h +7 -6
  56. package/cpp/skia/include/gpu/ganesh/gl/GrGLBackendSurface.h +6 -0
  57. package/cpp/skia/include/gpu/ganesh/vk/GrBackendDrawableInfo.h +2 -4
  58. package/cpp/skia/include/gpu/graphite/Context.h +15 -1
  59. package/cpp/skia/include/gpu/graphite/ContextOptions.h +52 -11
  60. package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +44 -0
  61. package/cpp/skia/include/gpu/graphite/LogPriority.h +1 -1
  62. package/cpp/skia/include/gpu/graphite/PersistentPipelineStorage.h +45 -0
  63. package/cpp/skia/include/gpu/graphite/PrecompileContext.h +1 -1
  64. package/cpp/skia/include/gpu/graphite/Recorder.h +14 -0
  65. package/cpp/skia/include/gpu/graphite/TextureInfo.h +13 -5
  66. package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +1 -4
  67. package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -4
  68. package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +2 -8
  69. package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
  70. package/cpp/skia/include/gpu/vk/VulkanTypes.h +124 -9
  71. package/cpp/skia/include/ports/SkFontMgr_fuchsia.h +3 -1
  72. package/cpp/skia/include/ports/SkImageGeneratorCG.h +1 -1
  73. package/cpp/skia/include/ports/SkImageGeneratorNDK.h +1 -1
  74. package/cpp/skia/include/ports/SkImageGeneratorWIC.h +1 -1
  75. package/cpp/skia/include/ports/SkTypeface_fontations.h +1 -1
  76. package/cpp/skia/include/private/SkEncodedInfo.h +38 -29
  77. package/cpp/skia/include/private/SkJpegMetadataDecoder.h +18 -13
  78. package/cpp/skia/include/private/SkPathRef.h +3 -6
  79. package/cpp/skia/include/private/base/SkAlign.h +3 -7
  80. package/cpp/skia/include/private/base/SkContainers.h +1 -1
  81. package/cpp/skia/include/private/base/SkSpan_impl.h +29 -0
  82. package/cpp/skia/include/private/base/SkTArray.h +7 -8
  83. package/cpp/skia/include/private/base/SkTDArray.h +4 -4
  84. package/cpp/skia/include/private/base/SkTemplates.h +5 -5
  85. package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +1 -1
  86. package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +1 -1
  87. package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
  88. package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +6 -5
  89. package/cpp/skia/include/svg/SkSVGCanvas.h +21 -1
  90. package/cpp/skia/include/utils/SkNoDrawCanvas.h +1 -1
  91. package/cpp/skia/include/utils/SkPaintFilterCanvas.h +1 -1
  92. package/cpp/skia/modules/skcms/src/skcms_public.h +29 -4
  93. package/cpp/skia/modules/skottie/include/Skottie.h +11 -0
  94. package/cpp/skia/modules/skottie/include/SlotManager.h +1 -1
  95. package/cpp/skia/modules/skparagraph/include/Metrics.h +1 -1
  96. package/cpp/skia/modules/skparagraph/include/Paragraph.h +1 -1
  97. package/cpp/skia/modules/sksg/include/SkSGMerge.h +1 -1
  98. package/cpp/skia/modules/sksg/include/SkSGPath.h +1 -1
  99. package/cpp/skia/modules/skshaper/include/SkShaper.h +2 -0
  100. package/cpp/skia/modules/skunicode/include/SkUnicode.h +4 -4
  101. package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +1 -1
  102. package/cpp/skia/modules/svg/include/SkSVGFeComponentTransfer.h +1 -1
  103. package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
  104. package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
  105. package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
  106. package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
  107. package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
  108. package/lib/commonjs/skia/core/Font.js +7 -1
  109. package/lib/commonjs/skia/core/Font.js.map +1 -1
  110. package/lib/module/skia/core/Font.js +7 -1
  111. package/lib/module/skia/core/Font.js.map +1 -1
  112. package/lib/typescript/lib/commonjs/skia/core/Font.d.ts +1 -1
  113. package/lib/typescript/lib/module/mock/index.d.ts +1 -1
  114. package/lib/typescript/lib/module/skia/core/Font.d.ts +1 -1
  115. package/package.json +8 -8
  116. package/scripts/install-skia.mjs +74 -1
  117. package/src/skia/core/Font.ts +9 -4
@@ -30,7 +30,7 @@ public:
30
30
  protected:
31
31
  friend class GrImageContextPriv; // for hidden functions
32
32
 
33
- GrImageContext(sk_sp<GrContextThreadSafeProxy>);
33
+ explicit GrImageContext(sk_sp<GrContextThreadSafeProxy>);
34
34
 
35
35
  SK_API virtual void abandonContext();
36
36
  SK_API virtual bool abandoned();
@@ -367,21 +367,21 @@ enum class GrClipEdgeType {
367
367
  };
368
368
  static const int kGrClipEdgeTypeCnt = (int) GrClipEdgeType::kLast + 1;
369
369
 
370
- static constexpr bool GrClipEdgeTypeIsFill(const GrClipEdgeType edgeType) {
370
+ static constexpr bool GrClipEdgeTypeIsFill(GrClipEdgeType edgeType) {
371
371
  return (GrClipEdgeType::kFillAA == edgeType || GrClipEdgeType::kFillBW == edgeType);
372
372
  }
373
373
 
374
- static constexpr bool GrClipEdgeTypeIsInverseFill(const GrClipEdgeType edgeType) {
374
+ static constexpr bool GrClipEdgeTypeIsInverseFill(GrClipEdgeType edgeType) {
375
375
  return (GrClipEdgeType::kInverseFillAA == edgeType ||
376
376
  GrClipEdgeType::kInverseFillBW == edgeType);
377
377
  }
378
378
 
379
- static constexpr bool GrClipEdgeTypeIsAA(const GrClipEdgeType edgeType) {
379
+ static constexpr bool GrClipEdgeTypeIsAA(GrClipEdgeType edgeType) {
380
380
  return (GrClipEdgeType::kFillBW != edgeType &&
381
381
  GrClipEdgeType::kInverseFillBW != edgeType);
382
382
  }
383
383
 
384
- static inline GrClipEdgeType GrInvertClipEdgeType(const GrClipEdgeType edgeType) {
384
+ static inline GrClipEdgeType GrInvertClipEdgeType(GrClipEdgeType edgeType) {
385
385
  switch (edgeType) {
386
386
  case GrClipEdgeType::kFillBW:
387
387
  return GrClipEdgeType::kInverseFillBW;
@@ -620,7 +620,7 @@ static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct) {
620
620
  case GrColorType::kRG_F16: return kR16G16_float_SkColorType;
621
621
  case GrColorType::kRGB_888: return kUnknown_SkColorType;
622
622
  case GrColorType::kR_8: return kR8_unorm_SkColorType;
623
- case GrColorType::kR_16: return kUnknown_SkColorType;
623
+ case GrColorType::kR_16: return kR16_unorm_SkColorType;
624
624
  case GrColorType::kR_F16: return kUnknown_SkColorType;
625
625
  case GrColorType::kGray_F16: return kUnknown_SkColorType;
626
626
  case GrColorType::kARGB_4444: return kUnknown_SkColorType;
@@ -653,6 +653,7 @@ static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct) {
653
653
  case kRGBA_F32_SkColorType: return GrColorType::kRGBA_F32;
654
654
  case kR8G8_unorm_SkColorType: return GrColorType::kRG_88;
655
655
  case kA16_unorm_SkColorType: return GrColorType::kAlpha_16;
656
+ case kR16_unorm_SkColorType: return GrColorType::kR_16;
656
657
  case kR16G16_unorm_SkColorType: return GrColorType::kRG_1616;
657
658
  case kA16_float_SkColorType: return GrColorType::kAlpha_F16;
658
659
  case kR16G16_float_SkColorType: return GrColorType::kRG_F16;
@@ -15,16 +15,33 @@
15
15
 
16
16
  class SkCanvas;
17
17
  class SkWStream;
18
+ class SkPixmap;
18
19
  struct SkRect;
19
20
 
20
21
  class SK_API SkSVGCanvas {
21
22
  public:
22
- enum {
23
+ enum Flags {
23
24
  kConvertTextToPaths_Flag = 0x01, // emit text as <path>s
24
25
  kNoPrettyXML_Flag = 0x02, // suppress newlines and tabs in output
25
26
  kRelativePathEncoding_Flag = 0x04, // use relative commands for path encoding
26
27
  };
27
28
 
29
+ using EncodePngCallback = bool (*)(SkWStream* dst, const SkPixmap& src);
30
+
31
+ struct Options {
32
+ Flags flags = static_cast<Flags>(0x00);
33
+
34
+ /** Clients can provide a way to encode png.
35
+ *
36
+ * If `pngEncoder` is null and `SK_DISABLE_LEGACY_SVG_FACTORIES` isn't
37
+ * set then this will be (temporarily, until the legacy mode is
38
+ * removed) filled based on presence of
39
+ * `SK_CODEC_ENCODES_PNG_WITH_RUST` and/or
40
+ * `SK_CODEC_ENCODES_PNG_WITH_LIBPNG`.
41
+ */
42
+ EncodePngCallback pngEncoder = nullptr;
43
+ };
44
+
28
45
  /**
29
46
  * Returns a new canvas that will generate SVG commands from its draw calls, and send
30
47
  * them to the provided stream. Ownership of the stream is not transfered, and it must
@@ -36,7 +53,10 @@ public:
36
53
  * The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root
37
54
  * SVG element).
38
55
  */
56
+ static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*, Options opts);
57
+ #if !defined(SK_DISABLE_LEGACY_SVG_FACTORIES)
39
58
  static std::unique_ptr<SkCanvas> Make(const SkRect& bounds, SkWStream*, uint32_t flags = 0);
59
+ #endif
40
60
  };
41
61
 
42
62
  #endif
@@ -24,7 +24,7 @@ struct SkIRect;
24
24
  class SK_API SkNoDrawCanvas : public SkCanvasVirtualEnforcer<SkCanvas> {
25
25
  public:
26
26
  SkNoDrawCanvas(int width, int height);
27
- SkNoDrawCanvas(const SkIRect&);
27
+ explicit SkNoDrawCanvas(const SkIRect&);
28
28
 
29
29
  // Optimization to reset state to be the same as after construction.
30
30
  void resetCanvas(int w, int h) { this->resetForNextPicture(SkIRect::MakeWH(w, h)); }
@@ -57,7 +57,7 @@ public:
57
57
  * The new SkPaintFilterCanvas is configured for forwarding to the
58
58
  * specified canvas. Also copies the target canvas matrix and clip bounds.
59
59
  */
60
- SkPaintFilterCanvas(SkCanvas* canvas);
60
+ explicit SkPaintFilterCanvas(SkCanvas* canvas);
61
61
 
62
62
  enum Type {
63
63
  kPicture_Type,
@@ -9,8 +9,33 @@
9
9
 
10
10
  // skcms_public.h contains the entire public API for skcms.
11
11
 
12
- #ifndef SKCMS_API
13
- #define SKCMS_API
12
+ // Modeled after the FOX example in https://gcc.gnu.org/wiki/Visibility
13
+ #if !defined(SKCMS_API)
14
+ // Client has opted in to building skcms as part of a DLL/shared object file.
15
+ #if defined(SKCMS_DLL)
16
+ // If on Windows (MSVC or Clang pretending to be MSVC)
17
+ #if defined(_MSC_VER)
18
+ // Client needs to set this when compiling the skcms files (but *not* when compiling
19
+ // other files which use the headers). In GN, this is handled with non-public configs.
20
+ // With Bazel, this can be implemented with local_defines.
21
+ #if defined(SKCMS_IMPLEMENTATION)
22
+ // If SKCMS is being built as a standalone DLL, it must be explicitly exported
23
+ // https://learn.microsoft.com/en-us/cpp/cpp/dllexport-dllimport?view=msvc-170
24
+ #define SKCMS_API __declspec(dllexport)
25
+ #else
26
+ // If a client is compiling and using the skcms header, this is an optimization
27
+ // to skip some indirection when resolving the function call.
28
+ // https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-6.0/aa271769(v=vs.60)
29
+ #define SKCMS_API __declspec(dllimport)
30
+ #endif
31
+ #else
32
+ // On non-Windows platforms, we make sure the symbols are visible outside the
33
+ // shared object file.
34
+ #define SKCMS_API __attribute__((visibility("default")))
35
+ #endif
36
+ #else
37
+ #define SKCMS_API
38
+ #endif
14
39
  #endif
15
40
 
16
41
  #include <stdbool.h>
@@ -298,7 +323,7 @@ SKCMS_API bool skcms_GetWTPT(const skcms_ICCProfile*, float xyz[3]);
298
323
  SKCMS_API int skcms_GetInputChannelCount(const skcms_ICCProfile*);
299
324
 
300
325
  // These are common ICC signature values
301
- enum {
326
+ typedef enum skcms_Signature {
302
327
  // common data_color_space values
303
328
  skcms_Signature_CMYK = 0x434D594B,
304
329
  skcms_Signature_Gray = 0x47524159,
@@ -329,7 +354,7 @@ enum {
329
354
  skcms_Signature_13CLR = 0x44434C52,
330
355
  skcms_Signature_14CLR = 0x45434C52,
331
356
  skcms_Signature_15CLR = 0x46434C52,
332
- };
357
+ } skcms_Signature;
333
358
 
334
359
  typedef enum skcms_PixelFormat {
335
360
  skcms_PixelFormat_A_8,
@@ -11,6 +11,7 @@
11
11
  #include "include/core/SkRefCnt.h"
12
12
  #include "include/core/SkScalar.h"
13
13
  #include "include/core/SkSize.h"
14
+ #include "include/core/SkSpan.h"
14
15
  #include "include/core/SkString.h"
15
16
  #include "include/core/SkTypes.h"
16
17
  #include "modules/skresources/include/SkResources.h"
@@ -45,6 +46,13 @@ namespace internal { class Animator; }
45
46
  using ImageAsset = skresources::ImageAsset;
46
47
  using ResourceProvider = skresources::ResourceProvider;
47
48
 
49
+ struct LayerInfo {
50
+ SkString fName;
51
+ SkSize fSize;
52
+ const float fInPoint,
53
+ fOutPoint;
54
+ };
55
+
48
56
  /**
49
57
  * A Logger subclass can be used to receive Animation::Builder parsing errors and warnings.
50
58
  */
@@ -181,6 +189,8 @@ public:
181
189
  */
182
190
  const sk_sp<SlotManager>& getSlotManager() const {return fSlotManager;}
183
191
 
192
+ SkSpan<const LayerInfo> getLayerInfo() const {return SkSpan(fLayerInfo);}
193
+
184
194
  private:
185
195
  const uint32_t fFlags;
186
196
 
@@ -194,6 +204,7 @@ public:
194
204
  sk_sp<SkShapers::Factory> fShapingFactory;
195
205
  sk_sp<SlotManager> fSlotManager;
196
206
  Stats fStats;
207
+ std::vector<LayerInfo> fLayerInfo;
197
208
  };
198
209
 
199
210
  /**
@@ -42,7 +42,7 @@ class SK_API SlotManager final : public SkRefCnt {
42
42
  public:
43
43
  using SlotID = SkString;
44
44
 
45
- SlotManager(sk_sp<skottie::internal::SceneGraphRevalidator>);
45
+ explicit SlotManager(sk_sp<skottie::internal::SceneGraphRevalidator>);
46
46
  ~SlotManager() override;
47
47
 
48
48
  bool setColorSlot(const SlotID&, SkColor);
@@ -9,7 +9,7 @@ namespace skia {
9
9
  namespace textlayout {
10
10
  class StyleMetrics {
11
11
  public:
12
- StyleMetrics(const TextStyle* style) : text_style(style) {}
12
+ explicit StyleMetrics(const TextStyle* style) : text_style(style) {}
13
13
 
14
14
  StyleMetrics(const TextStyle* style, SkFontMetrics& metrics)
15
15
  : text_style(style), font_metrics(metrics) {}
@@ -241,7 +241,7 @@ public:
241
241
  virtual bool getClosestUTF16GlyphInfoAt(SkScalar dx, SkScalar dy, GlyphInfo* glyphInfo) = 0;
242
242
 
243
243
  struct FontInfo {
244
- FontInfo(const SkFont& font, const TextRange textRange)
244
+ FontInfo(const SkFont& font, const TextRange& textRange)
245
245
  : fFont(font), fTextRange(textRange) {}
246
246
  virtual ~FontInfo() = default;
247
247
  FontInfo(const FontInfo& ) = default;
@@ -61,7 +61,7 @@ protected:
61
61
  SkPath onAsPath() const override;
62
62
 
63
63
  private:
64
- Merge(std::vector<Rec>&& recs);
64
+ explicit Merge(std::vector<Rec>&& recs);
65
65
 
66
66
  const std::vector<Rec> fRecs;
67
67
  SkPath fMerged;
@@ -26,7 +26,7 @@ class InvalidationController;
26
26
  /**
27
27
  * Concrete Geometry node, wrapping an SkPath.
28
28
  */
29
- class Path : public GeometryNode {
29
+ class Path final : public GeometryNode {
30
30
  public:
31
31
  static sk_sp<Path> Make() { return sk_sp<Path>(new Path(SkPath())); }
32
32
  static sk_sp<Path> Make(const SkPath& r) { return sk_sp<Path>(new Path(r)); }
@@ -209,6 +209,8 @@ public:
209
209
  struct RunInfo {
210
210
  const SkFont& fFont;
211
211
  uint8_t fBidiLevel;
212
+ SkFourByteTag fScript;
213
+ const char* fLanguage;
212
214
  SkVector fAdvance;
213
215
  size_t glyphCount;
214
216
  Range utf8Range;
@@ -200,15 +200,15 @@ class SKUNICODE_API SkUnicode : public SkRefCnt {
200
200
  static bool extractUtfConversionMapping(SkSpan<const char> utf8, Appender8&& appender8, Appender16&& appender16) {
201
201
  size_t size8 = 0;
202
202
  size_t size16 = 0;
203
- auto ptr = utf8.begin();
204
- auto end = utf8.end();
203
+ auto ptr = utf8.data();
204
+ auto end = ptr + utf8.size();
205
205
  while (ptr < end) {
206
206
 
207
- size_t index = SkToSizeT(ptr - utf8.begin());
207
+ size_t index = SkToSizeT(ptr - utf8.data());
208
208
  SkUnichar u = SkUTF::NextUTF8(&ptr, end);
209
209
 
210
210
  // All UTF8 code units refer to the same codepoint
211
- size_t next = SkToSizeT(ptr - utf8.begin());
211
+ size_t next = SkToSizeT(ptr - utf8.data());
212
212
  for (auto i = index; i < next; ++i) {
213
213
  //fUTF16IndexForUTF8Index.emplace_back(fUTF8IndexForUTF16Index.size());
214
214
  appender16(size8);
@@ -25,7 +25,7 @@ class SkString;
25
25
 
26
26
  class SkSVGAttributeParser : public SkNoncopyable {
27
27
  public:
28
- SkSVGAttributeParser(const char[]);
28
+ explicit SkSVGAttributeParser(const char[]);
29
29
 
30
30
  bool parseInteger(SkSVGIntegerType*);
31
31
  bool parseViewBox(SkSVGViewBoxType*);
@@ -54,7 +54,7 @@ protected:
54
54
  bool parseAndSetAttribute(const char*, const char*) override;
55
55
 
56
56
  private:
57
- SkSVGFeFunc(SkSVGTag tag) : INHERITED(tag) {}
57
+ explicit SkSVGFeFunc(SkSVGTag tag) : SkSVGHiddenContainer(tag) {}
58
58
 
59
59
  using INHERITED = SkSVGHiddenContainer;
60
60
  };
@@ -159,7 +159,7 @@ public:
159
159
  SVG_PRES_ATTR(LightingColor , SkSVGColor , false)
160
160
 
161
161
  protected:
162
- SkSVGNode(SkSVGTag);
162
+ explicit SkSVGNode(SkSVGTag);
163
163
 
164
164
  static SkMatrix ComputeViewboxMatrix(const SkRect&, const SkRect&, SkSVGPreserveAspectRatio);
165
165
 
@@ -46,7 +46,7 @@ protected:
46
46
  SkRect onTransformableObjectBoundingBox(const SkSVGRenderContext&) const override;
47
47
 
48
48
  private:
49
- SkSVGPoly(SkSVGTag);
49
+ explicit SkSVGPoly(SkSVGTag);
50
50
 
51
51
  mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types.
52
52
 
@@ -26,7 +26,7 @@ public:
26
26
  void appendChild(sk_sp<SkSVGNode>) override;
27
27
 
28
28
  protected:
29
- SkSVGShape(SkSVGTag);
29
+ explicit SkSVGShape(SkSVGTag);
30
30
 
31
31
  void onRender(const SkSVGRenderContext&) const final;
32
32
 
@@ -24,7 +24,7 @@ public:
24
24
  void setTransform(const SkSVGTransformType& t) { fTransform = t; }
25
25
 
26
26
  protected:
27
- SkSVGTransformableNode(SkSVGTag);
27
+ explicit SkSVGTransformableNode(SkSVGTag);
28
28
 
29
29
  bool onPrepareToRender(SkSVGRenderContext*) const override;
30
30
 
@@ -38,7 +38,7 @@ public:
38
38
  }
39
39
 
40
40
  protected:
41
- SkSVGValue(Type t) : fType(t) { }
41
+ explicit SkSVGValue(Type t) : fType(t) {}
42
42
 
43
43
  private:
44
44
  Type fType;
@@ -66,7 +66,13 @@ const matchFont = (inputStyle = {}, fontMgr = _Skia.Skia.FontMgr.System()) => {
66
66
  return _Skia.Skia.Font(typeface, fontStyle.fontSize);
67
67
  };
68
68
  exports.matchFont = matchFont;
69
- const listFontFamilies = (fontMgr = _Skia.Skia.FontMgr.System()) => new Array(fontMgr.countFamilies()).fill(0).map((_, i) => fontMgr.getFamilyName(i));
69
+ const listFontFamilies = (fontMgr = _Skia.Skia.FontMgr.System()) => {
70
+ const families = new Set();
71
+ for (let i = 0; i < fontMgr.countFamilies(); i++) {
72
+ families.add(fontMgr.getFamilyName(i));
73
+ }
74
+ return Array.from(families);
75
+ };
70
76
  exports.listFontFamilies = listFontFamilies;
71
77
  const loadTypefaces = typefacesToLoad => {
72
78
  const promises = Object.keys(typefacesToLoad).flatMap(familyName => {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_Skia","_types","_Platform","_Typeface","defaultFontSize","useFont","font","size","onError","typeface","useTypeface","useMemo","Skia","Font","exports","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","FontSlant","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","Array","countFamilies","fill","map","_","i","getFamilyName","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","typefaceToLoad","Data","fromURI","Platform","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","useState","useEffect","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\n\nimport { useTypeface } from \"./Typeface\";\n\nconst defaultFontSize = 14;\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size = defaultFontSize,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface) {\n return Skia.Font(typeface, size);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: defaultFontSize,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (fontMgr: SkFontMgr = Skia.FontMgr.System()) =>\n new Array(fontMgr.countFamilies())\n .fill(0)\n .map((_, i) => fontMgr.getFamilyName(i));\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n });\n setFontMgr(fMgr);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return fontMgr;\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAGA,IAAAI,SAAA,GAAAJ,OAAA;AATA;;AAWA,MAAMK,eAAe,GAAG,EAAE;;AAE1B;AACA;AACA;AACO,MAAMC,OAAO,GAAGA,CACrBC,IAAqB,EACrBC,IAAI,GAAGH,eAAe,EACtBI,OAA8B,KAC3B;EACH,MAAMC,QAAQ,GAAG,IAAAC,qBAAW,EAACJ,IAAI,EAAEE,OAAO,CAAC;EAC3C,OAAO,IAAAG,cAAO,EAAC,MAAM;IACnB,IAAIF,QAAQ,EAAE;MACZ,OAAOG,UAAI,CAACC,IAAI,CAACJ,QAAQ,EAAEF,IAAI,CAAC;IAClC,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF,CAAC,EAAE,CAACA,IAAI,EAAEE,QAAQ,CAAC,CAAC;AAC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,IAAK;MACtC,MAAMC,IAAI,GAAG1D,UAAI,CAAC2D,oBAAoB,CAACC,IAAI,CAAC,CAAC;MAC7CH,MAAM,CAACI,OAAO,CAAC,CAAC,CAACvB,UAAU,EAAEzC,QAAQ,CAAC,KAAK;QACzC6D,IAAI,CAACI,YAAY,CAACjE,QAAQ,EAAEyC,UAAU,CAAC;MACzC,CAAC,CAAC;MACFgB,UAAU,CAACI,IAAI,CAAC;IAClB,CAAC,CAAC;IACF;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAOxC,OAAO;AAChB,CAAC;AAAChB,OAAA,CAAAkD,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_Skia","_types","_Platform","_Typeface","defaultFontSize","useFont","font","size","onError","typeface","useTypeface","useMemo","Skia","Font","exports","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","FontSlant","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","families","Set","i","countFamilies","add","getFamilyName","Array","from","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","map","typefaceToLoad","Data","fromURI","Platform","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","useState","useEffect","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\n\nimport { useTypeface } from \"./Typeface\";\n\nconst defaultFontSize = 14;\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size = defaultFontSize,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface) {\n return Skia.Font(typeface, size);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: defaultFontSize,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const families = new Set<string>();\n for (let i = 0; i < fontMgr.countFamilies(); i++) {\n families.add(fontMgr.getFamilyName(i));\n }\n return Array.from(families);\n};\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n });\n setFontMgr(fMgr);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return fontMgr;\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAGA,IAAAI,SAAA,GAAAJ,OAAA;AATA;;AAWA,MAAMK,eAAe,GAAG,EAAE;;AAE1B;AACA;AACA;AACO,MAAMC,OAAO,GAAGA,CACrBC,IAAqB,EACrBC,IAAI,GAAGH,eAAe,EACtBI,OAA8B,KAC3B;EACH,MAAMC,QAAQ,GAAG,IAAAC,qBAAW,EAACJ,IAAI,EAAEE,OAAO,CAAC;EAC3C,OAAO,IAAAG,cAAO,EAAC,MAAM;IACnB,IAAIF,QAAQ,EAAE;MACZ,OAAOG,UAAI,CAACC,IAAI,CAACJ,QAAQ,EAAEF,IAAI,CAAC;IAClC,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF,CAAC,EAAE,CAACA,IAAI,EAAEE,QAAQ,CAAC,CAAC;AACtB,CAAC;AAACK,OAAA,CAAAT,OAAA,GAAAA,OAAA;AAuBF,MAAMU,gBAA6B,GAAG;EACpCC,UAAU,EAAE,QAAQ;EACpBC,QAAQ,EAAEb,eAAe;EACzBc,SAAS,EAAE,QAAQ;EACnBC,UAAU,EAAE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B,CAACC,IAAI,CAAC,CAAC;MAC7CH,MAAM,CAACI,OAAO,CAAC,CAAC,CAACxB,UAAU,EAAE1C,QAAQ,CAAC,KAAK;QACzC+D,IAAI,CAACI,YAAY,CAACnE,QAAQ,EAAE0C,UAAU,CAAC;MACzC,CAAC,CAAC;MACFiB,UAAU,CAACI,IAAI,CAAC;IAClB,CAAC,CAAC;IACF;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAO1C,OAAO;AAChB,CAAC;AAAChB,OAAA,CAAAoD,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -57,7 +57,13 @@ export const matchFont = (inputStyle = {}, fontMgr = Skia.FontMgr.System()) => {
57
57
  const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);
58
58
  return Skia.Font(typeface, fontStyle.fontSize);
59
59
  };
60
- export const listFontFamilies = (fontMgr = Skia.FontMgr.System()) => new Array(fontMgr.countFamilies()).fill(0).map((_, i) => fontMgr.getFamilyName(i));
60
+ export const listFontFamilies = (fontMgr = Skia.FontMgr.System()) => {
61
+ const families = new Set();
62
+ for (let i = 0; i < fontMgr.countFamilies(); i++) {
63
+ families.add(fontMgr.getFamilyName(i));
64
+ }
65
+ return Array.from(families);
66
+ };
61
67
  const loadTypefaces = typefacesToLoad => {
62
68
  const promises = Object.keys(typefacesToLoad).flatMap(familyName => {
63
69
  return typefacesToLoad[familyName].map(typefaceToLoad => {
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useMemo","useState","Skia","FontSlant","Platform","useTypeface","defaultFontSize","useFont","font","size","onError","typeface","Font","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","Array","countFamilies","fill","map","_","i","getFamilyName","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","typefaceToLoad","Data","fromURI","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\n\nimport { useTypeface } from \"./Typeface\";\n\nconst defaultFontSize = 14;\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size = defaultFontSize,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface) {\n return Skia.Font(typeface, size);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: defaultFontSize,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (fontMgr: SkFontMgr = Skia.FontMgr.System()) =>\n new Array(fontMgr.countFamilies())\n .fill(0)\n .map((_, i) => fontMgr.getFamilyName(i));\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n });\n setFontMgr(fMgr);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return fontMgr;\n};\n"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,SAAS,QAAQ,UAAU;AAEpC,SAASC,QAAQ,QAAQ,gBAAgB;AAGzC,SAASC,WAAW,QAAQ,YAAY;AAExC,MAAMC,eAAe,GAAG,EAAE;;AAE1B;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAGA,CACrBC,IAAqB,EACrBC,IAAI,GAAGH,eAAe,EACtBI,OAA8B,KAC3B;EACH,MAAMC,QAAQ,GAAGN,WAAW,CAACG,IA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CAAC,GAAG7D,QAAQ,CAAgC,IAAI,CAAC;EAE3EF,SAAS,CAAC,MAAM;IACd0C,aAAa,CAACoB,OAAO,CAAC,CAACT,IAAI,CAAEW,MAAM,IAAK;MACtC,MAAMC,IAAI,GAAG9D,IAAI,CAAC+D,oBAAoB,CAACC,IAAI,CAAC,CAAC;MAC7CH,MAAM,CAACI,OAAO,CAAC,CAAC,CAACpB,UAAU,EAAEpC,QAAQ,CAAC,KAAK;QACzCqD,IAAI,CAACI,YAAY,CAACzD,QAAQ,EAAEoC,UAAU,CAAC;MACzC,CAAC,CAAC;MACFe,UAAU,CAACE,IAAI,CAAC;IAClB,CAAC,CAAC;IACF;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAOrC,OAAO;AAChB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useMemo","useState","Skia","FontSlant","Platform","useTypeface","defaultFontSize","useFont","font","size","onError","typeface","Font","defaultFontStyle","fontFamily","fontSize","fontStyle","fontWeight","slant","s","Italic","Oblique","Upright","weight","parseInt","matchFont","inputStyle","fontMgr","FontMgr","System","style","width","matchFamilyStyle","listFontFamilies","families","Set","i","countFamilies","add","getFamilyName","Array","from","loadTypefaces","typefacesToLoad","promises","Object","keys","flatMap","familyName","map","typefaceToLoad","Data","fromURI","resolveAsset","then","data","tf","Typeface","MakeFreeTypeFaceFromData","Error","Promise","all","useFonts","sources","setFontMgr","result","fMgr","TypefaceFontProvider","Make","forEach","registerFont"],"sources":["Font.ts"],"sourcesContent":["/*global SkiaApi*/\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { Skia } from \"../Skia\";\nimport { FontSlant } from \"../types\";\nimport type { DataModule, DataSourceParam, SkFontMgr } from \"../types\";\nimport { Platform } from \"../../Platform\";\nimport type { SkTypefaceFontProvider } from \"../types/Paragraph/TypefaceFontProvider\";\n\nimport { useTypeface } from \"./Typeface\";\n\nconst defaultFontSize = 14;\n\n/**\n * Returns a Skia Font object\n * */\nexport const useFont = (\n font: DataSourceParam,\n size = defaultFontSize,\n onError?: (err: Error) => void\n) => {\n const typeface = useTypeface(font, onError);\n return useMemo(() => {\n if (typeface) {\n return Skia.Font(typeface, size);\n } else {\n return null;\n }\n }, [size, typeface]);\n};\n\ntype Slant = \"normal\" | \"italic\" | \"oblique\";\ntype Weight =\n | \"normal\"\n | \"bold\"\n | \"100\"\n | \"200\"\n | \"300\"\n | \"400\"\n | \"500\"\n | \"600\"\n | \"700\"\n | \"800\"\n | \"900\";\n\ninterface RNFontStyle {\n fontFamily: string;\n fontSize: number;\n fontStyle: Slant;\n fontWeight: Weight;\n}\n\nconst defaultFontStyle: RNFontStyle = {\n fontFamily: \"System\",\n fontSize: defaultFontSize,\n fontStyle: \"normal\",\n fontWeight: \"normal\",\n};\n\nconst slant = (s: Slant) => {\n if (s === \"italic\") {\n return FontSlant.Italic;\n } else if (s === \"oblique\") {\n return FontSlant.Oblique;\n } else {\n return FontSlant.Upright;\n }\n};\n\nconst weight = (fontWeight: Weight) => {\n switch (fontWeight) {\n case \"normal\":\n return 400;\n case \"bold\":\n return 700;\n default:\n return parseInt(fontWeight, 10);\n }\n};\n\nexport const matchFont = (\n inputStyle: Partial<RNFontStyle> = {},\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const fontStyle = {\n ...defaultFontStyle,\n ...inputStyle,\n };\n const style = {\n weight: weight(fontStyle.fontWeight),\n width: 5,\n slant: slant(fontStyle.fontStyle),\n };\n const typeface = fontMgr.matchFamilyStyle(fontStyle.fontFamily, style);\n return Skia.Font(typeface, fontStyle.fontSize);\n};\n\nexport const listFontFamilies = (\n fontMgr: SkFontMgr = Skia.FontMgr.System()\n) => {\n const families = new Set<string>();\n for (let i = 0; i < fontMgr.countFamilies(); i++) {\n families.add(fontMgr.getFamilyName(i));\n }\n return Array.from(families);\n};\n\nconst loadTypefaces = (typefacesToLoad: Record<string, DataModule[]>) => {\n const promises = Object.keys(typefacesToLoad).flatMap((familyName) => {\n return typefacesToLoad[familyName].map((typefaceToLoad) => {\n return Skia.Data.fromURI(Platform.resolveAsset(typefaceToLoad)).then(\n (data) => {\n const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data);\n if (tf === null) {\n throw new Error(`Couldn't create typeface for ${familyName}`);\n }\n return [familyName, tf] as const;\n }\n );\n });\n });\n return Promise.all(promises);\n};\n\nexport const useFonts = (sources: Record<string, DataModule[]>) => {\n const [fontMgr, setFontMgr] = useState<null | SkTypefaceFontProvider>(null);\n\n useEffect(() => {\n loadTypefaces(sources).then((result) => {\n const fMgr = Skia.TypefaceFontProvider.Make();\n result.forEach(([familyName, typeface]) => {\n fMgr.registerFont(typeface, familyName);\n });\n setFontMgr(fMgr);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n return fontMgr;\n};\n"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEpD,SAASC,IAAI,QAAQ,SAAS;AAC9B,SAASC,SAAS,QAAQ,UAAU;AAEpC,SAASC,QAAQ,QAAQ,gBAAgB;AAGzC,SAASC,WAAW,QAAQ,YAAY;AAExC,MAAMC,eAAe,GAAG,EAAE;;AAE1B;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAGA,CACrBC,IAAqB,EACrBC,IAAI,GAAGH,eAAe,EACtBI,OAA8B,KAC3B;EACH,MAAMC,QAAQ,GAAGN,WAAW,CAACG,IAAI,EAAEE,OAAO,CAAC;EAC3C,OAAOV,OAAO,CAAC,MAAM;IACnB,IAAIW,QAAQ,EAAE;MACZ,OAAOT,IAAI,CAACU,IAAI,CAACD,QAAQ,EAAEF,IAAI,CAAC;IAClC,CAAC,MAAM;MACL,OAAO,IAAI;IACb;EACF,CAAC,EAAE,CAACA,IAAI,EAAEE,QAAQ,CAAC,CAAC;AACtB,CAAC;AAuBD,MAAME,gBAA6B,GAAG;EACpCC,UAAU,EAAE,QAAQ;EACpBC,QAAQ,EAAET,eAAe;EACzBU,SAAS,EAAE,QA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AAC,CAAC,CAACrB,UAAU,EAAErC,QAAQ,CAAC,KAAK;QACzCuD,IAAI,CAACI,YAAY,CAAC3D,QAAQ,EAAEqC,UAAU,CAAC;MACzC,CAAC,CAAC;MACFgB,UAAU,CAACE,IAAI,CAAC;IAClB,CAAC,CAAC;IACF;EACF,CAAC,EAAE,EAAE,CAAC;EACN,OAAOvC,OAAO;AAChB,CAAC","ignoreList":[]}
@@ -4,5 +4,5 @@ export const __esModule: boolean;
4
4
  * */
5
5
  export function useFont(font: any, size: number | undefined, onError: any): import("../../../..").SkFont | null;
6
6
  export function matchFont(inputStyle?: {}, fontMgr?: import("../../../..").SkFontMgr): import("../../../..").SkFont;
7
- export function listFontFamilies(fontMgr?: import("../../../..").SkFontMgr): string[];
7
+ export function listFontFamilies(fontMgr?: import("../../../..").SkFontMgr): any[];
8
8
  export function useFonts(sources: any): null;
@@ -173,7 +173,7 @@ export function Mock(CanvasKit: any): {
173
173
  loadData: (source: any, factory: any, onError: any) => Promise<any>;
174
174
  useCollectionLoading: (source: any, loader: any) => null;
175
175
  matchFont: (inputStyle?: {}, fontMgr?: import("../../..").SkFontMgr) => import("../../..").SkFont;
176
- listFontFamilies: (fontMgr?: import("../../..").SkFontMgr) => string[];
176
+ listFontFamilies: (fontMgr?: import("../../..").SkFontMgr) => any[];
177
177
  makeImageFromView: (viewRef: any, callback?: null) => any;
178
178
  useAnimatedImage: (source: any, onError: any) => null;
179
179
  createPicture: (cb: any, rect: any) => import("../../..").SkPicture;
@@ -1,4 +1,4 @@
1
1
  export function useFont(font: any, size: number | undefined, onError: any): import("../../../..").SkFont | null;
2
2
  export function matchFont(inputStyle?: {}, fontMgr?: import("../../../..").SkFontMgr): import("../../../..").SkFont;
3
- export function listFontFamilies(fontMgr?: import("../../../..").SkFontMgr): string[];
3
+ export function listFontFamilies(fontMgr?: import("../../../..").SkFontMgr): any[];
4
4
  export function useFonts(sources: any): null;
package/package.json CHANGED
@@ -8,15 +8,15 @@
8
8
  "setup-skia-web": "scripts/setup-canvaskit.js"
9
9
  },
10
10
  "title": "React Native Skia",
11
- "version": "2.4.7",
11
+ "version": "2.4.14",
12
12
  "skia": {
13
- "version": "m142",
13
+ "version": "m144",
14
14
  "checksums": {
15
- "android-armeabi-v7a": "5ae357eb26d9ec93797bacbc865b86eff6ac54b3a9466a1b0c41c27018cc3150",
16
- "android-arm64-v8a": "c310bd5261de1ab5f4afdb05aa51bf0f56d625f6285617e149af517a2d375e52",
17
- "android-x86": "26a18ade07de8318be2ec82bd82a1d7f2709893462229d70f0d353c6c8691cc3",
18
- "android-x86_64": "46a5576b6f8e7d1372c27576ad750384c2d6f892bfe3fc0ee260c68d08ebd844",
19
- "apple-xcframeworks": "343fad71c01e1f8331d4421c7efe0ae6dff3a7d25361c466dcda7dc3737cdd5c"
15
+ "android-armeabi-v7a": "8f7f83a4ae210cc28007f2c226d754e9ef7c929822ef60c56a4ccc134e726148",
16
+ "android-arm64-v8a": "5d799d988a6cbc0cb844a92882a2458e67990314791ea38f928d83d5e01cb828",
17
+ "android-x86": "711fbee4a1721b92604daa78fa6f8c7ce4a6a6c901973919bd030848adc4f81d",
18
+ "android-x86_64": "fe068aa70b5c8bcf991cfe99e9db38617aaeaf92defd08bc4f89384b4d4dbed4",
19
+ "apple-xcframeworks": "63e2789bd75236b16779abc7171b351aa50cd01c13f05b3e1d83b34336ceb77c"
20
20
  }
21
21
  },
22
22
  "skia-graphite": {
@@ -26,7 +26,7 @@
26
26
  "android-arm64-v8a": "6be2711ca4c31523d381420e98cabfe7e7939e246975c7b427968d5dd3b62be9",
27
27
  "android-x86": "888934ddc34f431c7fac5628f633dc11a4e84d68c41adb33307ae7586cc7b0b5",
28
28
  "android-x86_64": "2180a5be52d51bbf1dabaf95051ed0ce422b047157bcda6e486657c2c7b87ceb",
29
- "apple-xcframeworks": "cb50d9c85c9f02389ecc433912145e4a7ce2277bfe26a69dd7f7a9db74c9e276"
29
+ "apple-xcframeworks": "6c9e4c565977acaf9d4f4b113050cfe8f9804602fd3cd4ec982c605fa7b040e6"
30
30
  }
31
31
  },
32
32
  "description": "High-performance React Native Graphics using Skia",