Skip to content

Optimize LabelComponent #18762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: v3.8.7
Choose a base branch
from
Open

Optimize LabelComponent #18762

wants to merge 2 commits into from

Conversation

yanjifa
Copy link
Contributor

@yanjifa yanjifa commented Jun 4, 2025

Re: #

Changelog

  • en: cc.Label._actualFontSize does not need to be serialized, as it will be calculated in real-time during actual rendering.
  • zh: cc.Label._actualFontSize 没有必要序列化,实际渲染时会实时计算

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@yanjifa yanjifa changed the title label optimize Optimize LabelComponent Jun 4, 2025
@yanjifa
Copy link
Contributor Author

yanjifa commented Jun 4, 2025

@star-e Please assign a reviewer

Copy link

github-actions bot commented Jun 4, 2025

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1006343 bytes 1006252 bytes 👍 -91 bytes
2D All (legacy pipeline) 2671535 bytes 2671440 bytes 👍 -95 bytes
2D All (new pipeline) 2760985 bytes 2760891 bytes 👍 -94 bytes
(2D + 3D) All 10017290 bytes 10017194 bytes 👍 -96 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16838813 bytes 16838717 bytes 👍 -96 bytes

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -2407,12 +2407,12 @@
         get verticalAlign(): VerticalTextAlignment;
         set verticalAlign(value: VerticalTextAlignment);
         /**
          * @en
-         * The actual rendering font size in shrink mode.
+         * The actual rendering font size.
          *
          * @zh
-         * SHRINK 模式下面文本实际渲染的字体大小。
+         * 文本实际渲染的字体大小。
          */
         get actualFontSize(): number;
         set actualFontSize(value: number);
         /**
@@ -2612,9 +2612,8 @@
         get _bmFontOriginalSize(): number;
         protected _string: string;
         protected _horizontalAlign: HorizontalTextAlignment;
         protected _verticalAlign: VerticalTextAlignment;
-        protected _actualFontSize: number;
         protected _fontSize: number;
         protected _fontFamily: string;
         protected _lineHeight: number;
         protected _overflow: Overflow;
@@ -2633,9 +2632,9 @@
         protected _enableShadow: boolean;
         protected _shadowColor: math.Color;
         protected _shadowOffset: math.Vec2;
         protected _shadowBlur: number;
-        protected _N$file: Font | null;
+        protected _actualFontSize: number;
         protected _texture: SpriteFrame | __private._cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
         protected _ttfSpriteFrame: SpriteFrame | null;
         protected _userDefinedFont: Font | null;
         protected _assemblerData: __private._cocos_2d_assembler_label_font_utils__ISharedLabelData | null;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant