@whetware/react-native-stroke-text 0.0.12 → 0.0.15

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 (31) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/src/main/cpp/cpp-adapter.cpp +4 -1
  3. package/android/src/main/java/com/margelo/nitro/stroketext/HybridStrokeTextView.kt +5 -11
  4. package/android/src/main/java/com/margelo/nitro/stroketext/NitroStrokeTextPackage.kt +2 -2
  5. package/lib/StrokeText.js +2 -1
  6. package/lib/resolveNativeTextTransform.d.ts +7 -0
  7. package/lib/resolveNativeTextTransform.js +8 -0
  8. package/nitro.json +8 -2
  9. package/nitrogen/generated/android/NitroStrokeTextOnLoad.cpp +27 -17
  10. package/nitrogen/generated/android/NitroStrokeTextOnLoad.hpp +13 -4
  11. package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.cpp +72 -78
  12. package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.hpp +19 -22
  13. package/nitrogen/generated/android/c++/JStrokeTextAlign.hpp +2 -2
  14. package/nitrogen/generated/android/c++/JStrokeTextAlignVertical.hpp +2 -2
  15. package/nitrogen/generated/android/c++/JStrokeTextDecorationLine.hpp +2 -2
  16. package/nitrogen/generated/android/c++/JStrokeTextEllipsizeMode.hpp +2 -2
  17. package/nitrogen/generated/android/c++/JStrokeTextFontStyle.hpp +2 -2
  18. package/nitrogen/generated/android/c++/JStrokeTextTransform.hpp +2 -2
  19. package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.cpp +94 -94
  20. package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.hpp +3 -3
  21. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/HybridStrokeTextViewSpec.kt +16 -18
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/views/HybridStrokeTextViewManager.kt +13 -3
  23. package/nitrogen/generated/ios/NitroStrokeText+autolinking.rb +2 -0
  24. package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Bridge.hpp +9 -9
  25. package/nitrogen/generated/ios/c++/views/HybridStrokeTextViewComponent.mm +15 -0
  26. package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec.swift +0 -1
  27. package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec_cxx.swift +147 -46
  28. package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.cpp +5 -36
  29. package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.hpp +8 -5
  30. package/package.json +11 -10
  31. package/android/src/main/java/com/margelo/nitro/stroketext/views/StrokeTextViewManager.kt +0 -15
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @whetware/react-native-stroke-text
2
2
 
3
+ ## 0.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`57b743f`](https://github.com/whetware/react-native-stroke-text/commit/57b743f53c5ef6777be9564d38d2d95c5facb13b) Thanks [@evelant](https://github.com/evelant)! - Keep the native `textTransform` prop concrete during Android measured-line updates so Fabric never sends Nitro a null enum value.
8
+
9
+ ## 0.0.13
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f94116e`](https://github.com/whetware/react-native-stroke-text/commit/f94116e693d2ee77e643d952f6943728e9d52c25) Thanks [@evelant](https://github.com/evelant)! - Fix Android stroke-text wrapping by measuring the outline inset as part of layout, drawing the RN-measured line breaks in the native overlay, aligning native text metrics with React Native Text, and preserving separate fill and outline colors.
14
+
15
+ Regenerate Nitro native bindings with Nitro/Nitrogen 0.36.1 so the Android C++ and Kotlin code builds with React Native 0.86 / Expo 57, including fbjni's current `HybridClass` requirements.
16
+
3
17
  ## 0.0.6
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,9 @@
1
1
  #include <jni.h>
2
+ #include <fbjni/fbjni.h>
2
3
  #include "NitroStrokeTextOnLoad.hpp"
3
4
 
4
5
  JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
5
- return margelo::nitro::stroketext::initialize(vm);
6
+ return facebook::jni::initialize(vm, []() {
7
+ margelo::nitro::stroketext::registerAllNatives();
8
+ });
6
9
  }
@@ -1,8 +1,8 @@
1
1
  package com.margelo.nitro.stroketext
2
2
 
3
3
  import android.view.View
4
- import com.facebook.jni.HybridData
5
4
  import com.facebook.react.uimanager.ThemedReactContext
5
+ import com.margelo.nitro.R.id.associated_hybrid_view_tag
6
6
  import kotlin.math.ceil
7
7
 
8
8
  class HybridStrokeTextView(context: ThemedReactContext) : HybridStrokeTextViewSpec() {
@@ -43,17 +43,11 @@ class HybridStrokeTextView(context: ThemedReactContext) : HybridStrokeTextViewSp
43
43
  if (isDisposed) return
44
44
  isDisposed = true
45
45
  super.dispose()
46
+ }
46
47
 
47
- try {
48
- val hybridDataField = HybridStrokeTextViewSpec::class.java.getDeclaredField("mHybridData")
49
- hybridDataField.isAccessible = true
50
- val hybridData = hybridDataField.get(this) as? HybridData ?: return
51
-
52
- val resetNativeMethod = HybridData::class.java.getDeclaredMethod("resetNative")
53
- resetNativeMethod.isAccessible = true
54
- resetNativeMethod.invoke(hybridData)
55
- } catch (_: Throwable) {
56
- }
48
+ override fun onDropView() {
49
+ strokeTextView.setTag(associated_hybrid_view_tag, null)
50
+ dispose()
57
51
  }
58
52
 
59
53
  override fun afterUpdate() {
@@ -7,12 +7,12 @@ import com.facebook.react.BaseReactPackage
7
7
  import com.facebook.react.ViewManagerOnDemandReactPackage
8
8
  import com.facebook.react.bridge.ModuleSpec
9
9
  import com.facebook.react.uimanager.ViewManager
10
- import com.margelo.nitro.stroketext.views.StrokeTextViewManager
10
+ import com.margelo.nitro.stroketext.views.HybridStrokeTextViewManager
11
11
 
12
12
  class NitroStrokeTextPackage : BaseReactPackage(), ViewManagerOnDemandReactPackage {
13
13
  private val viewManagers: Map<String, ModuleSpec> by lazy {
14
14
  mapOf(
15
- "StrokeTextView" to ModuleSpec.viewManagerSpec { StrokeTextViewManager() }
15
+ "StrokeTextView" to ModuleSpec.viewManagerSpec { HybridStrokeTextViewManager() }
16
16
  )
17
17
  }
18
18
 
package/lib/StrokeText.js CHANGED
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Platform, StyleSheet, Text, View } from 'react-native';
3
3
  import { callback, getHostComponent } from 'react-native-nitro-modules';
4
4
  import StrokeTextViewConfig from '../nitrogen/generated/shared/json/StrokeTextViewConfig.json';
5
+ import { resolveNativeTextTransform } from './resolveNativeTextTransform';
5
6
  const NativeStrokeTextView = getHostComponent('StrokeTextView', () => StrokeTextViewConfig);
6
7
  function resolveText(text, children) {
7
8
  if (typeof text === 'string')
@@ -113,7 +114,7 @@ export function StrokeText({ text, children, style, hybridRef, ...rest }) {
113
114
  const shouldSyncMeasuredLineBreaks = Platform.OS === 'android' && effectiveNumberOfLines == null;
114
115
  const [measuredNativeText, setMeasuredNativeText] = React.useState(undefined);
115
116
  const nativeText = measuredNativeText ?? resolvedText;
116
- const nativeTextTransform = measuredNativeText == null ? effectiveTextTransform : 'none';
117
+ const nativeTextTransform = resolveNativeTextTransform(effectiveTextTransform, measuredNativeText != null);
117
118
  // RN's hidden Text owns measurement, but Android TextView gets its own layout pass.
118
119
  // Compensate for the native stroke inset on every edge, then give that native
119
120
  // pass extra right-side room so one-pixel/font-metric drift cannot turn an RN
@@ -0,0 +1,7 @@
1
+ import type { StrokeTextTransform } from './specs/StrokeTextView.nitro';
2
+ /**
3
+ * Keep the Fabric host prop concrete across text-measurement state changes.
4
+ * React Native represents a removed prop as null during native updates, while
5
+ * Nitro's optional enum converter accepts undefined but rejects null.
6
+ */
7
+ export declare function resolveNativeTextTransform(effectiveTextTransform: StrokeTextTransform | undefined, hasMeasuredNativeText: boolean): StrokeTextTransform;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Keep the Fabric host prop concrete across text-measurement state changes.
3
+ * React Native represents a removed prop as null during native updates, while
4
+ * Nitro's optional enum converter accepts undefined but rejects null.
5
+ */
6
+ export function resolveNativeTextTransform(effectiveTextTransform, hasMeasuredNativeText) {
7
+ return hasMeasuredNativeText ? 'none' : (effectiveTextTransform ?? 'none');
8
+ }
package/nitro.json CHANGED
@@ -14,8 +14,14 @@
14
14
  },
15
15
  "autolinking": {
16
16
  "StrokeTextView": {
17
- "swift": "HybridStrokeTextView",
18
- "kotlin": "HybridStrokeTextView"
17
+ "ios": {
18
+ "language": "swift",
19
+ "implementationClassName": "HybridStrokeTextView"
20
+ },
21
+ "android": {
22
+ "language": "kotlin",
23
+ "implementationClassName": "HybridStrokeTextView"
24
+ }
19
25
  }
20
26
  },
21
27
  "ignorePaths": [
@@ -22,25 +22,35 @@
22
22
  namespace margelo::nitro::stroketext {
23
23
 
24
24
  int initialize(JavaVM* vm) {
25
+ return facebook::jni::initialize(vm, []() {
26
+ ::margelo::nitro::stroketext::registerAllNatives();
27
+ });
28
+ }
29
+
30
+ struct JHybridStrokeTextViewSpecImpl: public jni::JavaClass<JHybridStrokeTextViewSpecImpl, JHybridStrokeTextViewSpec::JavaPart> {
31
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/HybridStrokeTextView;";
32
+ static std::shared_ptr<JHybridStrokeTextViewSpec> create() {
33
+ static const auto constructorFn = javaClassStatic()->getConstructor<JHybridStrokeTextViewSpecImpl::javaobject()>();
34
+ jni::local_ref<JHybridStrokeTextViewSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
35
+ return javaPart->getJHybridStrokeTextViewSpec();
36
+ }
37
+ };
38
+
39
+ void registerAllNatives() {
25
40
  using namespace margelo::nitro;
26
41
  using namespace margelo::nitro::stroketext;
27
- using namespace facebook;
28
-
29
- return facebook::jni::initialize(vm, [] {
30
- // Register native JNI methods
31
- margelo::nitro::stroketext::JHybridStrokeTextViewSpec::registerNatives();
32
- margelo::nitro::stroketext::views::JHybridStrokeTextViewStateUpdater::registerNatives();
33
-
34
- // Register Nitro Hybrid Objects
35
- HybridObjectRegistry::registerHybridObjectConstructor(
36
- "StrokeTextView",
37
- []() -> std::shared_ptr<HybridObject> {
38
- static DefaultConstructableObject<JHybridStrokeTextViewSpec::javaobject> object("com/margelo/nitro/stroketext/HybridStrokeTextView");
39
- auto instance = object.create();
40
- return instance->cthis()->shared();
41
- }
42
- );
43
- });
42
+
43
+ // Register native JNI methods
44
+ margelo::nitro::stroketext::JHybridStrokeTextViewSpec::CxxPart::registerNatives();
45
+ margelo::nitro::stroketext::views::JHybridStrokeTextViewStateUpdater::registerNatives();
46
+
47
+ // Register Nitro Hybrid Objects
48
+ HybridObjectRegistry::registerHybridObjectConstructor(
49
+ "StrokeTextView",
50
+ []() -> std::shared_ptr<HybridObject> {
51
+ return JHybridStrokeTextViewSpecImpl::create();
52
+ }
53
+ );
44
54
  }
45
55
 
46
56
  } // namespace margelo::nitro::stroketext
@@ -6,20 +6,29 @@
6
6
  ///
7
7
 
8
8
  #include <jni.h>
9
+ #include <functional>
9
10
  #include <NitroModules/NitroDefines.hpp>
10
11
 
11
12
  namespace margelo::nitro::stroketext {
12
13
 
14
+ [[deprecated("Use registerNatives() instead.")]]
15
+ int initialize(JavaVM* vm);
16
+
13
17
  /**
14
- * Initializes the native (C++) part of NitroStrokeText, and autolinks all Hybrid Objects.
15
- * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
18
+ * Register the native (C++) part of NitroStrokeText, and autolinks all Hybrid Objects.
19
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
20
+ * inside a `facebook::jni::initialize(vm, ...)` call.
16
21
  * Example:
17
22
  * ```cpp (cpp-adapter.cpp)
