From b189b3f28c335ae44ef308cc9f1b229d89f64147 Mon Sep 17 00:00:00 2001 From: zhoukc42 <1540623907@qq.com> Date: Sat, 15 Feb 2025 11:17:20 +0000 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20allowFontScalling=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D-=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoukc42 <1540623907@qq.com> --- .../src/main/cpp/RNOH/arkui/TextAreaNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp index a8b37c1a..bcfdd5f7 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp @@ -171,7 +171,7 @@ void TextAreaNode::setFont( fontStyle = ARKUI_FONT_STYLE_ITALIC; } - float fontSize = 16; + float fontSize = DEFAULT_FONT_SIZE; if (!std::isnan(textAttributes.fontSize)) { fontSize = static_cast(textAttributes.fontSize); } -- Gitee From cabc4f51ac5d0514bae74a08c2e854de87b22953 Mon Sep 17 00:00:00 2001 From: zhoukc42 <1540623907@qq.com> Date: Sat, 15 Feb 2025 11:20:15 +0000 Subject: [PATCH 2/6] =?UTF-8?q?fix:allowFontScalling=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D--textinput=E9=BB=98=E8=AE=A4=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoukc42 <1540623907@qq.com> --- .../src/main/cpp/RNOH/arkui/TextInputNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp index c1766166..09c31b4b 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp @@ -246,7 +246,7 @@ void TextInputNode::setFont( fontStyle = ARKUI_FONT_STYLE_ITALIC; } - float fontSize = 16; + float fontSize = DEFAULT_FONT_SIZE; if (!std::isnan(textAttributes.fontSize)) { fontSize = static_cast(textAttributes.fontSize); } -- Gitee From 62bdf172fef16fe408f8842025f3acd59d1ff911 Mon Sep 17 00:00:00 2001 From: zhoukc42 <1540623907@qq.com> Date: Sat, 15 Feb 2025 11:49:39 +0000 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20allowFontScaling=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E4=B8=BAfalse=E4=B8=8D=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoukc42 <1540623907@qq.com> --- .../main/cpp/RNOH/arkui/TextInputNodeBase.cpp | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp index ea570d01..aeed1851 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp @@ -92,29 +92,26 @@ void TextInputNodeBase::setCommonFontAttributes( m_nodeHandle, NODE_FONT_FAMILY, &item)); } - if (std::isnan(textAttributes.fontSize)) { - maybeThrow(NativeNodeApi::getInstance()->resetAttribute( - m_nodeHandle, NODE_FONT_SIZE)); + bool allowFontScaling = true; + if (textAttributes.allowFontScaling.has_value()) { + allowFontScaling = textAttributes.allowFontScaling.value(); + } + if (!allowFontScaling) { + maybeThrow(NativeNodeApi::getInstance()->setLengthMetricUnit( + m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_VP)); } else { - bool allowFontScaling = true; - if (textAttributes.allowFontScaling.has_value()) { - allowFontScaling = textAttributes.allowFontScaling.value(); - } + maybeThrow(NativeNodeApi::getInstance()->setLengthMetricUnit( + m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_FP)); + } - float fontSize = static_cast(textAttributes.fontSize); - if (!allowFontScaling) { - maybeThrow(NativeNodeApi::getInstance()->setLengthMetricUnit( - m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_VP)); - } else { - maybeThrow(NativeNodeApi::getInstance()->setLengthMetricUnit( - m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_FP)); - } - std::array value = { - {{.f32 = fontSize}}}; - ArkUI_AttributeItem item = {value.data(), value.size()}; - maybeThrow(NativeNodeApi::getInstance()->setAttribute( - m_nodeHandle, NODE_FONT_SIZE, &item)); + float fontSize = DEFAULT_FONT_SIZE; + if (!std::isnan(textAttributes.fontSize)) { + fontSize = static_cast(textAttributes.fontSize); } + std::array value = {{{.f32 = fontSize}}}; + ArkUI_AttributeItem item = {value.data(), value.size()}; + maybeThrow(NativeNodeApi::getInstance()->setAttribute( + m_nodeHandle, NODE_FONT_SIZE, &item)); if (textAttributes.fontWeight.has_value()) { std::array value = { -- Gitee From c90d9fb2eb3373c8246b80692e8aa6545c57bbb8 Mon Sep 17 00:00:00 2001 From: zhoukc42 <1540623907@qq.com> Date: Sat, 15 Feb 2025 11:52:11 +0000 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20allowFontScaling=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D--=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoukc42 <1540623907@qq.com> --- .../src/main/cpp/RNOH/arkui/TextInputNodeBase.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h index 6f8b6aac..375565fd 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h @@ -18,6 +18,7 @@ class TextInputNodeBase : public ArkUINode { TextInputNodeBase(ArkUI_NodeType nodeType); void setCommonFontAttributes( facebook::react::TextAttributes const& textAttributes); + const float DEFAULT_FONT_SIZE = 16.0; public: void setPadding( -- Gitee From 2775adffc4eb047d1758b2893b522c5a72bb3e2c Mon Sep 17 00:00:00 2001 From: zhoukc42 <1540623907@qq.com> Date: Mon, 17 Feb 2025 01:30:03 +0000 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20TextInput=E4=BB=A3=E7=A0=81=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoukc42 <1540623907@qq.com> --- .../src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp index aeed1851..2b18b56b 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp @@ -98,7 +98,7 @@ void TextInputNodeBase::setCommonFontAttributes( } if (!allowFontScaling) { maybeThrow(NativeNodeApi::getInstance()->setLengthMetricUnit( - m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_VP)); + m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_VP)); } else { maybeThrow(NativeNodeApi::getInstance()->setLengthMetricUnit( m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_FP)); -- Gitee From e3ca2337b09669dfaac5c55a0f786862f1fa431e Mon Sep 17 00:00:00 2001 From: zhoukc42 <1540623907@qq.com> Date: Mon, 17 Feb 2025 20:01:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=8C=89=E7=85=A7=E9=A9=BC=E5=B3=B0?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhoukc42 <1540623907@qq.com> --- .../src/main/cpp/RNOH/arkui/TextAreaNode.cpp | 2 +- .../src/main/cpp/RNOH/arkui/TextInputNode.cpp | 2 +- .../src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp | 2 +- .../src/main/cpp/RNOH/arkui/TextInputNodeBase.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp index bcfdd5f7..cc57d7a3 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextAreaNode.cpp @@ -171,7 +171,7 @@ void TextAreaNode::setFont( fontStyle = ARKUI_FONT_STYLE_ITALIC; } - float fontSize = DEFAULT_FONT_SIZE; + float fontSize = defaultFontSize; if (!std::isnan(textAttributes.fontSize)) { fontSize = static_cast(textAttributes.fontSize); } diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp index 09c31b4b..968109e6 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNode.cpp @@ -246,7 +246,7 @@ void TextInputNode::setFont( fontStyle = ARKUI_FONT_STYLE_ITALIC; } - float fontSize = DEFAULT_FONT_SIZE; + float fontSize = defaultFontSize; if (!std::isnan(textAttributes.fontSize)) { fontSize = static_cast(textAttributes.fontSize); } diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp index 2b18b56b..5c148b22 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.cpp @@ -104,7 +104,7 @@ void TextInputNodeBase::setCommonFontAttributes( m_nodeHandle, ArkUI_LengthMetricUnit::ARKUI_LENGTH_METRIC_UNIT_FP)); } - float fontSize = DEFAULT_FONT_SIZE; + float fontSize = defaultFontSize; if (!std::isnan(textAttributes.fontSize)) { fontSize = static_cast(textAttributes.fontSize); } diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h index 375565fd..c5210391 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/arkui/TextInputNodeBase.h @@ -18,7 +18,7 @@ class TextInputNodeBase : public ArkUINode { TextInputNodeBase(ArkUI_NodeType nodeType); void setCommonFontAttributes( facebook::react::TextAttributes const& textAttributes); - const float DEFAULT_FONT_SIZE = 16.0; + const float defaultFontSize = 16.0; public: void setPadding( -- Gitee