From c5b60cb5bee91a558ca415dc72d903fb83e966ab Mon Sep 17 00:00:00 2001 From: ChiaNing Date: Tue, 28 Feb 2023 18:36:47 +0800 Subject: [PATCH] fix export api bug (#14409) --- cocos/2d/utils/index.ts | 1 + cocos/2d/utils/text-utils.ts | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cocos/2d/utils/index.ts b/cocos/2d/utils/index.ts index 0e63c451e8..4f0ef61268 100644 --- a/cocos/2d/utils/index.ts +++ b/cocos/2d/utils/index.ts @@ -25,4 +25,5 @@ import './font-loader'; export * from './html-text-parser'; +export * from './text-utils'; export { dynamicAtlasManager } from './dynamic-atlas/atlas-manager'; diff --git a/cocos/2d/utils/text-utils.ts b/cocos/2d/utils/text-utils.ts index b3e0eb1517..3ba716064d 100644 --- a/cocos/2d/utils/text-utils.ts +++ b/cocos/2d/utils/text-utils.ts @@ -168,7 +168,9 @@ const WRAP_INSPECTION = true; // reference: https://en.wikipedia.org/wiki/UTF-16 const highSurrogateRex = /[\uD800-\uDBFF]/; const lowSurrogateRex = /[\uDC00-\uDFFF]/; - +/** + * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future. + */ export function isUnicodeCJK (ch: string) { const __CHINESE_REG = /^[\u4E00-\u9FFF\u3400-\u4DFF]+$/; const __JAPANESE_REG = /[\u3000-\u303F]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\uFF00-\uFFEF]|[\u4E00-\u9FAF]|[\u2605-\u2606]|[\u2190-\u2195]|\u203B/g; @@ -176,6 +178,9 @@ export function isUnicodeCJK (ch: string) { return __CHINESE_REG.test(ch) || __JAPANESE_REG.test(ch) || __KOREAN_REG.test(ch); } +/** + * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future. + */ // Checking whether the character is a whitespace export function isUnicodeSpace (ch: string) { const chCode = ch.charCodeAt(0); @@ -191,7 +196,9 @@ export function isUnicodeSpace (ch: string) { || chCode === 8287 || chCode === 12288); } - +/** + * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future. + */ export function safeMeasureText (ctx: CanvasRenderingContext2D, string: string, desc?: string) { const font = desc || ctx.font; const key = `${font}\uD83C\uDFAE${string}`; @@ -264,7 +271,9 @@ export function getEnglishWordPartAtLast (stringToken: string) { const result = LAST_ENGLISH_REG.exec(stringToken); return result; } - +/** + * @deprecated since v3.7.2, this is an engine private interface that will be removed in the future. + */ export function fragmentText (stringToken: string, allWidth: number, maxWidth: number, measureText: (string: string) => number) { // check the first character const wrappedWords: string[] = [];