-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
label processing string & remove shared label info #16292
base: develop
Are you sure you want to change the base?
Conversation
@cocos-robot run test cases |
Interface Check Report! WARNING this pull request has changed these public interfaces:
@@ -60083,8 +60083,59 @@
* @param {Number} y
*/
drawTextureAt(image: ImageAsset, x: number, y: number): void;
}
+ export interface _cocos_2d_assembler_label_font_utils__ILabelInfo {
+ fontSize: number;
+ fontFamily: string;
+ fontDesc: string;
+ color: math.Color;
+ isOutlined: boolean;
+ out: math.Color;
+ margin: number;
+ fontScale: number;
+ }
+ export class _cocos_2d_assembler_label_font_utils__LetterTexture {
+ image: ImageAsset | null;
+ labelInfo: _cocos_2d_assembler_label_font_utils__ILabelInfo;
+ char: string;
+ data: _cocos_2d_assembler_label_font_utils__ISharedLabelData | null;
+ canvas: HTMLCanvasElement | null;
+ context: CanvasRenderingContext2D | null;
+ width: number;
+ height: number;
+ offsetY: number;
+ hash: string;
+ constructor(char: string, labelInfo: _cocos_2d_assembler_label_font_utils__ILabelInfo, hash: string);
+ updateRenderData(): void;
+ destroy(): void;
+ }
+ export class _cocos_2d_assembler_label_font_utils__FontLetterDefinition {
+ u: number;
+ v: number;
+ w: number;
+ h: number;
+ texture: _cocos_2d_assembler_label_font_utils__LetterRenderTexture | null;
+ offsetX: number;
+ offsetY: number;
+ valid: boolean;
+ xAdvance: number;
+ }
+ export class _cocos_2d_assembler_label_font_utils__LetterAtlas {
+ get width(): number;
+ get height(): number;
+ fontDefDictionary: _cocos_2d_assets_bitmap_font__FontAtlas;
+ constructor(width: number, height: number);
+ insertLetterTexture(letterTexture: _cocos_2d_assembler_label_font_utils__LetterTexture): _cocos_2d_assembler_label_font_utils__FontLetterDefinition | null;
+ update(): void;
+ reset(): void;
+ destroy(): void;
+ getTexture(): any;
+ beforeSceneLoad(): void;
+ clearAllCache(): void;
+ getLetter(key: string): any;
+ getLetterDefinitionForChar(char: string, style: _cocos_2d_assembler_label_text_style__TextStyle, fontScale: number): any;
+ }
export class _cocos_2d_assembler_label_text_style__TextStyle {
isBold: boolean;
isItalic: boolean;
isUnderline: boolean;
@@ -60106,8 +60157,10 @@
fontFamily: string;
fontDesc: string;
fntConfig: _cocos_2d_assets_bitmap_font__IConfig | null;
spriteFrame: SpriteFrame | null;
+ hash: string;
+ fontAtlas: _cocos_2d_assets_bitmap_font__FontAtlas | _cocos_2d_assembler_label_font_utils__LetterAtlas | null;
fontScale: number;
reset(): void;
}
export class _cocos_2d_assembler_label_text_layout__TextLayout {
@@ -60146,15 +60199,24 @@
uiTransAnchorX: number;
uiTransAnchorY: number;
reset(): void;
}
+ export class _cocos_2d_assembler_label_text_processing__LetterInfo {
+ char: string;
+ valid: boolean;
+ x: number;
+ y: number;
+ line: number;
+ hash: string;
+ }
export class _cocos_2d_assembler_label_text_output_data__TextOutputLayoutData {
parsedString: string[];
nodeContentSize: math.Size;
canvasSize: math.Size;
canvasPadding: math.Rect;
contentSizeExtend: math.Size;
startPosition: math.Vec2;
+ lettersInfo: _cocos_2d_assembler_label_text_processing__LetterInfo[];
reset(): void;
}
export class _cocos_2d_renderer_native_2d__NativeBatcher2d {
syncMeshBuffersToNative(accId: number, buffers: _cocos_2d_renderer_native_2d__NativeUIMeshBuffer[]): any;
|
@cocos-robot run test cases |
@cocos-robot run test cases |
@@ -50,68 +50,6 @@ export const bmfont: IAssembler = { | |||
// Fill All | |||
fillMeshVertices3D(node, renderer, comp.renderData!, tempColor); | |||
}, | |||
|
|||
appendQuad (comp: Label, spriteFrame: SpriteFrame, rect: Rect, rotated: boolean, x: number, y: number, scale: number) { | |||
const renderData = comp.renderData; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里没用了么?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
重复函数
outputRenderData.uiTransAnchorX = trans.anchorX; | ||
outputRenderData.uiTransAnchorY = trans.anchorY; | ||
const fontAsset = comp.font as BitmapFont; | ||
style.fntConfig = fontAsset.fntConfig; // layout only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该直接把 font 传下来,不应该拆成多个传递
|
||
style.color.set(comp.color); | ||
comp.actualFontSize = style.actualFontSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
组件上为什么要缓存这个变量
if (comp.renderData.vertDirty) { | ||
_comp = comp; | ||
_uiTrans = _comp.node._uiProps.uiTransformComp!; | ||
this.updateLayoutData(comp);// Todo: move to layout manager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
更新渲染时,需要先更新布局?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要,只是在此PR中未进行流程分离,在流程分离 PR 中移除了此步
outputLayoutData, | ||
outputRenderData, | ||
comp.string, | ||
this.generateVertexData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么会需要回调?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
由于在两种类型中,顶点处理方式无法统一,所以使用回调函数
Re: #15890
#15693
https://github.com/cocos/3d-tasks/issues/17388
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: