From 3e0a19cd7d071e6158b648200c953b13f1f1cd5b Mon Sep 17 00:00:00 2001 From: yulei <1002365491@qq.com> Date: Mon, 16 Jun 2025 10:54:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=9F=E5=BC=83api=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/utils/TextUtils.ets | 5 +++-- entry/src/main/ets/view/TextExpandView.ets | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/entry/src/main/ets/utils/TextUtils.ets b/entry/src/main/ets/utils/TextUtils.ets index 54092f8..58e671c 100644 --- a/entry/src/main/ets/utils/TextUtils.ets +++ b/entry/src/main/ets/utils/TextUtils.ets @@ -112,8 +112,9 @@ export class TextUtils { // Set up paragraph layout // [Start TextUtils_paragraphBuilder] let myTextStyle: text.TextStyle = { - fontSize: fp2px(fontSize) + fontSize: uiContext?.fp2px(fontSize) }; + let myParagraphStyle: text.ParagraphStyle = { textStyle: myTextStyle, align: text.TextAlign.START, @@ -186,7 +187,7 @@ export class TextUtils { textContent: suffix + lastSpan, fontSize: dataModel.fontSize, }); - const widthMore = px2vp(Number(minLinesTextSize.width)); + const widthMore = uiContext?.px2vp(Number(minLinesTextSize.width)); // Calculates the coordinates of the last text before three points let x: number = 0; let y: number = 0; diff --git a/entry/src/main/ets/view/TextExpandView.ets b/entry/src/main/ets/view/TextExpandView.ets index 072e083..623669a 100644 --- a/entry/src/main/ets/view/TextExpandView.ets +++ b/entry/src/main/ets/view/TextExpandView.ets @@ -57,7 +57,7 @@ export struct TextExpandView { constraintWidth: this.textSectionAttribute.constraintWidth, //The text layout width is calculated fontSize: this.textSectionAttribute.fontSize //The text font size is calculated }); - let height = px2vp(Number(titleSize.height)); + let height = this.getUIContext().px2vp(Number(titleSize.height)); if (height <= this.textSectionAttribute.lineHeight * 2) { this.textModifier.needProcess = false; this.textModifier.title = this.textSectionAttribute.title; -- Gitee