From 0156b892096204380edbf73def5b9077c648d50c Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Thu, 26 Sep 2024 20:22:15 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E7=AC=A6=E6=9B=BF?= =?utf8?q?=E6=8D=A2=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../uicomponents/UIComponents.cpp | 48 +++++++++++++++++++ .../uicomponents/UIComponents.h | 3 ++ 2 files changed, 51 insertions(+) diff --git a/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp b/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp index 53343285e..5c5d51daf 100644 --- a/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp +++ b/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp @@ -1,5 +1,11 @@ #include "uicomponents/UIComponents.h" #include +#include +#include +#include +#include "common/text.h" +#include "common/typed_text.h" +#include "font/ui_font.h" namespace OHOS { @@ -843,4 +849,46 @@ namespace OHOS } return imageArray; } + + void updata_char(char *str_,char *str,uint32_t max_len) + { + strcpy_s(str_,max_len,str); + uint32_t j = 0; + uint32_t letter = 0; + if (str == nullptr) { + return ; + } + while (str[j] != '\0') + { + int i=j; + letter = TypedText::GetUTF8Next(str, j, j); + int len=j-i; + UIFont* fontEngine= UIFont::GetInstance(); + GlyphPathData path; + if(!fontEngine->GetGlyphPathData(letter, 0, path)) + { + printf("********************* letter%d %d %d not exist\r\n",i,j,letter); + char *buf= "□"; + uint16_t buf_len=strlen(buf); + uint16_t offset =0; + int num=len/buf_len; + int mod_num=len%buf_len; + for(int x=0;x