18
23
  * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
- * return margelo::nitro::stroketext::initialize(vm);
24
+ * return facebook::jni::initialize(vm, []() {
25
+ * // register all NitroStrokeText HybridObjects
26
+ * margelo::nitro::stroketext::registerNatives();
27
+ * // any other custom registrations go here.
28
+ * });
20
29
  * }
21
30
  * ```
22
31
  */
23
- int initialize(JavaVM* vm);
32
+ void registerAllNatives();
24
33
 
25
34
  } // namespace margelo::nitro::stroketext
@@ -37,281 +37,275 @@ namespace margelo::nitro::stroketext { enum class StrokeTextEllipsizeMode; }
37
37
 
38
38
  namespace margelo::nitro::stroketext {
39
39
 
40
- jni::local_ref<JHybridStrokeTextViewSpec::jhybriddata> JHybridStrokeTextViewSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
41
- return makeCxxInstance(jThis);
42
- }
43
-
44
- void JHybridStrokeTextViewSpec::registerNatives() {
45
- registerHybrid({
46
- makeNativeMethod("initHybrid", JHybridStrokeTextViewSpec::initHybrid),
47
- });
40
+ std::shared_ptr<JHybridStrokeTextViewSpec> JHybridStrokeTextViewSpec::JavaPart::getJHybridStrokeTextViewSpec() {
41
+ auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
42
+ auto castHybridObject = std::dynamic_pointer_cast<JHybridStrokeTextViewSpec>(hybridObject);
43
+ if (castHybridObject == nullptr) [[unlikely]] {
44
+ throw std::runtime_error("Failed to downcast JHybridObject to JHybridStrokeTextViewSpec!");
45
+ }
46
+ return castHybridObject;
48
47
  }
49
48
 
50
- size_t JHybridStrokeTextViewSpec::getExternalMemorySize() noexcept {
51
- static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
52
- return method(_javaPart);
49
+ jni::local_ref<JHybridStrokeTextViewSpec::CxxPart::jhybriddata> JHybridStrokeTextViewSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
50
+ return makeCxxInstance(jThis);
53
51
  }
54
52
 
55
- bool JHybridStrokeTextViewSpec::equals(const std::shared_ptr<HybridObject>& other) {
56
- if (auto otherCast = std::dynamic_pointer_cast<JHybridStrokeTextViewSpec>(other)) {
57
- return _javaPart == otherCast->_javaPart;
53
+ std::shared_ptr<JHybridObject> JHybridStrokeTextViewSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
54
+ auto castJavaPart = jni::dynamic_ref_cast<JHybridStrokeTextViewSpec::JavaPart>(javaPart);
55
+ if (castJavaPart == nullptr) [[unlikely]] {
56
+ throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridStrokeTextViewSpec::JavaPart!");
58
57
  }
59
- return false;
60
- }
61
-
62
- void JHybridStrokeTextViewSpec::dispose() noexcept {
63
- static const auto method = javaClassStatic()->getMethod<void()>("dispose");
64
- method(_javaPart);
58
+ return std::make_shared<JHybridStrokeTextViewSpec>(castJavaPart);
65
59
  }
66
60
 
67
- std::string JHybridStrokeTextViewSpec::toString() {
68
- static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
69
- auto javaString = method(_javaPart);
70
- return javaString->toStdString();
61
+ void JHybridStrokeTextViewSpec::CxxPart::registerNatives() {
62
+ registerHybrid({
63
+ makeNativeMethod("initHybrid", JHybridStrokeTextViewSpec::CxxPart::initHybrid),
64
+ });
71
65
  }
72
66
 
73
67
  // Properties
74
68
  std::string JHybridStrokeTextViewSpec::getText() {
75
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getText");
69
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getText");
76
70
  auto __result = method(_javaPart);
77
71
  return __result->toStdString();
78
72
  }
79
73
  void JHybridStrokeTextViewSpec::setText(const std::string& text) {
80
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* text */)>("setText");
74
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* text */)>("setText");
81
75
  method(_javaPart, jni::make_jstring(text));
82
76
  }
83
77
  std::optional<std::string> JHybridStrokeTextViewSpec::getColor() {
84
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getColor");
78
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getColor");
85
79
  auto __result = method(_javaPart);
86
80
  return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
87
81
  }
88
82
  void JHybridStrokeTextViewSpec::setColor(const std::optional<std::string>& color) {
89
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* color */)>("setColor");
83
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* color */)>("setColor");
90
84
  method(_javaPart, color.has_value() ? jni::make_jstring(color.value()) : nullptr);
91
85
  }
92
86
  std::optional<std::string> JHybridStrokeTextViewSpec::getStrokeColor() {
93
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getStrokeColor");
87
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getStrokeColor");
94
88
  auto __result = method(_javaPart);
95
89
  return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
96
90
  }
97
91
  void JHybridStrokeTextViewSpec::setStrokeColor(const std::optional<std::string>& strokeColor) {
98
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* strokeColor */)>("setStrokeColor");
92
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* strokeColor */)>("setStrokeColor");
99
93
  method(_javaPart, strokeColor.has_value() ? jni::make_jstring(strokeColor.value()) : nullptr);
100
94
  }
101
95
  std::optional<double> JHybridStrokeTextViewSpec::getStrokeWidth() {
102
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getStrokeWidth");
96
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getStrokeWidth");
103
97
  auto __result = method(_javaPart);
104
98
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
105
99
  }
106
100
  void JHybridStrokeTextViewSpec::setStrokeWidth(std::optional<double> strokeWidth) {
107
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* strokeWidth */)>("setStrokeWidth");
101
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* strokeWidth */)>("setStrokeWidth");
108
102
  method(_javaPart, strokeWidth.has_value() ? jni::JDouble::valueOf(strokeWidth.value()) : nullptr);
109
103
  }
110
104
  std::optional<double> JHybridStrokeTextViewSpec::getFontSize() {
111
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getFontSize");
105
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getFontSize");
112
106
  auto __result = method(_javaPart);
113
107
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
114
108
  }
115
109
  void JHybridStrokeTextViewSpec::setFontSize(std::optional<double> fontSize) {
116
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* fontSize */)>("setFontSize");
110
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* fontSize */)>("setFontSize");
117
111
  method(_javaPart, fontSize.has_value() ? jni::JDouble::valueOf(fontSize.value()) : nullptr);
118
112
  }
119
113
  std::optional<std::string> JHybridStrokeTextViewSpec::getFontWeight() {
120
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFontWeight");
114
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFontWeight");
121
115
  auto __result = method(_javaPart);
122
116
  return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
123
117
  }
124
118
  void JHybridStrokeTextViewSpec::setFontWeight(const std::optional<std::string>& fontWeight) {
125
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* fontWeight */)>("setFontWeight");
119
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* fontWeight */)>("setFontWeight");
126
120
  method(_javaPart, fontWeight.has_value() ? jni::make_jstring(fontWeight.value()) : nullptr);
127
121
  }
128
122
  std::optional<std::string> JHybridStrokeTextViewSpec::getFontFamily() {
129
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFontFamily");
123
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFontFamily");
130
124
  auto __result = method(_javaPart);
131
125
  return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
132
126
  }
133
127
  void JHybridStrokeTextViewSpec::setFontFamily(const std::optional<std::string>& fontFamily) {
134
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* fontFamily */)>("setFontFamily");
128
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* fontFamily */)>("setFontFamily");
135
129
  method(_javaPart, fontFamily.has_value() ? jni::make_jstring(fontFamily.value()) : nullptr);
136
130
  }
137
131
  std::optional<StrokeTextFontStyle> JHybridStrokeTextViewSpec::getFontStyle() {
138
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextFontStyle>()>("getFontStyle");
132
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JStrokeTextFontStyle>()>("getFontStyle");
139
133
  auto __result = method(_javaPart);
140
134
  return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
141
135
  }
142
136
  void JHybridStrokeTextViewSpec::setFontStyle(std::optional<StrokeTextFontStyle> fontStyle) {
143
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextFontStyle> /* fontStyle */)>("setFontStyle");
137
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextFontStyle> /* fontStyle */)>("setFontStyle");
144
138
  method(_javaPart, fontStyle.has_value() ? JStrokeTextFontStyle::fromCpp(fontStyle.value()) : nullptr);
145
139
  }
146
140
  std::optional<double> JHybridStrokeTextViewSpec::getLineHeight() {
147
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getLineHeight");
141
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getLineHeight");
148
142
  auto __result = method(_javaPart);
149
143
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
150
144
  }
151
145
  void JHybridStrokeTextViewSpec::setLineHeight(std::optional<double> lineHeight) {
152
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* lineHeight */)>("setLineHeight");
146
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* lineHeight */)>("setLineHeight");
153
147
  method(_javaPart, lineHeight.has_value() ? jni::JDouble::valueOf(lineHeight.value()) : nullptr);
154
148
  }
155
149
  std::optional<double> JHybridStrokeTextViewSpec::getLetterSpacing() {
156
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getLetterSpacing");
150
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getLetterSpacing");
157
151
  auto __result = method(_javaPart);
158
152
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
159
153
  }
160
154
  void JHybridStrokeTextViewSpec::setLetterSpacing(std::optional<double> letterSpacing) {
161
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* letterSpacing */)>("setLetterSpacing");
155
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* letterSpacing */)>("setLetterSpacing");
162
156
  method(_javaPart, letterSpacing.has_value() ? jni::JDouble::valueOf(letterSpacing.value()) : nullptr);
163
157
  }
164
158
  std::optional<StrokeTextAlign> JHybridStrokeTextViewSpec::getTextAlign() {
165
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextAlign>()>("getTextAlign");
159
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JStrokeTextAlign>()>("getTextAlign");
166
160
  auto __result = method(_javaPart);
167
161
  return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
168
162
  }
169
163
  void JHybridStrokeTextViewSpec::setTextAlign(std::optional<StrokeTextAlign> textAlign) {
170
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextAlign> /* textAlign */)>("setTextAlign");
164
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextAlign> /* textAlign */)>("setTextAlign");
171
165
  method(_javaPart, textAlign.has_value() ? JStrokeTextAlign::fromCpp(textAlign.value()) : nullptr);
172
166
  }
173
167
  std::optional<StrokeTextAlignVertical> JHybridStrokeTextViewSpec::getTextAlignVertical() {
174
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextAlignVertical>()>("getTextAlignVertical");
168
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JStrokeTextAlignVertical>()>("getTextAlignVertical");
175
169
  auto __result = method(_javaPart);
176
170
  return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
177
171
  }
178
172
  void JHybridStrokeTextViewSpec::setTextAlignVertical(std::optional<StrokeTextAlignVertical> textAlignVertical) {
179
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextAlignVertical> /* textAlignVertical */)>("setTextAlignVertical");
173
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextAlignVertical> /* textAlignVertical */)>("setTextAlignVertical");
180
174
  method(_javaPart, textAlignVertical.has_value() ? JStrokeTextAlignVertical::fromCpp(textAlignVertical.value()) : nullptr);
181
175
  }
182
176
  std::optional<StrokeTextDecorationLine> JHybridStrokeTextViewSpec::getTextDecorationLine() {
183
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextDecorationLine>()>("getTextDecorationLine");
177
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JStrokeTextDecorationLine>()>("getTextDecorationLine");
184
178
  auto __result = method(_javaPart);
185
179
  return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
186
180
  }
187
181
  void JHybridStrokeTextViewSpec::setTextDecorationLine(std::optional<StrokeTextDecorationLine> textDecorationLine) {
188
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextDecorationLine> /* textDecorationLine */)>("setTextDecorationLine");
182
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextDecorationLine> /* textDecorationLine */)>("setTextDecorationLine");
189
183
  method(_javaPart, textDecorationLine.has_value() ? JStrokeTextDecorationLine::fromCpp(textDecorationLine.value()) : nullptr);
190
184
  }
191
185
  std::optional<StrokeTextTransform> JHybridStrokeTextViewSpec::getTextTransform() {
192
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextTransform>()>("getTextTransform");
186
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JStrokeTextTransform>()>("getTextTransform");
193
187
  auto __result = method(_javaPart);
194
188
  return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
195
189
  }
196
190
  void JHybridStrokeTextViewSpec::setTextTransform(std::optional<StrokeTextTransform> textTransform) {
197
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextTransform> /* textTransform */)>("setTextTransform");
191
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextTransform> /* textTransform */)>("setTextTransform");
198
192
  method(_javaPart, textTransform.has_value() ? JStrokeTextTransform::fromCpp(textTransform.value()) : nullptr);
199
193
  }
200
194
  std::optional<double> JHybridStrokeTextViewSpec::getOpacity() {
201
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getOpacity");
195
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getOpacity");
202
196
  auto __result = method(_javaPart);
203
197
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
204
198
  }
205
199
  void JHybridStrokeTextViewSpec::setOpacity(std::optional<double> opacity) {
206
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* opacity */)>("setOpacity");
200
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* opacity */)>("setOpacity");
207
201
  method(_javaPart, opacity.has_value() ? jni::JDouble::valueOf(opacity.value()) : nullptr);
208
202
  }
209
203
  std::optional<bool> JHybridStrokeTextViewSpec::getAllowFontScaling() {
210
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getAllowFontScaling");
204
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getAllowFontScaling");
211
205
  auto __result = method(_javaPart);
212
206
  return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
213
207
  }
214
208
  void JHybridStrokeTextViewSpec::setAllowFontScaling(std::optional<bool> allowFontScaling) {
215
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* allowFontScaling */)>("setAllowFontScaling");
209
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* allowFontScaling */)>("setAllowFontScaling");
216
210
  method(_javaPart, allowFontScaling.has_value() ? jni::JBoolean::valueOf(allowFontScaling.value()) : nullptr);
217
211
  }
218
212
  std::optional<double> JHybridStrokeTextViewSpec::getMaxFontSizeMultiplier() {
219
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMaxFontSizeMultiplier");
213
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMaxFontSizeMultiplier");
220
214
  auto __result = method(_javaPart);
221
215
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
222
216
  }
223
217
  void JHybridStrokeTextViewSpec::setMaxFontSizeMultiplier(std::optional<double> maxFontSizeMultiplier) {
224
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* maxFontSizeMultiplier */)>("setMaxFontSizeMultiplier");
218
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* maxFontSizeMultiplier */)>("setMaxFontSizeMultiplier");
225
219
  method(_javaPart, maxFontSizeMultiplier.has_value() ? jni::JDouble::valueOf(maxFontSizeMultiplier.value()) : nullptr);
226
220
  }
227
221
  std::optional<bool> JHybridStrokeTextViewSpec::getIncludeFontPadding() {
228
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getIncludeFontPadding");
222
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getIncludeFontPadding");
229
223
  auto __result = method(_javaPart);
230
224
  return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
231
225
  }
232
226
  void JHybridStrokeTextViewSpec::setIncludeFontPadding(std::optional<bool> includeFontPadding) {
233
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* includeFontPadding */)>("setIncludeFontPadding");
227
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* includeFontPadding */)>("setIncludeFontPadding");
234
228
  method(_javaPart, includeFontPadding.has_value() ? jni::JBoolean::valueOf(includeFontPadding.value()) : nullptr);
235
229
  }
236
230
  std::optional<double> JHybridStrokeTextViewSpec::getNumberOfLines() {
237
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getNumberOfLines");
231
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getNumberOfLines");
238
232
  auto __result = method(_javaPart);
239
233
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
240
234
  }
241
235
  void JHybridStrokeTextViewSpec::setNumberOfLines(std::optional<double> numberOfLines) {
242
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* numberOfLines */)>("setNumberOfLines");
236
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* numberOfLines */)>("setNumberOfLines");
243
237
  method(_javaPart, numberOfLines.has_value() ? jni::JDouble::valueOf(numberOfLines.value()) : nullptr);
244
238
  }
245
239
  std::optional<StrokeTextEllipsizeMode> JHybridStrokeTextViewSpec::getEllipsizeMode() {
246
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextEllipsizeMode>()>("getEllipsizeMode");
240
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JStrokeTextEllipsizeMode>()>("getEllipsizeMode");
247
241
  auto __result = method(_javaPart);
248
242
  return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
249
243
  }
250
244
  void JHybridStrokeTextViewSpec::setEllipsizeMode(std::optional<StrokeTextEllipsizeMode> ellipsizeMode) {
251
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextEllipsizeMode> /* ellipsizeMode */)>("setEllipsizeMode");
245
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextEllipsizeMode> /* ellipsizeMode */)>("setEllipsizeMode");
252
246
  method(_javaPart, ellipsizeMode.has_value() ? JStrokeTextEllipsizeMode::fromCpp(ellipsizeMode.value()) : nullptr);
253
247
  }
254
248
  std::optional<double> JHybridStrokeTextViewSpec::getPadding() {
255
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPadding");
249
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPadding");
256
250
  auto __result = method(_javaPart);
257
251
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
258
252
  }
259
253
  void JHybridStrokeTextViewSpec::setPadding(std::optional<double> padding) {
260
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* padding */)>("setPadding");
254
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* padding */)>("setPadding");
261
255
  method(_javaPart, padding.has_value() ? jni::JDouble::valueOf(padding.value()) : nullptr);
262
256
  }
263
257
  std::optional<double> JHybridStrokeTextViewSpec::getPaddingVertical() {
264
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingVertical");
258
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingVertical");
265
259
  auto __result = method(_javaPart);
266
260
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
267
261
  }
268
262
  void JHybridStrokeTextViewSpec::setPaddingVertical(std::optional<double> paddingVertical) {
269
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingVertical */)>("setPaddingVertical");
263
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingVertical */)>("setPaddingVertical");
270
264
  method(_javaPart, paddingVertical.has_value() ? jni::JDouble::valueOf(paddingVertical.value()) : nullptr);
271
265
  }
272
266
  std::optional<double> JHybridStrokeTextViewSpec::getPaddingHorizontal() {
273
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingHorizontal");
267
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingHorizontal");
274
268
  auto __result = method(_javaPart);
275
269
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
276
270
  }
277
271
  void JHybridStrokeTextViewSpec::setPaddingHorizontal(std::optional<double> paddingHorizontal) {
278
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingHorizontal */)>("setPaddingHorizontal");
272
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingHorizontal */)>("setPaddingHorizontal");
279
273
  method(_javaPart, paddingHorizontal.has_value() ? jni::JDouble::valueOf(paddingHorizontal.value()) : nullptr);
280
274
  }
281
275
  std::optional<double> JHybridStrokeTextViewSpec::getPaddingTop() {
282
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingTop");
276
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingTop");
283
277
  auto __result = method(_javaPart);
284
278
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
285
279
  }
286
280
  void JHybridStrokeTextViewSpec::setPaddingTop(std::optional<double> paddingTop) {
287
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingTop */)>("setPaddingTop");
281
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingTop */)>("setPaddingTop");
288
282
  method(_javaPart, paddingTop.has_value() ? jni::JDouble::valueOf(paddingTop.value()) : nullptr);
289
283
  }
290
284
  std::optional<double> JHybridStrokeTextViewSpec::getPaddingRight() {
291
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingRight");
285
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingRight");
292
286
  auto __result = method(_javaPart);
293
287
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
294
288
  }
295
289
  void JHybridStrokeTextViewSpec::setPaddingRight(std::optional<double> paddingRight) {
296
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingRight */)>("setPaddingRight");
290
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingRight */)>("setPaddingRight");
297
291
  method(_javaPart, paddingRight.has_value() ? jni::JDouble::valueOf(paddingRight.value()) : nullptr);
298
292
  }
299
293
  std::optional<double> JHybridStrokeTextViewSpec::getPaddingBottom() {
300
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingBottom");
294
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingBottom");
301
295
  auto __result = method(_javaPart);
302
296
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
303
297
  }
304
298
  void JHybridStrokeTextViewSpec::setPaddingBottom(std::optional<double> paddingBottom) {
305
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingBottom */)>("setPaddingBottom");
299
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingBottom */)>("setPaddingBottom");
306
300
  method(_javaPart, paddingBottom.has_value() ? jni::JDouble::valueOf(paddingBottom.value()) : nullptr);
307
301
  }
308
302
  std::optional<double> JHybridStrokeTextViewSpec::getPaddingLeft() {
309
- static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingLeft");
303
+ static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingLeft");
310
304
  auto __result = method(_javaPart);
311
305
  return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
312
306
  }
313
307
  void JHybridStrokeTextViewSpec::setPaddingLeft(std::optional<double> paddingLeft) {
314
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingLeft */)>("setPaddingLeft");
308
+ static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingLeft */)>("setPaddingLeft");
315
309
  method(_javaPart, paddingLeft.has_value() ? jni::JDouble::valueOf(paddingLeft.value()) : nullptr);
316
310
  }
317
311