Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
807b529d
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
大约 1 年 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
807b529d
编写于
4月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!654 修改彩色字符判断逻辑 增加searchList多字体查询
Merge pull request !654 from pssea/OpenHarmony-2.2-Beta2
上级
41695451
ee5cd1b2
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
71 addition
and
36 deletion
+71
-36
frameworks/common/typed_text.cpp
frameworks/common/typed_text.cpp
+9
-2
frameworks/common/typed_text.h
frameworks/common/typed_text.h
+1
-1
frameworks/draw/draw_label.cpp
frameworks/draw/draw_label.cpp
+3
-3
frameworks/font/ui_font.cpp
frameworks/font/ui_font.cpp
+25
-0
frameworks/font/ui_font_bitmap.cpp
frameworks/font/ui_font_bitmap.cpp
+21
-21
frameworks/font/ui_font_vector.cpp
frameworks/font/ui_font_vector.cpp
+4
-3
frameworks/font/ui_line_break.cpp
frameworks/font/ui_line_break.cpp
+5
-5
frameworks/font/ui_line_break.h
frameworks/font/ui_line_break.h
+1
-1
interfaces/kits/font/ui_font.h
interfaces/kits/font/ui_font.h
+2
-0
未找到文件。
frameworks/common/typed_text.cpp
浏览文件 @
807b529d
...
...
@@ -455,9 +455,16 @@ bool TypedText::IsEmojiBase(uint32_t codePoint)
}
}
bool
TypedText
::
IsColourWord
(
uint32_t
fontId
)
bool
TypedText
::
IsColourWord
(
uint32_t
codePoint
,
uint8_t
fontId
,
uint8_t
fontSize
)
{
uint8_t
weight
=
UIFont
::
GetInstance
()
->
GetFontWeight
(
fontId
);
GlyphNode
glyphNode
;
int8_t
ret
=
UIFont
::
GetInstance
()
->
GetGlyphNode
(
codePoint
,
glyphNode
,
fontId
,
fontSize
);
if
(
ret
!=
RET_VALUE_OK
)
{
GRAPHIC_LOGE
(
"Failed to get glyphNode for color word"
);
return
false
;
}
uint8_t
weight
=
UIFont
::
GetInstance
()
->
GetFontWeight
(
glyphNode
.
fontId
);
return
(
weight
>=
16
);
// 16: rgb565->16 rgba8888->32 font with rgba
}
}
// namespace OHOS
frameworks/common/typed_text.h
浏览文件 @
807b529d
...
...
@@ -90,7 +90,7 @@ public:
static
bool
IsEmojiModifier
(
uint32_t
codePoint
);
static
bool
IsEmojiBase
(
uint32_t
codePoint
);
static
bool
IsColourWord
(
uint32_t
fontId
);
static
bool
IsColourWord
(
uint32_t
codePoint
,
uint8_t
fontId
,
uint8_t
fontSize
);
private:
static
bool
GetWrapPoint
(
const
char
*
text
,
uint32_t
&
breakPoint
);
...
...
frameworks/draw/draw_label.cpp
浏览文件 @
807b529d
...
...
@@ -42,7 +42,7 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf
uint16_t
retOffsetY
=
0
;
// ret value elipse offsetY
bool
isEmoijLerge
=
true
;
uint16_t
offsetPosY
=
0
;
offsetPosY
=
fontEngine
->
GetOffsetPosY
(
labelLine
.
text
,
labelLine
.
lineLength
,
isEmoijLerge
,
labelLine
.
fontId
,
offsetPosY
=
fontEngine
->
GetOffsetPosY
(
labelLine
.
text
,
labelLine
.
lineLength
,
isEmoijLerge
,
labelLine
.
fontId
,
labelLine
.
fontSize
);
uint8_t
maxLetterSize
=
GetLineMaxLetterSize
(
labelLine
.
text
,
labelLine
.
lineLength
,
labelLine
.
fontId
,
labelLine
.
fontSize
,
letterIndex
,
labelLine
.
sizeSpans
);
...
...
@@ -86,7 +86,7 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf
labelLine
.
style
.
lineSpace_
,
havebackgroundColor
,
backgroundColor
};
if
(
TypedText
::
IsColourWord
(
letter
Info
.
fontId
))
{
if
(
TypedText
::
IsColourWord
(
letter
,
fontId
,
fontSize
))
{
if
(
!
isEmoijLerge
)
{
letterInfo
.
offsetY
=
offsetPosY
;
}
...
...
@@ -118,7 +118,7 @@ uint8_t DrawLabel::GetLineMaxLetterSize(const char* text, uint16_t lineLength, u
uint8_t
maxLetterSize
=
fontSize
;
while
(
i
<
lineLength
)
{
unicode
=
TypedText
::
GetUTF8Next
(
text
,
i
,
i
);
if
(
TypedText
::
IsColourWord
(
fontId
))
{
if
(
TypedText
::
IsColourWord
(
unicode
,
fontId
,
fontSize
))
{
letterIndex
++
;
continue
;
}
...
...
frameworks/font/ui_font.cpp
浏览文件 @
807b529d
...
...
@@ -100,6 +100,31 @@ uint8_t* UIFont::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontI
return
nullptr
;
}
int8_t
UIFont
::
GetGlyphNode
(
uint32_t
unicode
,
GlyphNode
&
glyphNode
,
uint8_t
fontId
,
uint8_t
fontSize
)
{
int8_t
result
=
instance_
->
GetGlyphNode
(
unicode
,
glyphNode
,
fontId
,
fontSize
);
if
(
result
==
RET_VALUE_OK
)
{
return
result
;
}
#if ENABLE_MULTI_FONT
uint8_t
*
searchLists
=
nullptr
;
int8_t
listSize
=
UIMultiFontManager
::
GetInstance
()
->
GetSearchFontList
(
fontId
,
&
searchLists
);
if
((
searchLists
==
nullptr
)
||
(
listSize
==
0
))
{
return
INVALID_RET_VALUE
;
}
int8_t
currentIndex
=
0
;
do
{
result
=
instance_
->
GetGlyphNode
(
unicode
,
glyphNode
,
searchLists
[
currentIndex
],
fontSize
);
if
(
result
==
RET_VALUE_OK
)
{
return
result
;
}
currentIndex
++
;
}
while
((
currentIndex
<
listSize
)
&&
(
searchLists
!=
nullptr
));
#endif
return
INVALID_RET_VALUE
;
}
uint16_t
UIFont
::
GetWidth
(
uint32_t
unicode
,
uint8_t
fontId
,
uint8_t
fontSize
,
uint8_t
shapingId
)
{
int16_t
result
;
...
...
frameworks/font/ui_font_bitmap.cpp
浏览文件 @
807b529d
...
...
@@ -151,30 +151,29 @@ int8_t UIFontBitmap::GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8
#if ENABLE_MULTI_FONT
int8_t
UIFontBitmap
::
GetMultiGlyphNode
(
uint32_t
unicode
,
GlyphNode
&
glyphNode
,
uint8_t
fontId
)
{
if
(
TypedText
::
IsColourWord
(
fontId
))
{
int8_t
ret
;
uint8_t
*
searchLists
=
nullptr
;
//uint8_t baseId = GetBaseFontId();
int8_t
listSize
=
UIMultiFontManager
::
GetInstance
()
->
GetSearchFontList
(
fontId
,
&
searchLists
);
int8_t
currentIndex
=
0
;
if
((
searchLists
==
nullptr
)
||
(
listSize
==
0
))
{
return
INVALID_RET_VALUE
;
}
do
{
ret
=
GetGlyphNode
(
unicode
,
glyphNode
,
searchLists
[
currentIndex
]);
if
(
ret
!=
INVALID_RET_VALUE
)
{
return
ret
;
}
// switch to next search List
currentIndex
++
;
}
while
((
currentIndex
<
listSize
)
&&
(
searchLists
!=
nullptr
));
return
INVALID_RET_VALUE
;
}
else
{
return
GetGlyphNode
(
unicode
,
glyphNode
,
fontId
);
int8_t
ret
=
GetGlyphNode
(
unicode
,
glyphNode
,
fontId
);
if
(
ret
==
RET_VALUE_OK
)
{
return
ret
;
}
uint8_t
*
searchLists
=
nullptr
;
int8_t
listSize
=
UIMultiFontManager
::
GetInstance
()
->
GetSearchFontList
(
fontId
,
&
searchLists
);
int8_t
currentIndex
=
0
;
if
((
searchLists
==
nullptr
)
||
(
listSize
==
0
))
{
return
INVALID_RET_VALUE
;
}
do
{
ret
=
GetGlyphNode
(
unicode
,
glyphNode
,
searchLists
[
currentIndex
]);
if
(
ret
!=
INVALID_RET_VALUE
)
{
return
ret
;
}
// switch to next search List
currentIndex
++
;
}
while
((
currentIndex
<
listSize
)
&&
(
searchLists
!=
nullptr
));
return
INVALID_RET_VALUE
;
}
#endif
int8_t
UIFontBitmap
::
GetGlyphNode
(
uint32_t
unicode
,
GlyphNode
&
glyphNode
,
uint8_t
fontId
,
uint8_t
fontSize
)
{
const
GlyphNode
*
node
=
dynamicFont_
.
GetGlyphNode
(
unicode
,
fontId
);
...
...
@@ -332,7 +331,8 @@ uint16_t UIFontBitmap::GetOffsetPosY(const char *text, uint16_t lineLength,
uint8_t
ret
=
GetGlyphNode
(
unicode
,
glyphNode
,
fontId
,
fontSize
);
#endif
if
(
ret
==
RET_VALUE_OK
)
{
if
(
TypedText
::
IsColourWord
(
fontId
))
{
uint8_t
weight
=
GetFontWeight
(
glyphNode
.
fontId
);
if
(
weight
>=
16
)
{
// 16: bit rgb565 rgba8888
emoijMaxNode
=
glyphNode
.
rows
>
emoijMaxNode
.
rows
?
glyphNode
:
emoijMaxNode
;
emojiNum
++
;
}
else
{
...
...
frameworks/font/ui_font_vector.cpp
浏览文件 @
807b529d
...
...
@@ -341,7 +341,7 @@ int16_t UIFontVector::GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSiz
FaceInfo
faceInfo
=
{};
int8_t
ret
=
INVALID_RET_VALUE
;
if
(
TypedText
::
IsColourWord
(
fontId
))
{
if
(
TypedText
::
IsColourWord
(
unicode
,
fontId
,
fontSize
))
{
ret
=
LoadGlyphIntoFace
(
fontId
,
unicode
,
faceInfo
.
face
);
...
...
@@ -695,7 +695,8 @@ uint16_t UIFontVector::GetOffsetPosY(const char *text, uint16_t lineLength, bool
unicode
=
TypedText
::
GetUTF8Next
(
text
,
i
,
i
);
uint8_t
ret
=
GetGlyphNode
(
unicode
,
glyphNode
,
fontId
,
fontSize
);
if
(
ret
==
RET_VALUE_OK
)
{
if
(
TypedText
::
IsColourWord
(
fontId
))
{
uint8_t
weight
=
GetFontWeight
(
glyphNode
.
fontId
);
if
(
weight
>=
16
)
{
// 16: bit rgb565 rgba8888
emojiMaxNode
=
glyphNode
.
rows
>
emojiMaxNode
.
rows
?
glyphNode
:
emojiMaxNode
;
emojiNum
++
;
}
else
{
...
...
@@ -740,7 +741,7 @@ uint16_t UIFontVector::GetLineMaxHeight(const char *text, uint16_t lineLength, u
uint16_t
maxHeight
=
GetHeight
(
fontId
,
fontSize
);
while
(
i
<
lineLength
)
{
unicode
=
TypedText
::
GetUTF8Next
(
text
,
i
,
i
);
TypedText
::
IsColourWord
(
fontId
)
?
emojiNum
++
:
textNum
++
;
TypedText
::
IsColourWord
(
unicode
,
fontId
,
fontSize
)
?
emojiNum
++
:
textNum
++
;
loopNum
++
;
if
(
sizeSpans
!=
nullptr
&&
sizeSpans
[
letterIndex
].
isSizeSpan
)
{
uint16_t
spannableHeight
=
0
;
...
...
frameworks/font/ui_line_break.cpp
浏览文件 @
807b529d
...
...
@@ -130,12 +130,12 @@ uint32_t UILineBreakEngine::GetNextLineAndWidth(const char* text, uint8_t fontId
preIndex
=
byteIdx
;
continue
;
}
if
(
isAllCanBreak
||
IsBreakPos
(
unicode
,
fontId
,
state
))
{
if
(
!
TypedText
::
IsColourWord
(
fontId
))
{
if
(
isAllCanBreak
||
IsBreakPos
(
unicode
,
fontId
,
fontSize
,
state
))
{
if
(
!
TypedText
::
IsColourWord
(
unicode
,
fontId
,
fontSize
))
{
state
=
LINE_BREAK_STATE_START
;
}
// Accumulates the status value from the current character.
IsBreakPos
(
unicode
,
fontId
,
state
);
IsBreakPos
(
unicode
,
fontId
,
fontSize
,
state
);
lastIndex
=
preIndex
;
lastWidth
=
curWidth
;
}
...
...
@@ -185,9 +185,9 @@ int16_t UILineBreakEngine::GetLetterWidth(uint32_t unicode, uint16_t& letterInde
}
}
bool
UILineBreakEngine
::
IsBreakPos
(
uint32_t
unicode
,
uint8_t
fontId
,
int32_t
&
state
)
bool
UILineBreakEngine
::
IsBreakPos
(
uint32_t
unicode
,
uint8_t
fontId
,
uint8_t
fontSize
,
int32_t
&
state
)
{
if
(
TypedText
::
IsColourWord
(
fontId
))
{
if
(
TypedText
::
IsColourWord
(
unicode
,
fontId
,
fontSize
))
{
return
true
;
}
if
((
unicode
>
TypedText
::
MAX_UINT16_HIGH_SCOPE
)
||
(
stateTbl_
==
nullptr
)
||
(
lineBreakTrie_
==
nullptr
))
{
...
...
frameworks/font/ui_line_break.h
浏览文件 @
807b529d
...
...
@@ -118,7 +118,7 @@ public:
uint16_t
&
letterIndex
,
SizeSpan
*
sizeSpans
,
uint16_t
len
=
0xFFFF
);
bool
IsBreakPos
(
uint32_t
unicode
,
uint8_t
fontId
,
int32_t
&
state
);
bool
IsBreakPos
(
uint32_t
unicode
,
uint8_t
fontId
,
uint8_t
fontSize
,
int32_t
&
state
);
private:
UILineBreakEngine
()
...
...
interfaces/kits/font/ui_font.h
浏览文件 @
807b529d
...
...
@@ -113,6 +113,8 @@ public:
*/
uint8_t
*
GetBitmap
(
uint32_t
unicode
,
GlyphNode
&
glyphNode
,
uint8_t
fontId
,
uint8_t
fontSize
,
uint8_t
shapingFont
);
int8_t
GetGlyphNode
(
uint32_t
unicode
,
GlyphNode
&
glyphNode
,
uint8_t
fontId
,
uint8_t
fontSize
);
/**
* @brief Indicates whether the current font library is a vector font library.
* @return uint8_t: 0 BitmapFont 1 VectorFont
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录