From 9eb421114af956170a19120f440482030a25ace9 Mon Sep 17 00:00:00 2001 From: lancer Date: Sat, 21 Jun 2025 20:24:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtext=20fontSize=E7=9A=84xts?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20Signed-off-by:=20haoshuo=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../declarative_frontend/jsview/js_text.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frameworks/bridge/declarative_frontend/jsview/js_text.cpp b/frameworks/bridge/declarative_frontend/jsview/js_text.cpp index aa69fe323cb..978e2d1634d 100644 --- a/frameworks/bridge/declarative_frontend/jsview/js_text.cpp +++ b/frameworks/bridge/declarative_frontend/jsview/js_text.cpp @@ -193,20 +193,21 @@ void JSText::SetFontSize(const JSCallbackInfo& info) } CalcDimension fontSize; RefPtr resObj; - if (ParseJsDimensionNG(info[0], fontSize, DimensionUnit::FP, resObj, false)) { - if (SystemProperties::ConfigChangePerform() && resObj) { - RegisterResource("FontSize", resObj, fontSize); - return; - } - } else { + UnRegisterResource("FontSize"); + JSRef args = info[0]; + if (!ParseJsDimensionFpNG(args, fontSize, resObj, false) || fontSize.IsNegative()) { auto pipelineContext = PipelineContext::GetCurrentContextSafelyWithCheck(); CHECK_NULL_VOID(pipelineContext); auto theme = pipelineContext->GetTheme(); CHECK_NULL_VOID(theme); fontSize = theme->GetTextStyle().GetFontSize(); + TextModel::GetInstance()->SetFontSize(fontSize); + return; } - UnRegisterResource("FontSize"); TextModel::GetInstance()->SetFontSize(fontSize); + if (SystemProperties::ConfigChangePerform() && resObj) { + RegisterResource("FontSize", resObj, fontSize); + } } void JSText::SetFontWeight(const JSCallbackInfo& info) -- Gitee