@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,143 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridRiveFontConfigSpec.cpp
|
|
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
|
+
#include "JHybridRiveFontConfigSpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `HybridFallbackFontSpec` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::rive { class HybridFallbackFontSpec; }
|
|
12
|
+
|
|
13
|
+
#include <memory>
|
|
14
|
+
#include "HybridFallbackFontSpec.hpp"
|
|
15
|
+
#include <NitroModules/Promise.hpp>
|
|
16
|
+
#include <NitroModules/JPromise.hpp>
|
|
17
|
+
#include "JHybridFallbackFontSpec.hpp"
|
|
18
|
+
#include <NitroModules/JUnit.hpp>
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
21
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
22
|
+
#include <vector>
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::rive {
|
|
25
|
+
|
|
26
|
+
jni::local_ref<JHybridRiveFontConfigSpec::jhybriddata> JHybridRiveFontConfigSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
27
|
+
return makeCxxInstance(jThis);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void JHybridRiveFontConfigSpec::registerNatives() {
|
|
31
|
+
registerHybrid({
|
|
32
|
+
makeNativeMethod("initHybrid", JHybridRiveFontConfigSpec::initHybrid),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
size_t JHybridRiveFontConfigSpec::getExternalMemorySize() noexcept {
|
|
37
|
+
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
38
|
+
return method(_javaPart);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
bool JHybridRiveFontConfigSpec::equals(const std::shared_ptr<HybridObject>& other) {
|
|
42
|
+
if (auto otherCast = std::dynamic_pointer_cast<JHybridRiveFontConfigSpec>(other)) {
|
|
43
|
+
return _javaPart == otherCast->_javaPart;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void JHybridRiveFontConfigSpec::dispose() noexcept {
|
|
49
|
+
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
50
|
+
method(_javaPart);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
std::string JHybridRiveFontConfigSpec::toString() {
|
|
54
|
+
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
55
|
+
auto javaString = method(_javaPart);
|
|
56
|
+
return javaString->toStdString();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Properties
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// Methods
|
|
63
|
+
std::shared_ptr<Promise<std::shared_ptr<HybridFallbackFontSpec>>> JHybridRiveFontConfigSpec::loadFontFromURL(const std::string& url) {
|
|
64
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* url */)>("loadFontFromURL");
|
|
65
|
+
auto __result = method(_javaPart, jni::make_jstring(url));
|
|
66
|
+
return [&]() {
|
|
67
|
+
auto __promise = Promise<std::shared_ptr<HybridFallbackFontSpec>>::create();
|
|
68
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
69
|
+
auto __result = jni::static_ref_cast<JHybridFallbackFontSpec::javaobject>(__boxedResult);
|
|
70
|
+
__promise->resolve(__result->cthis()->shared_cast<JHybridFallbackFontSpec>());
|
|
71
|
+
});
|
|
72
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
73
|
+
jni::JniException __jniError(__throwable);
|
|
74
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
75
|
+
});
|
|
76
|
+
return __promise;
|
|
77
|
+
}();
|
|
78
|
+
}
|
|
79
|
+
std::shared_ptr<HybridFallbackFontSpec> JHybridRiveFontConfigSpec::loadFontFromResource(const std::string& resource) {
|
|
80
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridFallbackFontSpec::javaobject>(jni::alias_ref<jni::JString> /* resource */)>("loadFontFromResource");
|
|
81
|
+
auto __result = method(_javaPart, jni::make_jstring(resource));
|
|
82
|
+
return __result->cthis()->shared_cast<JHybridFallbackFontSpec>();
|
|
83
|
+
}
|
|
84
|
+
std::shared_ptr<HybridFallbackFontSpec> JHybridRiveFontConfigSpec::loadFontFromBytes(const std::shared_ptr<ArrayBuffer>& bytes) {
|
|
85
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridFallbackFontSpec::javaobject>(jni::alias_ref<JArrayBuffer::javaobject> /* bytes */)>("loadFontFromBytes");
|
|
86
|
+
auto __result = method(_javaPart, JArrayBuffer::wrap(bytes));
|
|
87
|
+
return __result->cthis()->shared_cast<JHybridFallbackFontSpec>();
|
|
88
|
+
}
|
|
89
|
+
std::shared_ptr<HybridFallbackFontSpec> JHybridRiveFontConfigSpec::loadFontByName(const std::string& name) {
|
|
90
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridFallbackFontSpec::javaobject>(jni::alias_ref<jni::JString> /* name */)>("loadFontByName");
|
|
91
|
+
auto __result = method(_javaPart, jni::make_jstring(name));
|
|
92
|
+
return __result->cthis()->shared_cast<JHybridFallbackFontSpec>();
|
|
93
|
+
}
|
|
94
|
+
std::shared_ptr<HybridFallbackFontSpec> JHybridRiveFontConfigSpec::getSystemDefaultFont() {
|
|
95
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridFallbackFontSpec::javaobject>()>("getSystemDefaultFont");
|
|
96
|
+
auto __result = method(_javaPart);
|
|
97
|
+
return __result->cthis()->shared_cast<JHybridFallbackFontSpec>();
|
|
98
|
+
}
|
|
99
|
+
void JHybridRiveFontConfigSpec::setFontsForWeight(double weight, const std::vector<std::shared_ptr<HybridFallbackFontSpec>>& fonts) {
|
|
100
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* weight */, jni::alias_ref<jni::JArrayClass<JHybridFallbackFontSpec::javaobject>> /* fonts */)>("setFontsForWeight");
|
|
101
|
+
method(_javaPart, weight, [&]() {
|
|
102
|
+
size_t __size = fonts.size();
|
|
103
|
+
jni::local_ref<jni::JArrayClass<JHybridFallbackFontSpec::javaobject>> __array = jni::JArrayClass<JHybridFallbackFontSpec::javaobject>::newArray(__size);
|
|
104
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
105
|
+
const auto& __element = fonts[__i];
|
|
106
|
+
auto __elementJni = std::dynamic_pointer_cast<JHybridFallbackFontSpec>(__element)->getJavaPart();
|
|
107
|
+
__array->setElement(__i, __elementJni.get());
|
|
108
|
+
}
|
|
109
|
+
return __array;
|
|
110
|
+
}());
|
|
111
|
+
}
|
|
112
|
+
std::shared_ptr<Promise<void>> JHybridRiveFontConfigSpec::applyFallbackFonts() {
|
|
113
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("applyFallbackFonts");
|
|
114
|
+
auto __result = method(_javaPart);
|
|
115
|
+
return [&]() {
|
|
116
|
+
auto __promise = Promise<void>::create();
|
|
117
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
118
|
+
__promise->resolve();
|
|
119
|
+
});
|
|
120
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
121
|
+
jni::JniException __jniError(__throwable);
|
|
122
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
123
|
+
});
|
|
124
|
+
return __promise;
|
|
125
|
+
}();
|
|
126
|
+
}
|
|
127
|
+
std::shared_ptr<Promise<void>> JHybridRiveFontConfigSpec::clearFallbackFonts() {
|
|
128
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("clearFallbackFonts");
|
|
129
|
+
auto __result = method(_javaPart);
|
|
130
|
+
return [&]() {
|
|
131
|
+
auto __promise = Promise<void>::create();
|
|
132
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
133
|
+
__promise->resolve();
|
|
134
|
+
});
|
|
135
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
136
|
+
jni::JniException __jniError(__throwable);
|
|
137
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
138
|
+
});
|
|
139
|
+
return __promise;
|
|
140
|
+
}();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
} // namespace margelo::nitro::rive
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRiveFontConfigSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridRiveFontConfigSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::rive {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridRiveFontConfigSpec: public jni::HybridClass<JHybridRiveFontConfigSpec, JHybridObject>,
|
|
22
|
+
public virtual HybridRiveFontConfigSpec {
|
|
23
|
+
public:
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rive/HybridRiveFontConfigSpec;";
|
|
25
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
+
static void registerNatives();
|
|
27
|
+
|
|
28
|
+
protected:
|
|
29
|
+
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
+
explicit JHybridRiveFontConfigSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
+
HybridObject(HybridRiveFontConfigSpec::TAG),
|
|
32
|
+
HybridBase(jThis),
|
|
33
|
+
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
+
|
|
35
|
+
public:
|
|
36
|
+
~JHybridRiveFontConfigSpec() override {
|
|
37
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
size_t getExternalMemorySize() noexcept override;
|
|
43
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override;
|
|
44
|
+
void dispose() noexcept override;
|
|
45
|
+
std::string toString() override;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
inline const jni::global_ref<JHybridRiveFontConfigSpec::javaobject>& getJavaPart() const noexcept {
|
|
49
|
+
return _javaPart;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Properties
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Methods
|
|
58
|
+
std::shared_ptr<Promise<std::shared_ptr<HybridFallbackFontSpec>>> loadFontFromURL(const std::string& url) override;
|
|
59
|
+
std::shared_ptr<HybridFallbackFontSpec> loadFontFromResource(const std::string& resource) override;
|
|
60
|
+
std::shared_ptr<HybridFallbackFontSpec> loadFontFromBytes(const std::shared_ptr<ArrayBuffer>& bytes) override;
|
|
61
|
+
std::shared_ptr<HybridFallbackFontSpec> loadFontByName(const std::string& name) override;
|
|
62
|
+
std::shared_ptr<HybridFallbackFontSpec> getSystemDefaultFont() override;
|
|
63
|
+
void setFontsForWeight(double weight, const std::vector<std::shared_ptr<HybridFallbackFontSpec>>& fonts) override;
|
|
64
|
+
std::shared_ptr<Promise<void>> applyFallbackFonts() override;
|
|
65
|
+
std::shared_ptr<Promise<void>> clearFallbackFonts() override;
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
friend HybridBase;
|
|
69
|
+
using HybridBase::HybridBase;
|
|
70
|
+
jni::global_ref<JHybridRiveFontConfigSpec::javaobject> _javaPart;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::rive
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// HybridFallbackFontSpec.kt
|
|
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
|
|
@@ -13,8 +13,8 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
|
13
13
|
import com.margelo.nitro.core.HybridObject
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* A Kotlin class representing the
|
|
17
|
-
* Implement this abstract class to create Kotlin-based instances of
|
|
16
|
+
* A Kotlin class representing the FallbackFont HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of FallbackFont.
|
|
18
18
|
*/
|
|
19
19
|
@DoNotStrip
|
|
20
20
|
@Keep
|
|
@@ -23,7 +23,7 @@ import com.margelo.nitro.core.HybridObject
|
|
|
23
23
|
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
24
|
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
25
|
)
|
|
26
|
-
abstract class
|
|
26
|
+
abstract class HybridFallbackFontSpec: HybridObject() {
|
|
27
27
|
@DoNotStrip
|
|
28
28
|
private var mHybridData: HybridData = initHybrid()
|
|
29
29
|
|
|
@@ -38,20 +38,18 @@ abstract class HybridRiveSpec: HybridObject() {
|
|
|
38
38
|
|
|
39
39
|
// Default implementation of `HybridObject.toString()`
|
|
40
40
|
override fun toString(): String {
|
|
41
|
-
return "[HybridObject
|
|
41
|
+
return "[HybridObject FallbackFont]"
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Properties
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
// Methods
|
|
48
|
-
|
|
49
|
-
@Keep
|
|
50
|
-
abstract fun multiply(a: Double, b: Double): Double
|
|
48
|
+
|
|
51
49
|
|
|
52
50
|
private external fun initHybrid(): HybridData
|
|
53
51
|
|
|
54
52
|
companion object {
|
|
55
|
-
protected const val TAG = "
|
|
53
|
+
protected const val TAG = "HybridFallbackFontSpec"
|
|
56
54
|
}
|
|
57
55
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRiveFontConfigSpec.kt
|
|
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
|
+
package com.margelo.nitro.rive
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.ArrayBuffer
|
|
15
|
+
import com.margelo.nitro.core.HybridObject
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the RiveFontConfig HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of RiveFontConfig.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridRiveFontConfigSpec: HybridObject() {
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
private var mHybridData: HybridData = initHybrid()
|
|
31
|
+
|
|
32
|
+
init {
|
|
33
|
+
super.updateNative(mHybridData)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun updateNative(hybridData: HybridData) {
|
|
37
|
+
mHybridData = hybridData
|
|
38
|
+
super.updateNative(hybridData)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Default implementation of `HybridObject.toString()`
|
|
42
|
+
override fun toString(): String {
|
|
43
|
+
return "[HybridObject RiveFontConfig]"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// Methods
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
abstract fun loadFontFromURL(url: String): Promise<HybridFallbackFontSpec>
|
|
53
|
+
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
@Keep
|
|
56
|
+
abstract fun loadFontFromResource(resource: String): HybridFallbackFontSpec
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
abstract fun loadFontFromBytes(bytes: ArrayBuffer): HybridFallbackFontSpec
|
|
61
|
+
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
@Keep
|
|
64
|
+
abstract fun loadFontByName(name: String): HybridFallbackFontSpec
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
abstract fun getSystemDefaultFont(): HybridFallbackFontSpec
|
|
69
|
+
|
|
70
|
+
@DoNotStrip
|
|
71
|
+
@Keep
|
|
72
|
+
abstract fun setFontsForWeight(weight: Double, fonts: Array<HybridFallbackFontSpec>): Unit
|
|
73
|
+
|
|
74
|
+
@DoNotStrip
|
|
75
|
+
@Keep
|
|
76
|
+
abstract fun applyFallbackFonts(): Promise<Unit>
|
|
77
|
+
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
abstract fun clearFallbackFonts(): Promise<Unit>
|
|
81
|
+
|
|
82
|
+
private external fun initHybrid(): HybridData
|
|
83
|
+
|
|
84
|
+
companion object {
|
|
85
|
+
protected const val TAG = "HybridRiveFontConfigSpec"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -34,9 +34,10 @@ target_sources(
|
|
|
34
34
|
../nitrogen/generated/android/riveOnLoad.cpp
|
|
35
35
|
# Shared Nitrogen C++ sources
|
|
36
36
|
../nitrogen/generated/shared/c++/HybridBindableArtboardSpec.cpp
|
|
37
|
-
../nitrogen/generated/shared/c++/HybridRiveSpec.cpp
|
|
38
37
|
../nitrogen/generated/shared/c++/HybridRiveFileSpec.cpp
|
|
39
38
|
../nitrogen/generated/shared/c++/HybridRiveFileFactorySpec.cpp
|
|
39
|
+
../nitrogen/generated/shared/c++/HybridFallbackFontSpec.cpp
|
|
40
|
+
../nitrogen/generated/shared/c++/HybridRiveFontConfigSpec.cpp
|
|
40
41
|
../nitrogen/generated/shared/c++/HybridRiveImageSpec.cpp
|
|
41
42
|
../nitrogen/generated/shared/c++/HybridRiveImageFactorySpec.cpp
|
|
42
43
|
../nitrogen/generated/shared/c++/HybridRiveRuntimeSpec.cpp
|
|
@@ -56,9 +57,10 @@ target_sources(
|
|
|
56
57
|
../nitrogen/generated/shared/c++/HybridViewModelArtboardPropertySpec.cpp
|
|
57
58
|
# Android-specific Nitrogen C++ sources
|
|
58
59
|
../nitrogen/generated/android/c++/JHybridBindableArtboardSpec.cpp
|
|
59
|
-
../nitrogen/generated/android/c++/JHybridRiveSpec.cpp
|
|
60
60
|
../nitrogen/generated/android/c++/JHybridRiveFileSpec.cpp
|
|
61
61
|
../nitrogen/generated/android/c++/JHybridRiveFileFactorySpec.cpp
|
|
62
|
+
../nitrogen/generated/android/c++/JHybridFallbackFontSpec.cpp
|
|
63
|
+
../nitrogen/generated/android/c++/JHybridRiveFontConfigSpec.cpp
|
|
62
64
|
../nitrogen/generated/android/c++/JHybridRiveImageSpec.cpp
|
|
63
65
|
../nitrogen/generated/android/c++/JHybridRiveImageFactorySpec.cpp
|
|
64
66
|
../nitrogen/generated/android/c++/JHybridRiveRuntimeSpec.cpp
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridBindableArtboardSpec.hpp"
|
|
19
|
-
#include "JHybridRiveSpec.hpp"
|
|
20
19
|
#include "JHybridRiveFileSpec.hpp"
|
|
21
20
|
#include "JHybridRiveFileFactorySpec.hpp"
|
|
21
|
+
#include "JHybridFallbackFontSpec.hpp"
|
|
22
|
+
#include "JHybridRiveFontConfigSpec.hpp"
|
|
22
23
|
#include "JHybridRiveImageSpec.hpp"
|
|
23
24
|
#include "JHybridRiveImageFactorySpec.hpp"
|
|
24
25
|
#include "JHybridRiveRuntimeSpec.hpp"
|
|
@@ -54,9 +55,10 @@ int initialize(JavaVM* vm) {
|
|
|
54
55
|
return facebook::jni::initialize(vm, [] {
|
|
55
56
|
// Register native JNI methods
|
|
56
57
|
margelo::nitro::rive::JHybridBindableArtboardSpec::registerNatives();
|
|
57
|
-
margelo::nitro::rive::JHybridRiveSpec::registerNatives();
|
|
58
58
|
margelo::nitro::rive::JHybridRiveFileSpec::registerNatives();
|
|
59
59
|
margelo::nitro::rive::JHybridRiveFileFactorySpec::registerNatives();
|
|
60
|
+
margelo::nitro::rive::JHybridFallbackFontSpec::registerNatives();
|
|
61
|
+
margelo::nitro::rive::JHybridRiveFontConfigSpec::registerNatives();
|
|
60
62
|
margelo::nitro::rive::JHybridRiveImageSpec::registerNatives();
|
|
61
63
|
margelo::nitro::rive::JHybridRiveImageFactorySpec::registerNatives();
|
|
62
64
|
margelo::nitro::rive::JHybridRiveRuntimeSpec::registerNatives();
|
|
@@ -83,9 +85,9 @@ int initialize(JavaVM* vm) {
|
|
|
83
85
|
|
|
84
86
|
// Register Nitro Hybrid Objects
|
|
85
87
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
86
|
-
"
|
|
88
|
+
"RiveFontConfig",
|
|
87
89
|
[]() -> std::shared_ptr<HybridObject> {
|
|
88
|
-
static DefaultConstructableObject<
|
|
90
|
+
static DefaultConstructableObject<JHybridRiveFontConfigSpec::javaobject> object("com/margelo/nitro/rive/HybridRiveFontConfig");
|
|
89
91
|
auto instance = object.create();
|
|
90
92
|
return instance->cthis()->shared();
|
|
91
93
|
}
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
11
|
#include "HybridBindableArtboardSpecSwift.hpp"
|
|
12
|
+
#include "HybridFallbackFontSpecSwift.hpp"
|
|
12
13
|
#include "HybridRiveFileFactorySpecSwift.hpp"
|
|
13
14
|
#include "HybridRiveFileSpecSwift.hpp"
|
|
15
|
+
#include "HybridRiveFontConfigSpecSwift.hpp"
|
|
14
16
|
#include "HybridRiveImageFactorySpecSwift.hpp"
|
|
15
17
|
#include "HybridRiveImageSpecSwift.hpp"
|
|
16
18
|
#include "HybridRiveRuntimeSpecSwift.hpp"
|
|
17
|
-
#include "HybridRiveSpecSwift.hpp"
|
|
18
19
|
#include "HybridRiveViewSpecSwift.hpp"
|
|
19
20
|
#include "HybridViewModelArtboardPropertySpecSwift.hpp"
|
|
20
21
|
#include "HybridViewModelBooleanPropertySpecSwift.hpp"
|
|
@@ -49,22 +50,6 @@ namespace margelo::nitro::rive::bridge::swift {
|
|
|
49
50
|
return swiftPart.toUnsafe();
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
// pragma MARK: std::shared_ptr<HybridRiveSpec>
|
|
53
|
-
std::shared_ptr<HybridRiveSpec> create_std__shared_ptr_HybridRiveSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
54
|
-
RNRive::HybridRiveSpec_cxx swiftPart = RNRive::HybridRiveSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
55
|
-
return std::make_shared<margelo::nitro::rive::HybridRiveSpecSwift>(swiftPart);
|
|
56
|
-
}
|
|
57
|
-
void* NON_NULL get_std__shared_ptr_HybridRiveSpec_(std__shared_ptr_HybridRiveSpec_ cppType) {
|
|
58
|
-
std::shared_ptr<margelo::nitro::rive::HybridRiveSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::rive::HybridRiveSpecSwift>(cppType);
|
|
59
|
-
#ifdef NITRO_DEBUG
|
|
60
|
-
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
61
|
-
throw std::runtime_error("Class \"HybridRiveSpec\" is not implemented in Swift!");
|
|
62
|
-
}
|
|
63
|
-
#endif
|
|
64
|
-
RNRive::HybridRiveSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
65
|
-
return swiftPart.toUnsafe();
|
|
66
|
-
}
|
|
67
|
-
|
|
68
53
|
// pragma MARK: std::shared_ptr<HybridViewModelSpec>
|
|
69
54
|
std::shared_ptr<HybridViewModelSpec> create_std__shared_ptr_HybridViewModelSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
70
55
|
RNRive::HybridViewModelSpec_cxx swiftPart = RNRive::HybridViewModelSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -145,6 +130,54 @@ namespace margelo::nitro::rive::bridge::swift {
|
|
|
145
130
|
return swiftPart.toUnsafe();
|
|
146
131
|
}
|
|
147
132
|
|
|
133
|
+
// pragma MARK: std::shared_ptr<HybridFallbackFontSpec>
|
|
134
|
+
std::shared_ptr<HybridFallbackFontSpec> create_std__shared_ptr_HybridFallbackFontSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
135
|
+
RNRive::HybridFallbackFontSpec_cxx swiftPart = RNRive::HybridFallbackFontSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
136
|
+
return std::make_shared<margelo::nitro::rive::HybridFallbackFontSpecSwift>(swiftPart);
|
|
137
|
+
}
|
|
138
|
+
void* NON_NULL get_std__shared_ptr_HybridFallbackFontSpec_(std__shared_ptr_HybridFallbackFontSpec_ cppType) {
|
|
139
|
+
std::shared_ptr<margelo::nitro::rive::HybridFallbackFontSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::rive::HybridFallbackFontSpecSwift>(cppType);
|
|
140
|
+
#ifdef NITRO_DEBUG
|
|
141
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
142
|
+
throw std::runtime_error("Class \"HybridFallbackFontSpec\" is not implemented in Swift!");
|
|
143
|
+
}
|
|
144
|
+
#endif
|
|
145
|
+
RNRive::HybridFallbackFontSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
146
|
+
return swiftPart.toUnsafe();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// pragma MARK: std::function<void(const std::shared_ptr<HybridFallbackFontSpec>& /* result */)>
|
|
150
|
+
Func_void_std__shared_ptr_HybridFallbackFontSpec_ create_Func_void_std__shared_ptr_HybridFallbackFontSpec_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
151
|
+
auto swiftClosure = RNRive::Func_void_std__shared_ptr_HybridFallbackFontSpec_::fromUnsafe(swiftClosureWrapper);
|
|
152
|
+
return [swiftClosure = std::move(swiftClosure)](const std::shared_ptr<HybridFallbackFontSpec>& result) mutable -> void {
|
|
153
|
+
swiftClosure.call(result);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// pragma MARK: std::function<void()>
|
|
158
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
159
|
+
auto swiftClosure = RNRive::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
160
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
161
|
+
swiftClosure.call();
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// pragma MARK: std::shared_ptr<HybridRiveFontConfigSpec>
|
|
166
|
+
std::shared_ptr<HybridRiveFontConfigSpec> create_std__shared_ptr_HybridRiveFontConfigSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
167
|
+
RNRive::HybridRiveFontConfigSpec_cxx swiftPart = RNRive::HybridRiveFontConfigSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
168
|
+
return std::make_shared<margelo::nitro::rive::HybridRiveFontConfigSpecSwift>(swiftPart);
|
|
169
|
+
}
|
|
170
|
+
void* NON_NULL get_std__shared_ptr_HybridRiveFontConfigSpec_(std__shared_ptr_HybridRiveFontConfigSpec_ cppType) {
|
|
171
|
+
std::shared_ptr<margelo::nitro::rive::HybridRiveFontConfigSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::rive::HybridRiveFontConfigSpecSwift>(cppType);
|
|
172
|
+
#ifdef NITRO_DEBUG
|
|
173
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
174
|
+
throw std::runtime_error("Class \"HybridRiveFontConfigSpec\" is not implemented in Swift!");
|
|
175
|
+
}
|
|
176
|
+
#endif
|
|
177
|
+
RNRive::HybridRiveFontConfigSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
178
|
+
return swiftPart.toUnsafe();
|
|
179
|
+
}
|
|
180
|
+
|
|
148
181
|
// pragma MARK: std::function<void(const std::shared_ptr<HybridRiveImageSpec>& /* result */)>
|
|
149
182
|
Func_void_std__shared_ptr_HybridRiveImageSpec_ create_Func_void_std__shared_ptr_HybridRiveImageSpec_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
150
183
|
auto swiftClosure = RNRive::Func_void_std__shared_ptr_HybridRiveImageSpec_::fromUnsafe(swiftClosureWrapper);
|
|
@@ -169,14 +202,6 @@ namespace margelo::nitro::rive::bridge::swift {
|
|
|
169
202
|
return swiftPart.toUnsafe();
|
|
170
203
|
}
|
|
171
204
|
|
|
172
|
-
// pragma MARK: std::function<void()>
|
|
173
|
-
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
174
|
-
auto swiftClosure = RNRive::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
175
|
-
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
176
|
-
swiftClosure.call();
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
205
|
// pragma MARK: std::shared_ptr<HybridRiveRuntimeSpec>
|
|
181
206
|
std::shared_ptr<HybridRiveRuntimeSpec> create_std__shared_ptr_HybridRiveRuntimeSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
182
207
|
RNRive::HybridRiveRuntimeSpec_cxx swiftPart = RNRive::HybridRiveRuntimeSpec_cxx::fromUnsafe(swiftUnsafePointer);
|