@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.
- package/android/src/main/java/com/margelo/nitro/rive/{Rive.kt → HybridDefaultFallbackFont.kt} +1 -5
- package/android/src/main/java/com/margelo/nitro/rive/HybridFallbackFont.kt +10 -0
- package/android/src/main/java/com/margelo/nitro/rive/HybridRiveFontConfig.kt +136 -0
- package/ios/HybridDefaultFallbackFont.swift +3 -0
- package/ios/HybridFallbackFont.swift +10 -0
- package/ios/HybridRiveFontConfig.swift +109 -0
- package/lib/module/core/RiveFonts.js +72 -0
- package/lib/module/core/RiveFonts.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/RiveFontConfig.nitro.js +4 -0
- package/lib/module/specs/{Rive.nitro.js.map → RiveFontConfig.nitro.js.map} +1 -1
- package/lib/typescript/src/core/RiveFonts.d.ts +23 -0
- package/lib/typescript/src/core/RiveFonts.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/RiveFontConfig.nitro.d.ts +20 -0
- package/lib/typescript/src/specs/RiveFontConfig.nitro.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JHybridFallbackFontSpec.cpp +55 -0
- package/nitrogen/generated/android/c++/{JHybridRiveSpec.hpp → JHybridFallbackFontSpec.hpp} +11 -11
- package/nitrogen/generated/android/c++/JHybridRiveFontConfigSpec.cpp +143 -0
- package/nitrogen/generated/android/c++/JHybridRiveFontConfigSpec.hpp +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/{HybridRiveSpec.kt → HybridFallbackFontSpec.kt} +7 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridRiveFontConfigSpec.kt +87 -0
- package/nitrogen/generated/android/rive+autolinking.cmake +4 -2
- package/nitrogen/generated/android/riveOnLoad.cpp +6 -4
- package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.cpp +50 -25
- package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.hpp +149 -69
- package/nitrogen/generated/ios/RNRive-Swift-Cxx-Umbrella.hpp +10 -5
- package/nitrogen/generated/ios/RNRiveAutolinking.mm +3 -3
- package/nitrogen/generated/ios/RNRiveAutolinking.swift +5 -5
- package/nitrogen/generated/ios/c++/{HybridRiveSpecSwift.cpp → HybridFallbackFontSpecSwift.cpp} +2 -2
- package/nitrogen/generated/ios/c++/{HybridRiveSpecSwift.hpp → HybridFallbackFontSpecSwift.hpp} +14 -21
- package/nitrogen/generated/ios/c++/HybridRiveFontConfigSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridRiveFontConfigSpecSwift.hpp +145 -0
- package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_HybridFallbackFontSpec_.swift +51 -0
- package/nitrogen/generated/ios/swift/HybridFallbackFontSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/{HybridRiveSpec_cxx.swift → HybridFallbackFontSpec_cxx.swift} +20 -30
- package/nitrogen/generated/ios/swift/HybridRiveFontConfigSpec.swift +63 -0
- package/nitrogen/generated/ios/swift/HybridRiveFontConfigSpec_cxx.swift +262 -0
- package/nitrogen/generated/shared/c++/{HybridRiveSpec.cpp → HybridFallbackFontSpec.cpp} +4 -4
- package/nitrogen/generated/shared/c++/{HybridRiveSpec.hpp → HybridFallbackFontSpec.hpp} +10 -10
- package/nitrogen/generated/shared/c++/HybridRiveFontConfigSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridRiveFontConfigSpec.hpp +75 -0
- package/package.json +1 -1
- package/src/core/RiveFonts.ts +95 -0
- package/src/index.tsx +7 -0
- package/src/specs/RiveFontConfig.nitro.ts +16 -0
- package/ios/Rive.swift +0 -5
- package/lib/module/specs/Rive.nitro.js +0 -4
- package/lib/typescript/src/specs/Rive.nitro.d.ts +0 -8
- package/lib/typescript/src/specs/Rive.nitro.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JHybridRiveSpec.cpp +0 -59
- package/nitrogen/generated/ios/swift/HybridRiveSpec.swift +0 -56
- 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
|
package/nitrogen/generated/ios/swift/{HybridRiveSpec_cxx.swift → HybridFallbackFontSpec_cxx.swift}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
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
|
|
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
|
|
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 `
|
|
29
|
+
* Holds an instance of the `HybridFallbackFontSpec` Swift protocol.
|
|
30
30
|
*/
|
|
31
|
-
private var __implementation: any
|
|
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.
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridFallbackFontSpec_
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Create a new `
|
|
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
|
|
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 `
|
|
49
|
+
* Get the actual `HybridFallbackFontSpec` instance this class wraps.
|
|
50
50
|
*/
|
|
51
51
|
@inline(__always)
|
|
52
|
-
public func
|
|
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 `
|
|
66
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
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) ->
|
|
70
|
-
return Unmanaged<
|
|
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<
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridFallbackFontSpec>`.
|
|
76
76
|
*/
|
|
77
|
-
public func getCxxPart() -> bridge.
|
|
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.
|
|
83
|
-
__cxxPart = bridge.
|
|
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:
|
|
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
|
-
|
|
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
|