Skip to content

Commit

Permalink
useless remove
Browse files Browse the repository at this point in the history
  • Loading branch information
LinYunMo committed Sep 11, 2023
1 parent 1bf1d16 commit f640f84
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cocos/2d/assembler/label/bmfontUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export const bmfontUtils = {
}
const fontAsset = comp.font as BitmapFont;
style.fntConfig = fontAsset.fntConfig; // layout only
style.originFontSize = fontAsset.fntConfig?.fontSize; //both // 是否需要防护?
style.originFontSize = fontAsset.fntConfig?.fontSize; //both
style.fontAtlas = fontAsset.fontDefDictionary;
if (!style.fontAtlas) { // 为了避免后面的判断?看能不能删掉
style.fontAtlas = _defaultFontAtlas; // 容错?不要容错!
if (!style.fontAtlas) {
style.fontAtlas = _defaultFontAtlas;
}

style.isOutlined = false;
Expand Down
4 changes: 2 additions & 2 deletions cocos/2d/assembler/label/font-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const BASELINE_OFFSET = getBaselineOffset();

class LetterTexture {
public image: ImageAsset | null = null;
public labelInfo: ILabelInfo; // 传入的临时变量 // 如果说一定要一份数据的话,那只在这儿存一份就可以// 比方说在初始化的时候给一份数据
public labelInfo: ILabelInfo;
public char: string;
public data: ISharedLabelData | null = null;
public canvas: HTMLCanvasElement | null = null;
Expand All @@ -129,7 +129,7 @@ class LetterTexture {
public hash: string;
constructor (char: string, labelInfo: ILabelInfo, hash: string) {
this.char = char;
this.labelInfo = labelInfo; // 对象引用,不太行 // 对象集合
this.labelInfo = labelInfo;
this.hash = `${char.charCodeAt(0)}${hash}`;
}

Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/assembler/label/letter-font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ export const letterFont = js.mixin(bmfontUtils, {

style.fontDesc = this._getFontDesc(style.fontSize, style.fontFamily);
style.color.set(comp.color);
style.hash = computeHash(style.color, style.isOutlined, style.outlineWidth, style.outlineColor, style.fontSize, style.fontFamily); // todo, 要删掉 // 实际上也是数据集合而已
style.hash = computeHash(style.color, style.isOutlined, style.outlineWidth, style.outlineColor, style.fontSize, style.fontFamily);
},
});
2 changes: 1 addition & 1 deletion cocos/2d/assembler/label/text-processing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ export class TextProcessing {
if (!letterDef) {
this._recordPlaceholderInfo(letterIndex, character, style.hash, outputLayoutData.lettersInfo);
log(`Can't find letter definition in texture atlas ${
style.fntConfig!.atlasName} for letter:${character}`); // char 模式没有 fntConfig
style.fntConfig!.atlasName} for letter:${character}`);
continue;
}

Expand Down

0 comments on commit f640f84

Please sign in to comment.