@rive-app/react-native 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/android/src/main/java/com/margelo/nitro/rive/{Rive.kt → HybridDefaultFallbackFont.kt} +1 -5
  2. package/android/src/main/java/com/margelo/nitro/rive/HybridFallbackFont.kt +10 -0
  3. package/android/src/main/java/com/margelo/nitro/rive/HybridRiveFontConfig.kt +136 -0
  4. package/ios/HybridDefaultFallbackFont.swift +3 -0
  5. package/ios/HybridFallbackFont.swift +10 -0
  6. package/ios/HybridRiveFontConfig.swift +109 -0
  7. package/lib/module/core/RiveFonts.js +72 -0
  8. package/lib/module/core/RiveFonts.js.map +1 -0
  9. package/lib/module/index.js +1 -0
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/module/specs/RiveFontConfig.nitro.js +4 -0
  12. package/lib/module/specs/{Rive.nitro.js.map → RiveFontConfig.nitro.js.map} +1 -1
  13. package/lib/typescript/src/core/RiveFonts.d.ts +23 -0
  14. package/lib/typescript/src/core/RiveFonts.d.ts.map +1 -0
  15. package/lib/typescript/src/index.d.ts +2 -0
  16. package/lib/typescript/src/index.d.ts.map +1 -1
  17. package/lib/typescript/src/specs/RiveFontConfig.nitro.d.ts +20 -0
  18. package/lib/typescript/src/specs/RiveFontConfig.nitro.d.ts.map +1 -0
  19. package/nitrogen/generated/android/c++/JHybridFallbackFontSpec.cpp +55 -0
  20. package/nitrogen/generated/android/c++/{JHybridRiveSpec.hpp → JHybridFallbackFontSpec.hpp} +11 -11
  21. package/nitrogen/generated/android/c++/JHybridRiveFontConfigSpec.cpp +143 -0
  22. package/nitrogen/generated/android/c++/JHybridRiveFontConfigSpec.hpp +73 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/{HybridRiveSpec.kt → HybridFallbackFontSpec.kt} +7 -9
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridRiveFontConfigSpec.kt +87 -0
  25. package/nitrogen/generated/android/rive+autolinking.cmake +4 -2
  26. package/nitrogen/generated/android/riveOnLoad.cpp +6 -4
  27. package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.cpp +50 -25
  28. package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.hpp +149 -69
  29. package/nitrogen/generated/ios/RNRive-Swift-Cxx-Umbrella.hpp +10 -5
  30. package/nitrogen/generated/ios/RNRiveAutolinking.mm +3 -3
  31. package/nitrogen/generated/ios/RNRiveAutolinking.swift +5 -5
  32. package/nitrogen/generated/ios/c++/{HybridRiveSpecSwift.cpp → HybridFallbackFontSpecSwift.cpp} +2 -2
  33. package/nitrogen/generated/ios/c++/{HybridRiveSpecSwift.hpp → HybridFallbackFontSpecSwift.hpp} +14 -21
  34. package/nitrogen/generated/ios/c++/HybridRiveFontConfigSpecSwift.cpp +11 -0
  35. package/nitrogen/generated/ios/c++/HybridRiveFontConfigSpecSwift.hpp +145 -0
  36. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridFallbackFontSpec_.swift +51 -0
  37. package/nitrogen/generated/ios/swift/HybridFallbackFontSpec.swift +56 -0
  38. package/nitrogen/generated/ios/swift/{HybridRiveSpec_cxx.swift → HybridFallbackFontSpec_cxx.swift} +20 -30
  39. package/nitrogen/generated/ios/swift/HybridRiveFontConfigSpec.swift +63 -0
  40. package/nitrogen/generated/ios/swift/HybridRiveFontConfigSpec_cxx.swift +262 -0
  41. package/nitrogen/generated/shared/c++/{HybridRiveSpec.cpp → HybridFallbackFontSpec.cpp} +4 -4
  42. package/nitrogen/generated/shared/c++/{HybridRiveSpec.hpp → HybridFallbackFontSpec.hpp} +10 -10
  43. package/nitrogen/generated/shared/c++/HybridRiveFontConfigSpec.cpp +28 -0
  44. package/nitrogen/generated/shared/c++/HybridRiveFontConfigSpec.hpp +75 -0
  45. package/package.json +1 -1
  46. package/src/core/RiveFonts.ts +95 -0
  47. package/src/index.tsx +7 -0
  48. package/src/specs/RiveFontConfig.nitro.ts +16 -0
  49. package/ios/Rive.swift +0 -5
  50. package/lib/module/specs/Rive.nitro.js +0 -4
  51. package/lib/typescript/src/specs/Rive.nitro.d.ts +0 -8
  52. package/lib/typescript/src/specs/Rive.nitro.d.ts.map +0 -1
  53. package/nitrogen/generated/android/c++/JHybridRiveSpec.cpp +0 -59
  54. package/nitrogen/generated/ios/swift/HybridRiveSpec.swift +0 -56
  55. package/src/specs/Rive.nitro.ts +0 -6
@@ -0,0 +1,145 @@
1
+ ///
2
+ /// HybridRiveFontConfigSpecSwift.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include "HybridRiveFontConfigSpec.hpp"
11
+
12
+ // Forward declaration of `HybridRiveFontConfigSpec_cxx` to properly resolve imports.
13
+ namespace RNRive { class HybridRiveFontConfigSpec_cxx; }
14
+
15
+ // Forward declaration of `HybridFallbackFontSpec` to properly resolve imports.
16
+ namespace margelo::nitro::rive { class HybridFallbackFontSpec; }
17
+ // Forward declaration of `ArrayBufferHolder` to properly resolve imports.
18
+ namespace NitroModules { class ArrayBufferHolder; }
19
+
20
+ #include <memory>
21
+ #include "HybridFallbackFontSpec.hpp"
22
+ #include <NitroModules/Promise.hpp>
23
+ #include <string>
24
+ #include <NitroModules/ArrayBuffer.hpp>
25
+ #include <NitroModules/ArrayBufferHolder.hpp>
26
+ #include <vector>
27
+
28
+ #include "RNRive-Swift-Cxx-Umbrella.hpp"
29
+
30
+ namespace margelo::nitro::rive {
31
+
32
+ /**
33
+ * The C++ part of HybridRiveFontConfigSpec_cxx.swift.
34
+ *
35
+ * HybridRiveFontConfigSpecSwift (C++) accesses HybridRiveFontConfigSpec_cxx (Swift), and might
36
+ * contain some additional bridging code for C++ <> Swift interop.
37
+ *
38
+ * Since this obviously introduces an overhead, I hope at some point in
39
+ * the future, HybridRiveFontConfigSpec_cxx can directly inherit from the C++ class HybridRiveFontConfigSpec
40
+ * to simplify the whole structure and memory management.
41
+ */
42
+ class HybridRiveFontConfigSpecSwift: public virtual HybridRiveFontConfigSpec {
43
+ public:
44
+ // Constructor from a Swift instance
45
+ explicit HybridRiveFontConfigSpecSwift(const RNRive::HybridRiveFontConfigSpec_cxx& swiftPart):
46
+ HybridObject(HybridRiveFontConfigSpec::TAG),
47
+ _swiftPart(swiftPart) { }
48
+
49
+ public:
50
+ // Get the Swift part
51
+ inline RNRive::HybridRiveFontConfigSpec_cxx& getSwiftPart() noexcept {
52
+ return _swiftPart;
53
+ }
54
+
55
+ public:
56
+ inline size_t getExternalMemorySize() noexcept override {
57
+ return _swiftPart.getMemorySize();
58
+ }
59
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
60
+ if (auto otherCast = std::dynamic_pointer_cast<HybridRiveFontConfigSpecSwift>(other)) {
61
+ return _swiftPart.equals(otherCast->_swiftPart);
62
+ }
63
+ return false;
64
+ }
65
+ void dispose() noexcept override {
66
+ _swiftPart.dispose();
67
+ }
68
+ std::string toString() override {
69
+ return _swiftPart.toString();
70
+ }
71
+
72
+ public:
73
+ // Properties
74
+
75
+
76
+ public:
77
+ // Methods
78
+ inline std::shared_ptr<Promise<std::shared_ptr<HybridFallbackFontSpec>>> loadFontFromURL(const std::string& url) override {
79
+ auto __result = _swiftPart.loadFontFromURL(url);
80
+ if (__result.hasError()) [[unlikely]] {
81
+ std::rethrow_exception(__result.error());
82
+ }
83
+ auto __value = std::move(__result.value());
84
+ return __value;
85
+ }
86
+ inline std::shared_ptr<HybridFallbackFontSpec> loadFontFromResource(const std::string& resource) override {
87
+ auto __result = _swiftPart.loadFontFromResource(resource);
88
+ if (__result.hasError()) [[unlikely]] {
89
+ std::rethrow_exception(__result.error());
90
+ }
91
+ auto __value = std::move(__result.value());
92
+ return __value;
93
+ }
94
+ inline std::shared_ptr<HybridFallbackFontSpec> loadFontFromBytes(const std::shared_ptr<ArrayBuffer>& bytes) override {
95
+ auto __result = _swiftPart.loadFontFromBytes(ArrayBufferHolder(bytes));
96
+ if (__result.hasError()) [[unlikely]] {
97
+ std::rethrow_exception(__result.error());
98
+ }
99
+ auto __value = std::move(__result.value());
100
+ return __value;
101
+ }
102
+ inline std::shared_ptr<HybridFallbackFontSpec> loadFontByName(const std::string& name) override {
103
+ auto __result = _swiftPart.loadFontByName(name);
104
+ if (__result.hasError()) [[unlikely]] {
105
+ std::rethrow_exception(__result.error());
106
+ }
107
+ auto __value = std::move(__result.value());
108
+ return __value;
109
+ }
110
+ inline std::shared_ptr<HybridFallbackFontSpec> getSystemDefaultFont() override {
111
+ auto __result = _swiftPart.getSystemDefaultFont();
112
+ if (__result.hasError()) [[unlikely]] {
113
+ std::rethrow_exception(__result.error());
114
+ }
115
+ auto __value = std::move(__result.value());
116
+ return __value;
117
+ }
118
+ inline void setFontsForWeight(double weight, const std::vector<std::shared_ptr<HybridFallbackFontSpec>>& fonts) override {
119
+ auto __result = _swiftPart.setFontsForWeight(std::forward<decltype(weight)>(weight), fonts);
120
+ if (__result.hasError()) [[unlikely]] {
121
+ std::rethrow_exception(__result.error());
122
+ }
123
+ }
124
+ inline std::shared_ptr<Promise<void>> applyFallbackFonts() override {
125
+ auto __result = _swiftPart.applyFallbackFonts();
126
+ if (__result.hasError()) [[unlikely]] {
127
+ std::rethrow_exception(__result.error());
128
+ }
129
+ auto __value = std::move(__result.value());
130
+ return __value;
131
+ }
132
+ inline std::shared_ptr<Promise<void>> clearFallbackFonts() override {
133
+ auto __result = _swiftPart.clearFallbackFonts();
134
+ if (__result.hasError()) [[unlikely]] {
135
+ std::rethrow_exception(__result.error());
136
+ }
137
+ auto __value = std::move(__result.value());
138
+ return __value;
139
+ }
140
+
141
+ private:
142
+ RNRive::HybridRiveFontConfigSpec_cxx _swiftPart;
143
+ };
144
+
145
+ } // namespace margelo::nitro::rive
@@ -0,0 +1,51 @@
1
+ ///
2
+ /// Func_void_std__shared_ptr_HybridFallbackFontSpec_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: (any HybridFallbackFontSpec)) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__shared_ptr_HybridFallbackFontSpec_ {
16
+ public typealias bridge = margelo.nitro.rive.bridge.swift
17
+
18
+ private let closure: (_ value: (any HybridFallbackFontSpec)) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: (any HybridFallbackFontSpec)) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: bridge.std__shared_ptr_HybridFallbackFontSpec_) -> Void {
26
+ self.closure({ () -> any HybridFallbackFontSpec in
27
+ let __unsafePointer = bridge.get_std__shared_ptr_HybridFallbackFontSpec_(value)
28
+ let __instance = HybridFallbackFontSpec_cxx.fromUnsafe(__unsafePointer)
29
+ return __instance.getHybridFallbackFontSpec()
30
+ }())
31
+ }
32
+
33
+ /**
34
+ * Casts this instance to a retained unsafe raw pointer.
35
+ * This acquires one additional strong reference on the object!
36
+ */
37
+ @inline(__always)
38
+ public func toUnsafe() -> UnsafeMutableRawPointer {
39
+ return Unmanaged.passRetained(self).toOpaque()
40
+ }
41
+
42
+ /**
43
+ * Casts an unsafe pointer to a `Func_void_std__shared_ptr_HybridFallbackFontSpec_`.
44
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__shared_ptr_HybridFallbackFontSpec_>`.
45
+ * This removes one strong reference from the object!
46
+ */
47
+ @inline(__always)
48
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__shared_ptr_HybridFallbackFontSpec_ {
49
+ return Unmanaged<Func_void_std__shared_ptr_HybridFallbackFontSpec_>.fromOpaque(pointer).takeRetainedValue()
50
+ }
51
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridFallbackFontSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridFallbackFontSpec``
12
+ public protocol HybridFallbackFontSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+
18
+ }
19
+
20
+ public extension HybridFallbackFontSpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject FallbackFont]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridFallbackFontSpec``
28
+ open class HybridFallbackFontSpec_base {
29
+ private weak var cxxWrapper: HybridFallbackFontSpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridFallbackFontSpec_cxx {
32
+ #if DEBUG
33
+ guard self is any HybridFallbackFontSpec else {
34
+ fatalError("`self` is not a `HybridFallbackFontSpec`! Did you accidentally inherit from `HybridFallbackFontSpec_base` instead of `HybridFallbackFontSpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridFallbackFontSpec_cxx(self as! any HybridFallbackFontSpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the FallbackFont HybridObject.
49
+ * Implement this protocol to create Swift-based instances of FallbackFont.
50
+ * ```swift
51
+ * class HybridFallbackFont : HybridFallbackFontSpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridFallbackFontSpec = HybridFallbackFontSpec_protocol & HybridFallbackFontSpec_base
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// HybridRiveSpec_cxx.swift
2
+ /// HybridFallbackFontSpec_cxx.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © Marc Rousavy @ Margelo
@@ -9,7 +9,7 @@ import Foundation
9
9
  import NitroModules
10
10
 
11
11
  /**
12
- * A class implementation that bridges HybridRiveSpec over to C++.
12
+ * A class implementation that bridges HybridFallbackFontSpec over to C++.
13
13
  * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
14
  *
15
15
  * Also, some Swift types need to be bridged with special handling:
@@ -17,7 +17,7 @@ import NitroModules
17
17
  * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
18
  * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
19
  */
20
- open class HybridRiveSpec_cxx {
20
+ open class HybridFallbackFontSpec_cxx {
21
21
  /**
22
22
  * The Swift <> C++ bridge's namespace (`margelo::nitro::rive::bridge::swift`)
23
23
  * from `RNRive-Swift-Cxx-Bridge.hpp`.
@@ -26,30 +26,30 @@ open class HybridRiveSpec_cxx {
26
26
  public typealias bridge = margelo.nitro.rive.bridge.swift
27
27
 
28
28
  /**
29
- * Holds an instance of the `HybridRiveSpec` Swift protocol.
29
+ * Holds an instance of the `HybridFallbackFontSpec` Swift protocol.
30
30
  */
31
- private var __implementation: any HybridRiveSpec
31
+ private var __implementation: any HybridFallbackFontSpec
32
32
 
33
33
  /**
34
34
  * Holds a weak pointer to the C++ class that wraps the Swift class.
35
35
  */
36
- private var __cxxPart: bridge.std__weak_ptr_HybridRiveSpec_
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridFallbackFontSpec_
37
37
 
38
38
  /**
39
- * Create a new `HybridRiveSpec_cxx` that wraps the given `HybridRiveSpec`.
39
+ * Create a new `HybridFallbackFontSpec_cxx` that wraps the given `HybridFallbackFontSpec`.
40
40
  * All properties and methods bridge to C++ types.
41
41
  */
42
- public init(_ implementation: any HybridRiveSpec) {
42
+ public init(_ implementation: any HybridFallbackFontSpec) {
43
43
  self.__implementation = implementation
44
44
  self.__cxxPart = .init()
45
45
  /* no base class */
46
46
  }
47
47
 
48
48
  /**
49
- * Get the actual `HybridRiveSpec` instance this class wraps.
49
+ * Get the actual `HybridFallbackFontSpec` instance this class wraps.
50
50
  */
51
51
  @inline(__always)
52
- public func getHybridRiveSpec() -> any HybridRiveSpec {
52
+ public func getHybridFallbackFontSpec() -> any HybridFallbackFontSpec {
53
53
  return __implementation
54
54
  }
55
55
 
@@ -62,25 +62,25 @@ open class HybridRiveSpec_cxx {
62
62
  }
63
63
 
64
64
  /**
65
- * Casts an unsafe pointer to a `HybridRiveSpec_cxx`.
66
- * The pointer has to be a retained opaque `Unmanaged<HybridRiveSpec_cxx>`.
65
+ * Casts an unsafe pointer to a `HybridFallbackFontSpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridFallbackFontSpec_cxx>`.
67
67
  * This removes one strong reference from the object!
68
68
  */
69
- public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridRiveSpec_cxx {
70
- return Unmanaged<HybridRiveSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridFallbackFontSpec_cxx {
70
+ return Unmanaged<HybridFallbackFontSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
71
  }
72
72
 
73
73
  /**
74
74
  * Gets (or creates) the C++ part of this Hybrid Object.
75
- * The C++ part is a `std::shared_ptr<HybridRiveSpec>`.
75
+ * The C++ part is a `std::shared_ptr<HybridFallbackFontSpec>`.
76
76
  */
77
- public func getCxxPart() -> bridge.std__shared_ptr_HybridRiveSpec_ {
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridFallbackFontSpec_ {
78
78
  let cachedCxxPart = self.__cxxPart.lock()
79
79
  if Bool(fromCxx: cachedCxxPart) {
80
80
  return cachedCxxPart
81
81
  } else {
82
- let newCxxPart = bridge.create_std__shared_ptr_HybridRiveSpec_(self.toUnsafe())
83
- __cxxPart = bridge.weakify_std__shared_ptr_HybridRiveSpec_(newCxxPart)
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridFallbackFontSpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridFallbackFontSpec_(newCxxPart)
84
84
  return newCxxPart
85
85
  }
86
86
  }
@@ -100,7 +100,7 @@ open class HybridRiveSpec_cxx {
100
100
  * Compares this object with the given [other] object for reference equality.
101
101
  */
102
102
  @inline(__always)
103
- public func equals(other: HybridRiveSpec_cxx) -> Bool {
103
+ public func equals(other: HybridFallbackFontSpec_cxx) -> Bool {
104
104
  return self.__implementation === other.__implementation
105
105
  }
106
106
 
@@ -125,15 +125,5 @@ open class HybridRiveSpec_cxx {
125
125
 
126
126
 
127
127
  // Methods
128
- @inline(__always)
129
- public final func multiply(a: Double, b: Double) -> bridge.Result_double_ {
130
- do {
131
- let __result = try self.__implementation.multiply(a: a, b: b)
132
- let __resultCpp = __result
133
- return bridge.create_Result_double_(__resultCpp)
134
- } catch (let __error) {
135
- let __exceptionPtr = __error.toCpp()
136
- return bridge.create_Result_double_(__exceptionPtr)
137
- }
138
- }
128
+
139
129
  }
@@ -0,0 +1,63 @@
1
+ ///
2
+ /// HybridRiveFontConfigSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridRiveFontConfigSpec``
12
+ public protocol HybridRiveFontConfigSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func loadFontFromURL(url: String) throws -> Promise<(any HybridFallbackFontSpec)>
18
+ func loadFontFromResource(resource: String) throws -> (any HybridFallbackFontSpec)
19
+ func loadFontFromBytes(bytes: ArrayBuffer) throws -> (any HybridFallbackFontSpec)
20
+ func loadFontByName(name: String) throws -> (any HybridFallbackFontSpec)
21
+ func getSystemDefaultFont() throws -> (any HybridFallbackFontSpec)
22
+ func setFontsForWeight(weight: Double, fonts: [(any HybridFallbackFontSpec)]) throws -> Void
23
+ func applyFallbackFonts() throws -> Promise<Void>
24
+ func clearFallbackFonts() throws -> Promise<Void>
25
+ }
26
+
27
+ public extension HybridRiveFontConfigSpec_protocol {
28
+ /// Default implementation of ``HybridObject.toString``
29
+ func toString() -> String {
30
+ return "[HybridObject RiveFontConfig]"
31
+ }
32
+ }
33
+
34
+ /// See ``HybridRiveFontConfigSpec``
35
+ open class HybridRiveFontConfigSpec_base {
36
+ private weak var cxxWrapper: HybridRiveFontConfigSpec_cxx? = nil
37
+ public init() { }
38
+ public func getCxxWrapper() -> HybridRiveFontConfigSpec_cxx {
39
+ #if DEBUG
40
+ guard self is any HybridRiveFontConfigSpec else {
41
+ fatalError("`self` is not a `HybridRiveFontConfigSpec`! Did you accidentally inherit from `HybridRiveFontConfigSpec_base` instead of `HybridRiveFontConfigSpec`?")
42
+ }
43
+ #endif
44
+ if let cxxWrapper = self.cxxWrapper {
45
+ return cxxWrapper
46
+ } else {
47
+ let cxxWrapper = HybridRiveFontConfigSpec_cxx(self as! any HybridRiveFontConfigSpec)
48
+ self.cxxWrapper = cxxWrapper
49
+ return cxxWrapper
50
+ }
51
+ }
52
+ }
53
+
54
+ /**
55
+ * A Swift base-protocol representing the RiveFontConfig HybridObject.
56
+ * Implement this protocol to create Swift-based instances of RiveFontConfig.
57
+ * ```swift
58
+ * class HybridRiveFontConfig : HybridRiveFontConfigSpec {
59
+ * // ...
60
+ * }
61
+ * ```
62
+ */
63
+ public typealias HybridRiveFontConfigSpec = HybridRiveFontConfigSpec_protocol & HybridRiveFontConfigSpec_base