From 8ee3cd18f3771e8f6f4fcddf680413918f42ff66 Mon Sep 17 00:00:00 2001 From: Dark <3166955090@qq.com> Date: Fri, 24 Jan 2025 11:11:54 +0800 Subject: [PATCH 1/2] config: RN Tester add fontSizeScale config Signed-off-by: Dark <3166955090@qq.com> --- tester/harmony/AppScope/app.json5 | 1 + .../AppScope/resources/base/profile/configuration.json | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 tester/harmony/AppScope/resources/base/profile/configuration.json diff --git a/tester/harmony/AppScope/app.json5 b/tester/harmony/AppScope/app.json5 index d6694f26..b9bc6557 100644 --- a/tester/harmony/AppScope/app.json5 +++ b/tester/harmony/AppScope/app.json5 @@ -6,5 +6,6 @@ "versionName": "1.0.0", "icon": "$media:app_icon", "label": "$string:app_name", + "configuration": "$profile:configuration" } } diff --git a/tester/harmony/AppScope/resources/base/profile/configuration.json b/tester/harmony/AppScope/resources/base/profile/configuration.json new file mode 100644 index 00000000..5bdd4f03 --- /dev/null +++ b/tester/harmony/AppScope/resources/base/profile/configuration.json @@ -0,0 +1,6 @@ +{ + "configuration": { + "fontSizeMaxScale": "3.2", + "fontSizeScale": "followSystem" + } +} \ No newline at end of file -- Gitee From b72c11f363c90470e31fed4b9e599b4a258b2555 Mon Sep 17 00:00:00 2001 From: Dark <3166955090@qq.com> Date: Fri, 24 Jan 2025 11:12:05 +0800 Subject: [PATCH 2/2] fix: MaxFontSizeMultiplier property adds a judgment greater than or equal to 1 Signed-off-by: Dark <3166955090@qq.com> --- .../react_native_openharmony/src/main/cpp/RNOH/TextMeasurer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/TextMeasurer.cpp b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/TextMeasurer.cpp index a63356b4..b2cbed77 100644 --- a/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/TextMeasurer.cpp +++ b/tester/harmony/react_native_openharmony/src/main/cpp/RNOH/TextMeasurer.cpp @@ -41,7 +41,7 @@ TextMeasurement TextMeasurer::measure( float fontMultiplier = 1.0; if (paragraphAttributes.allowFontScaling) { fontMultiplier = m_fontScale; - if (!isnan(paragraphAttributes.maxFontSizeMultiplier)) { + if (!isnan(paragraphAttributes.maxFontSizeMultiplier) && paragraphAttributes.maxFontSizeMultiplier >= 1) { fontMultiplier = std::min(m_fontScale, (float)paragraphAttributes.maxFontSizeMultiplier); } } -- Gitee