提交 26203d6c 编写于 作者: S suwenxiang

fixed f4560a1 from https://gitee.com/suwenxiang12/graphic_ui/pulls/805

Description: Fallback amplification fontid modification
IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I5YRJV
Feature or Bugfix: Bugfix
Binary Source: No
Signed-off-by: Nsuwenxiang <suwenxiang@huawei.com>
上级 ffe46b66
......@@ -149,7 +149,7 @@ void Text::SetFont(const char* name, uint8_t size)
return;
}
if (UIFont::GetInstance()->IsVectorFont()) {
uint16_t fontId = UIFont::GetInstance()->GetFontId(name);
uint8_t fontId = UIFont::GetInstance()->GetFontId(name);
if ((fontId != UIFontBuilder::GetInstance()->GetTotalFontId()) &&
((fontId_ != fontId) || (fontSize_ != size))) {
fontId_ = fontId;
......@@ -157,7 +157,7 @@ void Text::SetFont(const char* name, uint8_t size)
needRefresh_ = true;
}
} else {
uint16_t fontId = UIFont::GetInstance()->GetFontId(name, size);
uint8_t fontId = UIFont::GetInstance()->GetFontId(name, size);
SetFontId(fontId);
}
}
......@@ -194,7 +194,7 @@ void Text::SetFont(const char* name, uint8_t size, char*& destName, uint8_t& des
}
}
void Text::SetFontId(uint16_t fontId)
void Text::SetFontId(uint8_t fontId)
{
if ((fontId >= UIFontBuilder::GetInstance()->GetTotalFontId()) || ((fontId_ == fontId) && (fontSize_ != 0))) {
GRAPHIC_LOGE("Text::SetFontId invalid fontId(%hhd)", fontId);
......@@ -205,7 +205,7 @@ void Text::SetFontId(uint16_t fontId)
return;
}
if (UIFont::GetInstance()->IsVectorFont()) {
uint16_t fontId = UIFont::GetInstance()->GetFontId(fontParam->ttfName);
uint8_t fontId = UIFont::GetInstance()->GetFontId(fontParam->ttfName);
if ((fontId != UIFontBuilder::GetInstance()->GetTotalFontId()) && ((fontId_ != fontId) ||
(fontSize_ != fontParam->size))) {
fontId_ = fontId;
......@@ -533,7 +533,7 @@ void Text::SetAbsoluteSizeSpan(uint16_t start, uint16_t end, uint8_t size)
return;
}
#endif
uint16_t fontId = GetSpanFontIdBySize(size);
uint8_t fontId = GetSpanFontIdBySize(size);
#if defined(ENABLE_VECTOR_FONT) && !ENABLE_VECTOR_FONT
if (fontId == fontId_) {
return;
......@@ -585,7 +585,7 @@ uint8_t Text::GetSpanFontIdBySize(uint8_t size)
}
uint8_t ttfId = fontParam->ttfId;
for (uint16_t fontId = 0; fontId < UIFontBuilder::GetInstance()->GetTotalFontId(); fontId++) {
for (uint8_t fontId = 0; fontId < UIFontBuilder::GetInstance()->GetTotalFontId(); fontId++) {
UITextLanguageFontParam* tempFontParam = UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId);
if (tempFontParam == nullptr) {
continue;
......
......@@ -25,7 +25,7 @@
namespace OHOS {
#ifndef _FONT_TOOL
Point TypedText::GetTextSize(const char* text, uint16_t fontId, uint8_t fontSize, int16_t letterSpace,
Point TypedText::GetTextSize(const char* text, uint8_t fontId, uint8_t fontSize, int16_t letterSpace,
int16_t lineHeight, int16_t maxWidth, int8_t lineSpace, SizeSpan* sizeSpans)
{
Point size{0, 0};
......@@ -84,7 +84,7 @@ Point TypedText::GetTextSize(const char* text, uint16_t fontId, uint8_t fontSize
}
Rect TypedText::GetArcTextRect(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
const Point& arcCenter,
int16_t letterSpace,
......@@ -168,7 +168,7 @@ void TypedText::GetArcLetterPos(const Point& arcCenter, uint16_t radius, float a
posY = arcCenter.y - (static_cast<float>(radius) * Sin(angle + QUARTER_IN_DEGREE));
}
uint32_t TypedText::GetNextLine(const char* text, uint16_t fontId, uint8_t fontSize, int16_t letterSpace,
uint32_t TypedText::GetNextLine(const char* text, uint8_t fontId, uint8_t fontSize, int16_t letterSpace,
int16_t maxWidth)
{
uint32_t index = 0;
......@@ -247,7 +247,7 @@ bool TypedText::GetWrapPoint(const char* text, uint32_t& breakPoint)
return false;
}
int16_t TypedText::GetTextWidth(const char* text, uint16_t fontId, uint8_t fontSize, uint16_t length,
int16_t TypedText::GetTextWidth(const char* text, uint8_t fontId, uint8_t fontSize, uint16_t length,
int16_t letterSpace)
{
if ((text == nullptr) || (length == 0) || (length > strlen(text))) {
......@@ -514,7 +514,7 @@ bool TypedText::IsEmojiBase(uint32_t codePoint)
}
}
bool TypedText::IsColourWord(uint32_t codePoint, uint16_t fontId, uint8_t fontSize)
bool TypedText::IsColourWord(uint32_t codePoint, uint8_t fontId, uint8_t fontSize)
{
bool hasColor = false;
uint8_t weight = UIFont::GetInstance()->GetFontWeight(fontId);
......
......@@ -40,7 +40,7 @@ public:
static constexpr uint8_t UTF8_TO_UNICODE_SHIFT3 = 18;
static Point GetTextSize(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
int16_t letterSpace,
int16_t lineHeight,
......@@ -49,19 +49,19 @@ public:
SizeSpan* sizeSpans = nullptr);
static uint32_t GetNextLine(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
int16_t letterSpace,
int16_t maxWidth);
static int16_t GetTextWidth(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
uint16_t length,
int16_t letterSpace);
static Rect GetArcTextRect(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
const Point& arcCenter,
int16_t letterSpace,
......@@ -93,7 +93,7 @@ public:
static bool IsEmojiModifier(uint32_t codePoint);
static bool IsEmojiBase(uint32_t codePoint);
static bool IsColourWord(uint32_t codePoint, uint16_t fontId, uint8_t fontSize);
static bool IsColourWord(uint32_t codePoint, uint8_t fontId, uint8_t fontSize);
private:
static bool GetWrapPoint(const char* text, uint32_t& breakPoint);
......
......@@ -89,7 +89,7 @@ UITextLanguageDirect UIArcLabel::GetDirect()
return arcLabelText_->GetDirect();
}
void UIArcLabel::SetFontId(uint16_t fontId)
void UIArcLabel::SetFontId(uint8_t fontId)
{
InitArcLabelText();
arcLabelText_->SetFontId(fontId);
......@@ -141,7 +141,7 @@ void UIArcLabel::DrawArcText(BufferInfo& gfxDstBuffer,
arcLabelText_->GetFontSize(), arcTextInfo, orientation, *style_, opaScale);
}
Rect UIArcLabel::GetArcTextRect(const char* text, uint16_t fontId, uint8_t fontSize, const Point& arcCenter,
Rect UIArcLabel::GetArcTextRect(const char* text, uint8_t fontId, uint8_t fontSize, const Point& arcCenter,
int16_t letterSpace, TextOrientation orientation, const ArcTextInfo& arcTextInfo)
{
return TypedText::GetArcTextRect(text, fontId, fontSize, arcCenter, letterSpace, orientation, arcTextInfo);
......
......@@ -71,7 +71,7 @@ uint8_t UIDigitalClock::GetOpacity() const
return opaScale_;
}
void UIDigitalClock::SetFontId(uint16_t fontId)
void UIDigitalClock::SetFontId(uint8_t fontId)
{
SetStyle(STYLE_TEXT_FONT, fontId);
InitTimeLabels();
......
......@@ -249,7 +249,7 @@ const char* UIEditText::GetPlaceholder()
}
}
void UIEditText::SetFontId(uint16_t fontId)
void UIEditText::SetFontId(uint8_t fontId)
{
InitText();
inputText_->SetFontId(fontId);
......
......@@ -252,7 +252,7 @@ void UILabel::SetAlign(UITextLanguageAlignment horizontalAlign, UITextLanguageAl
}
}
void UILabel::SetFontId(uint16_t fontId)
void UILabel::SetFontId(uint8_t fontId)
{
InitLabelText();
labelText_->SetFontId(fontId);
......
......@@ -45,7 +45,7 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf
GlyphNode glyphNode;
while (i < labelLine.lineLength) {
uint32_t letter = TypedText::GetUTF8Next(labelLine.text, i, i);
uint16_t fontId = labelLine.fontId;
uint8_t fontId = labelLine.fontId;
uint8_t fontSize = labelLine.fontSize;
if (labelLine.sizeSpans != nullptr && labelLine.sizeSpans[letterIndex].isSizeSpan) {
fontId = labelLine.sizeSpans[letterIndex].fontId;
......@@ -114,7 +114,7 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf
return retOffsetY;
}
uint8_t DrawLabel::GetLineMaxLetterSize(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
uint8_t DrawLabel::GetLineMaxLetterSize(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t letterIndex, SizeSpan* sizeSpans)
{
if (sizeSpans == nullptr) {
......@@ -143,7 +143,7 @@ void DrawLabel::DrawArcText(BufferInfo& gfxDstBuffer,
const Rect& mask,
const char* text,
const Point& arcCenter,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
const ArcTextInfo arcTextInfo,
TextOrientation orientation,
......@@ -206,7 +206,7 @@ void DrawLabel::DrawArcText(BufferInfo& gfxDstBuffer,
void DrawLabel::DrawLetterWithRotate(BufferInfo& gfxDstBuffer,
const Rect& mask,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
uint32_t letter,
const Point& pos,
......
......@@ -29,12 +29,12 @@ public:
uint16_t& letterIndex);
static void DrawArcText(BufferInfo& gfxDstBuffer, const Rect& mask, const char* text, const Point& arcCenter,
uint16_t fontId, uint8_t fontSize, const ArcTextInfo arcTextInfo,
uint8_t fontId, uint8_t fontSize, const ArcTextInfo arcTextInfo,
TextOrientation orientation, const Style& style, uint8_t opaScale);
static void DrawLetterWithRotate(BufferInfo& gfxDstBuffer,
const Rect& mask,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
uint32_t letter,
const Point& pos,
......@@ -42,7 +42,7 @@ public:
const ColorType& color,
OpacityType opaScale);
static uint8_t GetLineMaxLetterSize(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
static uint8_t GetLineMaxLetterSize(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t letterIndex, SizeSpan* sizeSpans);
static void GetLineBackgroundColor(uint16_t letterIndex, List<LineBackgroundColor>* linebackgroundColor,
bool& havelinebackground, ColorType& linebgColor);
......
......@@ -68,7 +68,7 @@ struct LabelLineInfo {
const char* text;
uint16_t length;
uint16_t start;
uint16_t fontId;
uint8_t fontId;
uint8_t fontSize;
uint8_t txtFlag;
UITextLanguageDirect direct;
......@@ -94,7 +94,7 @@ struct LabelLetterInfo {
const uint32_t& letter;
UITextLanguageDirect direct;
uint16_t fontId;
uint8_t fontId;
uint8_t shapingId;
uint8_t fontSize;
#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
......
......@@ -63,7 +63,7 @@ int8_t GlyphsCache::CacheInit()
return RET_VALUE_OK;
}
GlyphNode* GlyphsCache::GetNodeFromCache(uint32_t unicode, uint16_t fontId)
GlyphNode* GlyphsCache::GetNodeFromCache(uint32_t unicode, uint8_t fontId)
{
GlyphNode* node = nullptr;
......@@ -79,7 +79,7 @@ GlyphNode* GlyphsCache::GetNodeFromCache(uint32_t unicode, uint16_t fontId)
return node;
}
GlyphNode* GlyphsCache::GetNodeCacheSpace(uint32_t unicode, uint16_t fontId)
GlyphNode* GlyphsCache::GetNodeCacheSpace(uint32_t unicode, uint8_t fontId)
{
uint8_t font = fontId & FONT_HASH_MASK;
uint8_t uc = unicode & UNICODE_HASH_MASK;
......
......@@ -35,8 +35,8 @@ public:
~GlyphsCache();
int8_t CacheInit();
GlyphNode* GetNodeFromCache(uint32_t unicode, uint16_t fontId);
GlyphNode* GetNodeCacheSpace(uint32_t unicode, uint16_t fontId);
GlyphNode* GetNodeFromCache(uint32_t unicode, uint8_t fontId);
GlyphNode* GetNodeCacheSpace(uint32_t unicode, uint8_t fontId);
private:
static constexpr uint8_t FONT_HASH_SHIFT = 3;
......
......@@ -67,7 +67,7 @@ int8_t GlyphsFile::CacheInit()
return RET_VALUE_OK;
}
int8_t GlyphsFile::GetNodeFromFile(uint32_t unicode, uint16_t fontId, GlyphNode& node)
int8_t GlyphsFile::GetNodeFromFile(uint32_t unicode, uint8_t fontId, GlyphNode& node)
{
uint16_t idx = 0;
uint32_t offset;
......@@ -201,7 +201,7 @@ bool GlyphsFile::IsSameFile(const char* fontName)
return (strcmp(fontName_, fontName + Offset) == 0);
}
int8_t GlyphsFile::GetGlyphInfo(uint16_t fontId, GlyphInfo& glyphInfo)
int8_t GlyphsFile::GetGlyphInfo(uint8_t fontId, GlyphInfo& glyphInfo)
{
uint16_t fontIdx = 0;
if (fontId > UIFontBuilder::GetInstance()->GetBitmapFontIdMax()) {
......@@ -271,7 +271,7 @@ int8_t GlyphsFile::GetFontVersion(const char* fontName, char* version, uint8_t l
return RET_VALUE_OK;
}
const FontHeader* GlyphsFile::GetFontHeader(uint16_t fontId)
const FontHeader* GlyphsFile::GetFontHeader(uint8_t fontId)
{
GlyphInfo glyphInfo;
int8_t ret = GetGlyphInfo(fontId, glyphInfo);
......@@ -282,7 +282,7 @@ const FontHeader* GlyphsFile::GetFontHeader(uint16_t fontId)
return glyphInfo.fontHeader;
}
int16_t GlyphsFile::GetFontHeight(uint16_t fontId)
int16_t GlyphsFile::GetFontHeight(uint8_t fontId)
{
GlyphInfo glyphInfo;
int8_t ret = GetGlyphInfo(fontId, glyphInfo);
......
......@@ -36,15 +36,15 @@ public:
int8_t GetFontVersion(const char* fontName, char* version, uint8_t len);
int16_t GetFontHeight(uint16_t fontId);
int16_t GetFontHeight(uint8_t fontId);
const FontHeader* GetFontHeader(uint16_t fontId);
const FontHeader* GetFontHeader(uint8_t fontId);
int8_t GetBitmap(GlyphNode& node, BufferInfo& bufInfo);
int8_t SetFile(const char* fontName, int32_t fp, uint32_t start);
int8_t GetNodeFromFile(uint32_t unicode, uint16_t fontId, GlyphNode& node);
int8_t GetNodeFromFile(uint32_t unicode, uint8_t fontId, GlyphNode& node);
bool IsSameFile(const char* fontName);
......@@ -60,7 +60,7 @@ private:
};
struct GlyphInfo {
uint16_t fontId;
uint8_t fontId;
uint32_t glyphNodeSectionStart;
uint32_t bitMapSectionStart;
uint32_t fontIndexSectionStart;
......@@ -69,7 +69,7 @@ private:
};
int8_t CacheInit();
int8_t GetGlyphInfo(uint16_t fontId, GlyphInfo& glyphInfo);
int8_t GetGlyphInfo(uint8_t fontId, GlyphInfo& glyphInfo);
void SetFontName(const char* fontName);
BinHeader binHeader_;
......
......@@ -70,7 +70,7 @@ int8_t GlyphsManager::GetFontVersion(const char* fontName, char* version, uint8_
return INVALID_RET_VALUE;
}
const FontHeader* GlyphsManager::GetFontHeader(uint16_t fontId)
const FontHeader* GlyphsManager::GetFontHeader(uint8_t fontId)
{
for (uint16_t i = 0; i < glyphsFiles_.Size(); i++) {
const FontHeader* tmp = glyphsFiles_[i]->GetFontHeader(fontId);
......@@ -82,7 +82,7 @@ const FontHeader* GlyphsManager::GetFontHeader(uint16_t fontId)
return nullptr;
}
const GlyphNode* GlyphsManager::GetGlyphNode(uint32_t unicode, uint16_t fontId)
const GlyphNode* GlyphsManager::GetGlyphNode(uint32_t unicode, uint8_t fontId)
{
GlyphNode* node = glyphsCache_.GetNodeFromCache(unicode, fontId);
if (node != nullptr) {
......@@ -111,7 +111,7 @@ const GlyphNode* GlyphsManager::GetGlyphNode(uint32_t unicode, uint16_t fontId)
return node;
}
int16_t GlyphsManager::GetFontHeight(uint16_t fontId)
int16_t GlyphsManager::GetFontHeight(uint8_t fontId)
{
for (uint16_t i = 0; i < glyphsFiles_.Size(); i++) {
int16_t height = glyphsFiles_[i]->GetFontHeight(fontId);
......@@ -123,7 +123,7 @@ int16_t GlyphsManager::GetFontHeight(uint16_t fontId)
return INVALID_RET_VALUE;
}
int16_t GlyphsManager::GetFontWidth(uint32_t unicode, uint16_t fontId)
int16_t GlyphsManager::GetFontWidth(uint32_t unicode, uint8_t fontId)
{
const GlyphNode* node = GetGlyphNode(unicode, fontId);
if (node == nullptr) {
......@@ -132,7 +132,7 @@ int16_t GlyphsManager::GetFontWidth(uint32_t unicode, uint16_t fontId)
return node->advance;
}
int8_t GlyphsManager::GetBitmap(uint32_t unicode, BufferInfo& bufInfo, uint16_t fontId)
int8_t GlyphsManager::GetBitmap(uint32_t unicode, BufferInfo& bufInfo, uint8_t fontId)
{
GlyphNode* node = const_cast<GlyphNode *>(GetGlyphNode(unicode, fontId));
if (node == nullptr) {
......
......@@ -35,15 +35,15 @@ public:
int8_t GetFontVersion(const char* fontName, char* version, uint8_t len);
int16_t GetFontHeight(uint16_t fontId);
int16_t GetFontHeight(uint8_t fontId);
int16_t GetFontWidth(uint32_t unicode, uint16_t fontId);
int16_t GetFontWidth(uint32_t unicode, uint8_t fontId);
const FontHeader* GetFontHeader(uint16_t fontId);
const FontHeader* GetFontHeader(uint8_t fontId);
const GlyphNode* GetGlyphNode(uint32_t unicode, uint16_t fontId);
const GlyphNode* GetGlyphNode(uint32_t unicode, uint8_t fontId);
int8_t GetBitmap(uint32_t unicode, BufferInfo& bufInfo, uint16_t fontId);
int8_t GetBitmap(uint32_t unicode, BufferInfo& bufInfo, uint8_t fontId);
int8_t SetFile(const char* fontName, int32_t fp, uint32_t start);
......
......@@ -171,7 +171,7 @@ int8_t UIFont::GetCodePoints(uint16_t textId, uint32_t** codePoints, uint16_t& c
#endif
}
uint8_t* UIFont::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize,
uint8_t* UIFont::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize,
uint8_t shapingFont)
{
uint8_t* bitmap = nullptr;
......@@ -207,7 +207,7 @@ uint8_t* UIFont::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t font
return nullptr;
}
int8_t UIFont::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize)
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) {
......@@ -232,7 +232,7 @@ int8_t UIFont::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fon
return INVALID_RET_VALUE;
}
uint16_t UIFont::GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize, uint8_t shapingId)
uint16_t UIFont::GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize, uint8_t shapingId)
{
int16_t result;
#if ENABLE_MULTI_FONT
......@@ -266,7 +266,7 @@ uint16_t UIFont::GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize, u
return 0;
}
uint16_t UIFont::GetLineMaxHeight(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
uint16_t UIFont::GetLineMaxHeight(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t letterIndex, SizeSpan* sizeSpans)
{
return instance_->GetLineMaxHeight(text, lineLength, fontId, fontSize, letterIndex, sizeSpans);
......
......@@ -22,7 +22,7 @@
#endif
namespace OHOS {
uint32_t UIFontAdaptor::GetNextLineAndWidth(const char* txt,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
int16_t letterSpace,
int16_t& maxWidth,
......@@ -42,7 +42,7 @@ uint32_t UIFontAdaptor::GetNextLineAndWidth(const char* txt,
#endif
}
bool UIFontAdaptor::IsSameTTFId(uint16_t fontId, uint32_t unicode)
bool UIFontAdaptor::IsSameTTFId(uint8_t fontId, uint32_t unicode)
{
#if ENABLE_SHAPING
return UITextShaping::IsSameTTFId(fontId, unicode);
......
......@@ -23,7 +23,7 @@ namespace OHOS {
class UIFontAdaptor : public HeapBase {
public:
static uint32_t GetNextLineAndWidth(const char* txt,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
int16_t letterSpace,
int16_t& maxWidth,
......@@ -33,7 +33,7 @@ public:
bool allBreak = false,
uint16_t len = 0xFFFF);
static bool IsSameTTFId(uint16_t fontId, uint32_t unicode);
static bool IsSameTTFId(uint8_t fontId, uint32_t unicode);
};
} // namespace OHOS
#endif // UI_FONT_ADAPTOR
......@@ -61,7 +61,7 @@ bool UIFontBitmap::IsVectorFont() const
}
uint8_t UIFontBitmap::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script,
uint16_t fontId, uint8_t size) const
uint8_t fontId, uint8_t size) const
{
#if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
return UIMultiFontManager::GetInstance()->GetShapingFontId(text, fontId, ttfId, script);
......@@ -75,7 +75,7 @@ uint8_t UIFontBitmap::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& scr
#endif
}
uint8_t UIFontBitmap::GetFontWeight(uint16_t fontId)
uint8_t UIFontBitmap::GetFontWeight(uint8_t fontId)
{
UITextLanguageFontParam* fontParam = UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId);
if (fontParam == nullptr) {
......@@ -111,12 +111,12 @@ int8_t UIFontBitmap::SetFontPath(const char* path, FontType type)
return RET_VALUE_OK;
}
uint16_t UIFontBitmap::GetHeight(uint16_t fontId, uint8_t fontSize)
uint16_t UIFontBitmap::GetHeight(uint8_t fontId, uint8_t fontSize)
{
return dynamicFont_.GetFontHeight(fontId);
}
uint16_t UIFontBitmap::GetFontId(const char* ttfName, uint8_t size) const
uint8_t UIFontBitmap::GetFontId(const char* ttfName, uint8_t size) const
{
if (ttfName == nullptr) {
return UIFontBuilder::GetInstance()->GetBitmapFontIdMax();
......@@ -133,22 +133,22 @@ uint16_t UIFontBitmap::GetFontId(const char* ttfName, uint8_t size) const
return id;
}
int16_t UIFontBitmap::GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize)
int16_t UIFontBitmap::GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize)
{
return GetWidthInFontId(unicode, fontId);
}
uint8_t* UIFontBitmap::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize)
uint8_t* UIFontBitmap::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize)
{
return SearchInFont(unicode, glyphNode, fontId);
}
bool UIFontBitmap::IsEmojiFont(uint16_t fontId)
bool UIFontBitmap::IsEmojiFont(uint8_t fontId)
{
return false;
}
int8_t UIFontBitmap::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize)
int8_t UIFontBitmap::GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8_t fontSize)
{
const FontHeader* header = dynamicFont_.GetFontHeader(fontId);
if (header != nullptr) {
......@@ -159,7 +159,7 @@ int8_t UIFontBitmap::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint
}
#if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
int8_t UIFontBitmap::GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId)
int8_t UIFontBitmap::GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId)
{
int8_t ret = GetGlyphNode(unicode, glyphNode, fontId);
if (ret == RET_VALUE_OK) {
......@@ -184,7 +184,7 @@ int8_t UIFontBitmap::GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, u
}
#endif
int8_t UIFontBitmap::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize)
int8_t UIFontBitmap::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize)
{
const GlyphNode* node = dynamicFont_.GetGlyphNode(unicode, fontId);
if (node != nullptr) {
......@@ -223,17 +223,17 @@ int8_t UIFontBitmap::SetCurrentLangId(uint8_t langId)
return RET_VALUE_OK;
}
UITextLanguageFontParam* UIFontBitmap::GetFontInfo(uint16_t fontId) const
UITextLanguageFontParam* UIFontBitmap::GetFontInfo(uint8_t fontId) const
{
return UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId);
}
int8_t UIFontBitmap::GetDynamicFontBitmap(uint32_t unicode, BufferInfo& bufInfo, uint16_t fontId)
int8_t UIFontBitmap::GetDynamicFontBitmap(uint32_t unicode, BufferInfo& bufInfo, uint8_t fontId)
{
return dynamicFont_.GetBitmap(unicode, bufInfo, fontId);
}
uint8_t* UIFontBitmap::GetCacheBitmap(uint16_t fontId, uint32_t unicode)
uint8_t* UIFontBitmap::GetCacheBitmap(uint8_t fontId, uint32_t unicode)
{
if (bitmapCache_ != nullptr) {
return bitmapCache_->GetBitmap(fontId, unicode);
......@@ -242,7 +242,7 @@ uint8_t* UIFontBitmap::GetCacheBitmap(uint16_t fontId, uint32_t unicode)
return nullptr;
}
BufferInfo UIFontBitmap::GetCacheBuffer(uint16_t fontId, uint32_t unicode, GlyphNode& glyphNode)
BufferInfo UIFontBitmap::GetCacheBuffer(uint8_t fontId, uint32_t unicode, GlyphNode& glyphNode)
{
ColorMode mode = UIFont::GetInstance()->GetColorType(fontId);
BufferInfo bufInfo{Rect(), 0, nullptr, nullptr, glyphNode.cols, glyphNode.rows, mode, 0};
......@@ -267,12 +267,12 @@ void UIFontBitmap::PutCacheSpace(uint8_t* addr)
GRAPHIC_LOGE("UIFontBitmap::PutCacheSpace invalid bitmapCache");
}
int16_t UIFontBitmap::GetDynamicFontWidth(uint32_t unicode, uint16_t fontId)
int16_t UIFontBitmap::GetDynamicFontWidth(uint32_t unicode, uint8_t fontId)
{
return dynamicFont_.GetFontWidth(unicode, fontId);
}
uint8_t* UIFontBitmap::SearchInFont(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId)
uint8_t* UIFontBitmap::SearchInFont(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId)
{
GraphicLockGuard guard(lock_);
if (bitmapCache_ == nullptr) {
......@@ -307,7 +307,7 @@ uint8_t* UIFontBitmap::SearchInFont(uint32_t unicode, GlyphNode& glyphNode, uint
return nullptr;
}
int16_t UIFontBitmap::GetWidthInFontId(uint32_t unicode, uint16_t fontId)
int16_t UIFontBitmap::GetWidthInFontId(uint32_t unicode, uint8_t fontId)
{
if (!UIFontAdaptor::IsSameTTFId(fontId, unicode)) {
GRAPHIC_LOGE("UIFontBitmap::GetWidthInFontId fontId and unicode not match");
......@@ -324,7 +324,7 @@ void UIFontBitmap::SetFontFileOffset(uint32_t offset)
uint16_t UIFontBitmap::GetOffsetPosY(const char* text,
uint16_t lineLength,
bool& isEmoijLarge,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize)
{
uint32_t i = 0;
......@@ -378,7 +378,7 @@ uint16_t UIFontBitmap::GetOffsetPosY(const char* text,
uint16_t UIFontBitmap::GetLineMaxHeight(const char* text,
uint16_t lineLength,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
uint16_t& letterIndex,
SizeSpan* sizeSpans)
......
......@@ -62,16 +62,16 @@ uint8_t UIFontBuilder::GetTotalLangId() const
return totalLangId_;
}
uint16_t UIFontBuilder::GetTotalFontId() const
uint8_t UIFontBuilder::GetTotalFontId() const
{
uint16_t fontIdMax = 0xFF;
uint8_t fontIdMax = 0xFF;
if (!UIFont::GetInstance()->IsVectorFont()) {
fontIdMax = totalFontId_;
}
return fontIdMax;
}
uint16_t UIFontBuilder::GetBitmapFontIdMax() const
uint8_t UIFontBuilder::GetBitmapFontIdMax() const
{
return totalFontId_;
}
......
......@@ -247,7 +247,7 @@ uint8_t UIFontVector::UnregisterFontInfo(const char* ttfName)
return FONT_INVALID_TTF_ID;
}
const UITextLanguageFontParam* UIFontVector::GetFontInfo(uint16_t fontId) const
const UITextLanguageFontParam* UIFontVector::GetFontInfo(uint8_t fontId) const
{
if (fontId < FONT_ID_MAX) {
return static_cast<const UITextLanguageFontParam*>(&fontInfo_[fontId]);
......@@ -441,7 +441,7 @@ bool UIFontVector::IsVectorFont() const
return true;
}
uint8_t UIFontVector::GetFontWeight(uint16_t fontId)
uint8_t UIFontVector::GetFontWeight(uint8_t fontId)
{
if (fontId >= FONT_ID_MAX) {
return BPP_BIT_8;
......@@ -459,7 +459,7 @@ int8_t UIFontVector::SetFontPath(const char* path, FontType type)
return RET_VALUE_OK;
}
int8_t UIFontVector::GetFaceInfo(uint16_t fontId, uint8_t fontSize, FaceInfo& faceInfo)
int8_t UIFontVector::GetFaceInfo(uint8_t fontId, uint8_t fontSize, FaceInfo& faceInfo)
{
if ((fontId >= FONT_ID_MAX) || (fontSize == 0)) {
return INVALID_RET_VALUE;
......@@ -490,7 +490,7 @@ int8_t UIFontVector::GetFaceInfo(uint16_t fontId, uint8_t fontSize, FaceInfo& fa
return RET_VALUE_OK;
}
uint16_t UIFontVector::GetHeight(uint16_t fontId, uint8_t fontSize)
uint16_t UIFontVector::GetHeight(uint8_t fontId, uint8_t fontSize)
{
FaceInfo faceInfo;
int8_t ret = GetFaceInfo(fontId, fontSize, faceInfo);
......@@ -504,7 +504,7 @@ uint16_t UIFontVector::GetHeight(uint16_t fontId, uint8_t fontSize)
}
uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script,
uint16_t fontId, uint8_t size) const
uint8_t fontId, uint8_t size) const
{
#if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
const UITextLanguageFontParam* fontParam1 = GetFontInfo(fontId);
......@@ -545,7 +545,7 @@ uint8_t UIFontVector::GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& scr
#endif
}
uint16_t UIFontVector::GetFontId(const char* ttfName, uint8_t fontSize) const
uint8_t UIFontVector::GetFontId(const char* ttfName, uint8_t fontSize) const
{
if (ttfName != nullptr) {
int32_t i = 0;
......@@ -560,7 +560,7 @@ uint16_t UIFontVector::GetFontId(const char* ttfName, uint8_t fontSize) const
return FONT_ID_MAX;
}
uint16_t UIFontVector::GetFontId(uint32_t unicode) const
uint8_t UIFontVector::GetFontId(uint32_t unicode) const
{
int32_t i = 0;
uint8_t ttfId = ((unicode >> 24) & 0x1F); // 24: Whether 25 ~29 bit storage is ttfId 0x1F:5bit
......@@ -577,7 +577,7 @@ uint16_t UIFontVector::GetFontId(uint32_t unicode) const
return FONT_INVALID_TTF_ID;
}
int16_t UIFontVector::GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize)
int16_t UIFontVector::GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize)
{
if ((fontId >= FONT_ID_MAX) || (fontSize == 0)) {
return INVALID_RET_VALUE;
......@@ -607,7 +607,7 @@ int16_t UIFontVector::GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSi
return static_cast<uint16_t>(faceInfo.face->glyph->advance.x / FONT_PIXEL_IN_POINT);
}
int8_t UIFontVector::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize)
int8_t UIFontVector::GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8_t fontSize)
{
FaceInfo faceInfo;
int8_t ret = GetFaceInfo(fontId, fontSize, faceInfo);
......@@ -624,7 +624,7 @@ int8_t UIFontVector::GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint
return RET_VALUE_OK;
}
int8_t UIFontVector::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize)
int8_t UIFontVector::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize)
{
FaceInfo faceInfo;
int8_t ret = GetFaceInfo(fontId, fontSize, faceInfo);
......@@ -672,7 +672,7 @@ int8_t UIFontVector::GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16
return RET_VALUE_OK;
}
uint8_t* UIFontVector::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize)
uint8_t* UIFontVector::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize)
{
if (GetGlyphNode(unicode, glyphNode, fontId, fontSize) != RET_VALUE_OK) {
return nullptr;
......@@ -698,7 +698,7 @@ uint8_t* UIFontVector::GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_
return static_cast<uint8_t*>(faceInfo.face->glyph->bitmap.buffer);
}
bool UIFontVector::IsEmojiFont(uint16_t fontId)
bool UIFontVector::IsEmojiFont(uint8_t fontId)
{
if (fontId >= FONT_ID_MAX) {
return false;
......@@ -723,7 +723,7 @@ void UIFontVector::SetItaly(FT_GlyphSlot slot)
FT_Outline_Transform(&outline, &matrix);
}
void UIFontVector::SetBold(uint16_t fontId)
void UIFontVector::SetBold(uint8_t fontId)
{
int32_t error;
FT_GlyphSlot slot = ftFaces_[fontId]->glyph;
......@@ -749,7 +749,7 @@ void UIFontVector::SetBold(uint16_t fontId)
}
#endif
int8_t UIFontVector::LoadGlyphIntoFace(uint16_t& fontId, uint32_t unicode)
int8_t UIFontVector::LoadGlyphIntoFace(uint8_t& fontId, uint32_t unicode)
{
int32_t error;
if (IsGlyphFont(unicode) != 0) {
......@@ -772,7 +772,7 @@ int8_t UIFontVector::LoadGlyphIntoFace(uint16_t& fontId, uint32_t unicode)
}
#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
int8_t UIFontVector::LoadGlyphIntoFace(uint16_t& fontId, uint32_t unicode, FT_Face face, TextStyle textStyle)
int8_t UIFontVector::LoadGlyphIntoFace(uint8_t& fontId, uint32_t unicode, FT_Face face, TextStyle textStyle)
{
int32_t error;
if (IsGlyphFont(unicode) != 0) {
......@@ -875,7 +875,7 @@ void UIFontVector::SetFace(FaceInfo& faceInfo, uint32_t unicode, TextStyle textS
}
#endif
inline uint32_t UIFontVector::GetKey(uint16_t fontId, uint32_t size)
inline uint32_t UIFontVector::GetKey(uint8_t fontId, uint32_t size)
{
return ((static_cast<uint32_t>(fontId)) << 24) + size; // fontId store at the (24+1)th bit
}
......@@ -883,7 +883,7 @@ inline uint32_t UIFontVector::GetKey(uint16_t fontId, uint32_t size)
uint16_t UIFontVector::GetOffsetPosY(const char* text,
uint16_t lineLength,
bool& isEmojiLarge,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize)
{
if (!freeTypeInited_ || (bitmapCache_ == nullptr)) {
......@@ -935,7 +935,7 @@ uint16_t UIFontVector::GetOffsetPosY(const char* text,
uint16_t UIFontVector::GetLineMaxHeight(const char* text,
uint16_t lineLength,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
uint16_t& letterIndex,
SizeSpan* sizeSpans)
......
......@@ -111,7 +111,7 @@ void UILineBreakEngine::LoadRule()
}
uint32_t UILineBreakEngine::GetNextLineAndWidth(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
int16_t space,
bool allBreak,
......@@ -171,7 +171,7 @@ uint32_t UILineBreakEngine::GetNextLineAndWidth(const char* text,
}
int16_t UILineBreakEngine::GetLetterWidth(uint32_t unicode, uint16_t& letterIndex, int16_t& height,
uint16_t fontId, uint8_t fontSize, SizeSpan* sizeSpans)
uint8_t fontId, uint8_t fontSize, SizeSpan* sizeSpans)
{
if (sizeSpans != nullptr && sizeSpans[letterIndex].isSizeSpan) {
int16_t width = UIFont::GetInstance()->GetWidth(unicode, sizeSpans[letterIndex].fontId,
......@@ -191,7 +191,7 @@ int16_t UILineBreakEngine::GetLetterWidth(uint32_t unicode, uint16_t& letterInde
}
}
bool UILineBreakEngine::IsBreakPos(uint32_t unicode, uint16_t fontId, uint8_t fontSize, int32_t& state)
bool UILineBreakEngine::IsBreakPos(uint32_t unicode, uint8_t fontId, uint8_t fontSize, int32_t& state)
{
if ((unicode > TypedText::MAX_UINT16_HIGH_SCOPE) || (stateTbl_ == nullptr) || (lineBreakTrie_ == nullptr)) {
return true;
......
......@@ -111,7 +111,7 @@ public:
// 0xFFFF: unlimit the length until the end null.
uint32_t GetNextLineAndWidth(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
int16_t space,
bool allBreak,
......@@ -120,7 +120,7 @@ public:
uint16_t& letterIndex,
SizeSpan* sizeSpans,
uint16_t len = 0xFFFF);
bool IsBreakPos(uint32_t unicode, uint16_t fontId, uint8_t fontSize, int32_t& state);
bool IsBreakPos(uint32_t unicode, uint8_t fontId, uint8_t fontSize, int32_t& state);
private:
UILineBreakEngine()
......@@ -131,7 +131,7 @@ private:
void LoadRule();
int16_t GetLetterWidth(uint32_t unicode, uint16_t& letterIndex, int16_t& maxHeight,
uint16_t fontId, uint8_t fontSize, SizeSpan* sizeSpans);
uint8_t fontId, uint8_t fontSize, SizeSpan* sizeSpans);
static constexpr const int32_t LINE_BREAK_STATE_START = 1;
static constexpr const int32_t LINE_BREAK_STATE_STOP = 0;
bool initSuccess_;
......
......@@ -30,8 +30,8 @@ UIMultiFontManager::UIMultiFontManager()
bengaliTtfId_(0), topIndex_(0)
{
const UITextLanguageFontParam* fontParam = nullptr;
uint16_t totalFontId = UIFontBuilder::GetInstance()->GetTotalFontId();
for (uint16_t i = 0; i < totalFontId; i++) {
uint8_t totalFontId = UIFontBuilder::GetInstance()->GetTotalFontId();
for (uint8_t i = 0; i < totalFontId; i++) {
fontParam = UIFont::GetInstance()->GetFontInfo(i);
if (fontParam == nullptr) {
continue;
......@@ -57,7 +57,7 @@ UIMultiFontManager::UIMultiFontManager()
if (fontIdIndex_ == nullptr) {
return;
}
for (uint16_t index = 0; index < totalFontId; index++) {
for (uint8_t index = 0; index < totalFontId; index++) {
fontIdIndex_[index] = MAX_FONT_SEARCH_NUM;
}
for (uint8_t index = 0; index < MAX_FONT_SEARCH_NUM; index++) {
......@@ -73,7 +73,7 @@ UIMultiFontManager::~UIMultiFontManager()
}
int8_t UIMultiFontManager::AddNewFont(uint8_t fontListId, uint8_t *fontIds, int8_t size, uint16_t fontId)
int8_t UIMultiFontManager::AddNewFont(uint8_t fontListId, uint8_t *fontIds, int8_t size, uint8_t fontId)
{
fontNodes_[fontId].fontIds = static_cast<uint8_t *>(UIMalloc(size));
if (fontNodes_[fontId].fontIds == nullptr) {
......@@ -127,8 +127,8 @@ UIMultiFontManager* UIMultiFontManager::GetInstance()
void UIMultiFontManager::ClearSearchFontList()
{
uint16_t totalFontId = UIFontBuilder::GetInstance()->GetTotalFontId();
for (uint16_t index = 0; index < totalFontId; index++) {
uint8_t totalFontId = UIFontBuilder::GetInstance()->GetTotalFontId();
for (uint8_t index = 0; index < totalFontId; index++) {
fontIdIndex_[index] = MAX_FONT_SEARCH_NUM;
}
......@@ -179,7 +179,7 @@ bool UIMultiFontManager::IsNeedShaping(const char *text, uint8_t &ttfId, uint32_
return false;
}
uint16_t UIMultiFontManager::GetShapingFontId(const char* text, uint16_t fontId, uint8_t& ttfId, uint32_t& script)
uint8_t UIMultiFontManager::GetShapingFontId(const char* text, uint8_t fontId, uint8_t& ttfId, uint32_t& script)
{
// the shaping font is in search list, then shapingFontId_ store the real shaping fontid
const UITextLanguageFontParam* fontParam1 = UIFont::GetInstance()->GetFontInfo(fontId);
......
......@@ -39,7 +39,7 @@ public:
int8_t GetSearchFontList(uint8_t fontListId, uint8_t **fontIds);
void UpdateScript(UITextLanguageFontParam& fonts);
bool IsNeedShaping(const char* text, uint8_t& ttfId, uint32_t& script);
uint16_t GetShapingFontId(const char* text, uint16_t fontId, uint8_t& ttfId, uint32_t& script);
uint8_t GetShapingFontId(const char* text, uint8_t fontId, uint8_t& ttfId, uint32_t& script);
#if ENABLE_SHAPING
uint32_t GetScriptByTtfId(uint8_t ttfId);
#endif
......@@ -56,7 +56,7 @@ private:
*
*/
~UIMultiFontManager();
int8_t AddNewFont(uint8_t fontListId, uint8_t *fontIds, int8_t size, uint16_t fontId);
int8_t AddNewFont(uint8_t fontListId, uint8_t *fontIds, int8_t size, uint8_t fontId);
int8_t UpdateFont(uint8_t fontListId, uint8_t *fontIds, uint8_t size);
int8_t IsShapingLetter(uint32_t unicode, uint8_t& ttfId);
struct FontIdNode {
......
......@@ -23,7 +23,7 @@ UITextShaping* UITextShaping::GetInstance()
return &instance;
}
bool UITextShaping::IsSameTTFId(uint16_t fontId, uint32_t unicode)
bool UITextShaping::IsSameTTFId(uint8_t fontId, uint32_t unicode)
{
// Need to be implemented
return false;
......
......@@ -50,7 +50,7 @@ public:
*/
static UITextShaping* GetInstance();
static bool IsSameTTFId(uint16_t fontId, uint32_t unicode);
static bool IsSameTTFId(uint8_t fontId, uint32_t unicode);
}; // class UITextShaping
} // namespace OHOS
#endif // ENABLE_SHAPING
......
......@@ -30,44 +30,44 @@ public:
UIFontBitmap& operator=(const UIFontBitmap&) noexcept = delete;
bool IsVectorFont() const override;
uint8_t GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script,
uint16_t fontId, uint8_t size) const override;
uint8_t fontId, uint8_t size) const override;
int8_t SetFontPath(const char* path, FontType type) override;
uint16_t GetHeight(uint16_t fontId, uint8_t fontSize = 0) override;
uint16_t GetFontId(const char* ttfName, uint8_t fontSize = 0) const override;
int16_t GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize = 0) override;
uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize = 0) override;
int8_t GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize = 0) override;
int8_t GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize = 0) override;
uint8_t GetFontWeight(uint16_t fontId) override;
uint16_t GetHeight(uint8_t fontId, uint8_t fontSize = 0) override;
uint8_t GetFontId(const char* ttfName, uint8_t fontSize = 0) const override;
int16_t GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize = 0) override;
uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize = 0) override;
int8_t GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8_t fontSize = 0) override;
int8_t GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize = 0) override;
uint8_t GetFontWeight(uint8_t fontId) override;
int8_t GetFontVersion(FontType type, const char* path, char* version, uint8_t len) override;
int8_t SetCurrentLangId(uint8_t langId) override;
UITextLanguageFontParam* GetFontInfo(uint16_t fontId) const override;
UITextLanguageFontParam* GetFontInfo(uint8_t fontId) const override;
void SetFontFileOffset(uint32_t offset) override;
uint16_t GetOffsetPosY(const char* text, uint16_t lineLength, bool& isEmoijLerge,
uint16_t fontId, uint8_t fontSize) override;
uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
uint8_t fontId, uint8_t fontSize) override;
uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t& letterIndex, SizeSpan* sizeSpans) override;
bool IsEmojiFont(uint16_t fontId) override;
bool IsEmojiFont(uint8_t fontId) override;
void SetPsramMemory(uintptr_t psramAddr, uint32_t psramLen) override;
protected:
int8_t GetDynamicFontBitmap(uint32_t unicode, BufferInfo& bufInfo, uint16_t fontId);
uint8_t* GetCacheBitmap(uint16_t fontId, uint32_t unicode);
BufferInfo GetCacheBuffer(uint16_t fontId, uint32_t unicode, GlyphNode& glyphNode);
int8_t GetDynamicFontBitmap(uint32_t unicode, BufferInfo& bufInfo, uint8_t fontId);
uint8_t* GetCacheBitmap(uint8_t fontId, uint32_t unicode);
BufferInfo GetCacheBuffer(uint8_t fontId, uint32_t unicode, GlyphNode& glyphNode);
void PutCacheSpace(uint8_t* addr);
int16_t GetDynamicFontWidth(uint32_t unicode, uint16_t fontId);
int16_t GetDynamicFontWidth(uint32_t unicode, uint8_t fontId);
uint32_t offset_;
GraphicMutex lock_;
private:
uint8_t* SearchInFont(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId);
int16_t GetWidthInFontId(uint32_t unicode, uint16_t fontId);
uint8_t* SearchInFont(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId);
int16_t GetWidthInFontId(uint32_t unicode, uint8_t fontId);
#if defined(ENABLE_MULTI_FONT) && ENABLE_MULTI_FONT
int8_t GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId);
int8_t GetMultiGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId);
#endif
void CloseFontFd();
void BitmapCacheInit();
static constexpr uint32_t FONT_BITMAP_CACHE_SIZE = 0x64000;
static constexpr uint16_t FONT_ID_MAX = 0xFFFF;
static constexpr uint8_t FONT_ID_MAX = 0xFF;
static constexpr uint8_t TTF_NAME_LEN_MAX = 128;
GlyphsManager dynamicFont_;
UIFontCache* bitmapCache_;
......
......@@ -34,9 +34,9 @@ public:
uint8_t GetTotalLangId() const;
uint16_t GetTotalFontId() const;
uint8_t GetTotalFontId() const;
uint16_t GetBitmapFontIdMax() const;
uint8_t GetBitmapFontIdMax() const;
uint16_t GetTotalTextId() const;
......@@ -49,7 +49,7 @@ private:
UIFontBuilder();
~UIFontBuilder() {}
uint8_t totalLangId_;
uint16_t totalFontId_;
uint8_t totalFontId_;
uint16_t totalTextId_;
};
}
......
......@@ -33,31 +33,31 @@ public:
UIFontVector& operator=(const UIFontVector&) noexcept = delete;
bool IsVectorFont() const override;
int8_t SetFontPath(const char* path, FontType type) override;
uint16_t GetHeight(uint16_t fontId, uint8_t fontSize) override;
uint16_t GetFontId(const char* ttfName, uint8_t fontSize = 0) const override;
int16_t GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize) override;
uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize) override;
int8_t GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize) override;
int8_t GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize) override;
uint8_t GetFontWeight(uint16_t fontId) override;
uint16_t GetHeight(uint8_t fontId, uint8_t fontSize) override;
uint8_t GetFontId(const char* ttfName, uint8_t fontSize = 0) const override;
int16_t GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize) override;
uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize) override;
int8_t GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8_t fontSize) override;
int8_t GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize) override;
uint8_t GetFontWeight(uint8_t fontId) override;
uint8_t
GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint16_t fontId, uint8_t size) const override;
GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint8_t fontId, uint8_t size) const override;
uint8_t RegisterFontInfo(const char* ttfName, uint8_t shaping = 0) override;
uint8_t RegisterFontInfo(const UITextLanguageFontParam* fontsTable, uint8_t num) override;
uint8_t UnregisterFontInfo(const char* ttfName) override;
uint8_t UnregisterFontInfo(const UITextLanguageFontParam* fontsTable, uint8_t num) override;
uint8_t RegisterTtcFontInfo(const char* ttcName, const TtfInfo* ttfInfo, uint8_t count) override;
uint8_t UnregisterTtcFontInfo(const char* ttcName, const TtfInfo* ttfInfo, uint8_t count) override;
const UITextLanguageFontParam* GetFontInfo(uint16_t fontId) const override;
const UITextLanguageFontParam* GetFontInfo(uint8_t fontId) const override;
int32_t OpenVectorFont(uint8_t ttfId) override;
bool IsColorEmojiFont(FT_Face &face);
uint16_t GetOffsetPosY(const char* text, uint16_t lineLength,
bool& isEmojiLarge, uint16_t fontId, uint8_t fontSize) override;
uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
bool& isEmojiLarge, uint8_t fontId, uint8_t fontSize) override;
uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t& letterIndex, SizeSpan* sizeSpans) override;
bool GetTtfInfo(uint8_t ttfId, uint8_t* ttfBuffer, uint32_t ttfBufferSize, TtfHeader& ttfHeader) override;
void SetPsramMemory(uintptr_t psramAddr, uint32_t psramLen) override;
bool IsEmojiFont(uint16_t fontId) override;
bool IsEmojiFont(uint8_t fontId) override;
private:
static constexpr uint8_t FONT_ID_MAX = 0xFF;
......@@ -93,18 +93,18 @@ private:
#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
void SetFace(FaceInfo& faceInfo, uint32_t unicode, TextStyle textStyle) const;
#endif
uint16_t GetFontId(uint32_t unicode) const;
uint32_t GetKey(uint16_t fontId, uint32_t size);
int8_t LoadGlyphIntoFace(uint16_t& fontId, uint32_t unicode);
uint8_t GetFontId(uint32_t unicode) const;
uint32_t GetKey(uint8_t fontId, uint32_t size);
int8_t LoadGlyphIntoFace(uint8_t& fontId, uint32_t unicode);
#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
int8_t LoadGlyphIntoFace(uint16_t& fontId, uint32_t unicode, FT_Face face, TextStyle textStyle);
int8_t LoadGlyphIntoFace(uint8_t& fontId, uint32_t unicode, FT_Face face, TextStyle textStyle);
#endif
uint8_t IsGlyphFont(uint32_t unicode);
#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
void SetItaly(FT_GlyphSlot slot);
void SetBold(uint16_t fontId);
void SetBold(uint8_t fontId);
#endif
int8_t GetFaceInfo(uint16_t fontId, uint8_t fontSize, FaceInfo& faceInfo);
int8_t GetFaceInfo(uint8_t fontId, uint8_t fontSize, FaceInfo& faceInfo);
uint16_t GetMaxSubLineHeight(uint16_t textNum, uint16_t loopNum, uint16_t maxHeight, uint16_t emojiNum);
bool GetTtfInfoFromTtf(uint8_t ttfId,
uint8_t* ttfBuffer,
......
......@@ -121,7 +121,7 @@ struct LineBackgroundColor : public HeapBase {
struct SizeSpan {
bool isSizeSpan;
uint8_t size;
uint16_t fontId;
uint8_t fontId;
int16_t height;
};
......@@ -205,7 +205,7 @@ public:
* @since 1.0
* @version 1.0
*/
void SetFontId(uint16_t fontId);
void SetFontId(uint8_t fontId);
/**
* @brief Obtains the font ID.
......@@ -518,7 +518,7 @@ protected:
TextStyle* textStyles_;
char* text_;
uint16_t fontId_;
uint8_t fontId_;
uint8_t fontSize_; // Only the vector font library has a valid value.
Point textSize_;
bool needRefresh_ : 1;
......
......@@ -127,7 +127,7 @@ public:
* @since 1.0
* @version 1.0
*/
void SetFontId(uint16_t fontId)
void SetFontId(uint8_t fontId)
{
fontId_ = fontId;
if (fontName_ != nullptr) {
......@@ -266,7 +266,7 @@ private:
UILabel* GetDynamicText(UIView* inView, int16_t index);
UILabel* GetIntegerText(UIView* inView, int16_t index);
void ClearDynamicText();
uint16_t fontId_;
uint8_t fontId_;
char* fontName_;
uint8_t fontSize_;
int16_t width_;
......
......@@ -178,7 +178,7 @@ public:
* @since 1.0
* @version 1.0
*/
void SetFontId(uint16_t fontId);
void SetFontId(uint8_t fontId);
/**
* @brief Obtains the font ID composed of font name and size.
......@@ -358,7 +358,7 @@ protected:
TextOrientation orientation);
virtual Rect GetArcTextRect(const char* text,
uint16_t fontId,
uint8_t fontId,
uint8_t fontSize,
const Point& arcCenter,
int16_t letterSpace,
......
......@@ -84,7 +84,7 @@ public:
* @since 1.0
* @version 1.0
*/
void SetFontId(uint16_t fontId);
void SetFontId(uint8_t fontId);
/**
* @brief Sets the dynamic font for this digital clock.
......
......@@ -253,7 +253,7 @@ public:
*
* @param fontId Indicates the font ID composed of font name and size.
*/
void SetFontId(uint16_t fontId);
void SetFontId(uint8_t fontId);
/**
* @brief Obtains the font ID composed of font name and size.
......
......@@ -329,7 +329,7 @@ public:
* @since 1.0
* @version 1.0
*/
void SetFontId(uint16_t fontId);
void SetFontId(uint8_t fontId);
/**
* @brief Obtains the font ID composed of font name and size.
......@@ -338,7 +338,7 @@ public:
* @since 1.0
* @version 1.0
*/
uint16_t GetFontId()
uint8_t GetFontId()
{
InitLabelText();
return labelText_->GetFontId();
......
......@@ -270,7 +270,7 @@ public:
* @since 1.0
* @version 1.0
*/
void SetFontId(uint16_t fontId)
void SetFontId(uint8_t fontId)
{
InitLabelButtonText();
labelButtonText_->SetFontId(fontId);
......@@ -283,7 +283,7 @@ public:
* @since 1.0
* @version 1.0
*/
uint16_t GetFontId()
uint8_t GetFontId()
{
InitLabelButtonText();
return labelButtonText_->GetFontId();
......
......@@ -43,7 +43,7 @@ public:
*
* @return uint16_t
*/
virtual uint16_t GetHeight(uint16_t fontId, uint8_t fontSize) = 0;
virtual uint16_t GetHeight(uint8_t fontId, uint8_t fontSize) = 0;
/**
* @brief Get font id
......@@ -52,7 +52,7 @@ public:
* @param size 0: invalid size
* @return uint8_t
*/
virtual uint16_t GetFontId(const char* ttfName, uint8_t fontSize) const = 0;
virtual uint8_t GetFontId(const char* ttfName, uint8_t fontSize) const = 0;
/**
* @brief Get width
......@@ -60,7 +60,7 @@ public:
* @param unicode
* @return int16_t
*/
virtual int16_t GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize) = 0;
virtual int16_t GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize) = 0;
virtual int32_t OpenVectorFont(uint8_t ttfId)
{
......@@ -78,7 +78,7 @@ public:
* @param unicode
* @return uint8_t*
*/
virtual uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize) = 0;
virtual uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize) = 0;
/**
* @brief Get font header
......@@ -86,7 +86,7 @@ public:
* @param fontHeader
* @return int8_t
*/
virtual int8_t GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize) = 0;
virtual int8_t GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8_t fontSize) = 0;
/**
* @brief Get the glyph node
......@@ -96,8 +96,8 @@ public:
* @param isGlyph
* @return int8_t
*/
virtual int8_t GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize) = 0;
virtual uint8_t GetFontWeight(uint16_t fontId) = 0;
virtual int8_t GetGlyphNode(uint32_t unicode, GlyphNode& glyphNode, uint8_t fontId, uint8_t fontSize) = 0;
virtual uint8_t GetFontWeight(uint8_t fontId) = 0;
virtual int8_t SetCurrentLangId(uint8_t langId)
{
......@@ -119,7 +119,7 @@ public:
* @param size [in] the font size
* @return uint8_t: needShaping property
*/
virtual uint8_t GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint16_t fontId, uint8_t size) const
virtual uint8_t GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint8_t fontId, uint8_t size) const
{
return 0;
}
......@@ -157,12 +157,12 @@ public:
* @param size [in] the font size
* @return uint8_t: ttfId property
*/
virtual uint8_t GetFontTtfId(uint16_t fontId, uint8_t size) const
virtual uint8_t GetFontTtfId(uint8_t fontId, uint8_t size) const
{
return 0;
}
virtual const UITextLanguageFontParam* GetFontInfo(uint16_t fontId) const
virtual const UITextLanguageFontParam* GetFontInfo(uint8_t fontId) const
{
return nullptr;
}
......@@ -224,10 +224,10 @@ public:
virtual void SetPsramMemory(uintptr_t psramAddr, uint32_t psramLen);
virtual uint16_t GetOffsetPosY(const char* text, uint16_t lineLength, bool& isEmoijLarge,
uint16_t fontId, uint8_t fontSize) = 0;
virtual uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
uint8_t fontId, uint8_t fontSize) = 0;
virtual uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t& letterIndex, SizeSpan* sizeSpans) = 0;
virtual bool IsEmojiFont(uint16_t fontId) = 0;
virtual bool IsEmojiFont(uint8_t fontId) = 0;
private:
uintptr_t ramAddr_;
......
......@@ -32,7 +32,7 @@ public:
* @param size font size
* @return int8_t Shaping mode
*/
uint8_t GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint16_t fontId, uint8_t size) const
uint8_t GetShapingFontId(char* text, uint8_t& ttfId, uint32_t& script, uint8_t fontId, uint8_t size) const
{
return instance_->GetShapingFontId(text, ttfId, script, fontId, size);
}
......@@ -46,7 +46,7 @@ public:
* @param shapingId: [in] font shaping id
* @return uint16_t: the letter width
*/
uint16_t GetWidth(uint32_t unicode, uint16_t fontId, uint8_t fontSize, uint8_t shapingId);
uint16_t GetWidth(uint32_t unicode, uint8_t fontId, uint8_t fontSize, uint8_t shapingId);
/**
* @brief Get height for specific font
......@@ -56,7 +56,7 @@ public:
*
* @return uint16_t
*/
uint16_t GetHeight(uint16_t fontId, uint8_t fontSize)
uint16_t GetHeight(uint8_t fontId, uint8_t fontSize)
{
return instance_->GetHeight(fontId, fontSize);
}
......@@ -66,7 +66,7 @@ public:
* @param fontId
* @return uint8_t: fontWeight
*/
uint8_t GetFontWeight(uint16_t fontId)
uint8_t GetFontWeight(uint8_t fontId)
{
return instance_->GetFontWeight(fontId);
}
......@@ -77,7 +77,7 @@ public:
* @param fontHeader
* @return int8_t
*/
int8_t GetFontHeader(FontHeader& fontHeader, uint16_t fontId, uint8_t fontSize)
int8_t GetFontHeader(FontHeader& fontHeader, uint8_t fontId, uint8_t fontSize)
{
return instance_->GetFontHeader(fontHeader, fontId, fontSize);
}
......@@ -87,9 +87,9 @@ public:
*
* @param name
* @param size
* @return uint16_t
* @return uint8_t
*/
uint16_t GetFontId(const char* name, uint8_t size = 0)
uint8_t GetFontId(const char* name, uint8_t size = 0)
{
return instance_->GetFontId(name, size);
}
......@@ -111,9 +111,9 @@ public:
* @param unicode
* @return uint8_t*
*/
uint8_t* GetBitmap(uint32_t unicode, GlyphNode& glyphNode, uint16_t fontId, uint8_t fontSize, uint8_t shapingFont);
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, uint16_t fontId, uint8_t fontSize);
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.
......@@ -135,7 +135,7 @@ public:
int8_t GetTextUtf8(uint16_t textId, uint8_t** utf8Addr, uint16_t& utf8Len) const;
uint8_t GetFontTtfId(uint16_t fontId, uint8_t size) const
uint8_t GetFontTtfId(uint8_t fontId, uint8_t size) const
{
return instance_->GetFontTtfId(fontId, size);
}
......@@ -150,7 +150,7 @@ public:
return instance_->GetTtfInfo(ttfId, ttfBuffer, bufferSize, ttfHeader);
}
const UITextLanguageFontParam* GetFontInfo(uint16_t fontId) const
const UITextLanguageFontParam* GetFontInfo(uint8_t fontId) const
{
return instance_->GetFontInfo(fontId);
}
......@@ -199,7 +199,7 @@ public:
int8_t GetCodePoints(uint16_t textId, uint32_t** codePoints, uint16_t& codePointsNum) const;
ColorMode GetColorType(uint16_t fontId)
ColorMode GetColorType(uint8_t fontId)
{
switch (instance_->GetFontWeight(fontId)) {
case FONT_WEIGHT_1:
......@@ -222,12 +222,12 @@ public:
void SetFontFileOffset(uint32_t offset);
virtual uint16_t
GetOffsetPosY(const char* text, uint16_t lineLength, bool& isAllEmoji, uint16_t fontId, uint8_t fontSize)
GetOffsetPosY(const char* text, uint16_t lineLength, bool& isAllEmoji, uint8_t fontId, uint8_t fontSize)
{
return instance_->GetOffsetPosY(text, lineLength, isAllEmoji, fontId, fontSize);
}
virtual uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint16_t fontId, uint8_t fontSize,
virtual uint16_t GetLineMaxHeight(const char* text, uint16_t lineLength, uint8_t fontId, uint8_t fontSize,
uint16_t letterIndex, SizeSpan* sizeSpans);
bool IsEmojiFont(uint8_t fontid)
......
......@@ -26,7 +26,7 @@ enum UITextWildcardStaticType : uint8_t { TEXT_STATIC_STR1 = 0, TEXT_STATIC_STR2
struct UITextLanguageTextParam {
uint16_t textId;
uint16_t fontId;
uint8_t fontId;
uint8_t align : 2; // UITextLanguageAlignment
uint8_t direct : 1; // UITextLanguageDirect
uint8_t shaping : 1;
......@@ -240,7 +240,7 @@ struct BinHeader {
* refer to ui_font.h
*/
struct FontHeader {
uint16_t fontId; // FONT_ID_OFFSET
uint8_t fontId; // FONT_ID_OFFSET
uint16_t glyphNum; // GLYPH_NUM_OFFSET
uint16_t fontHeight; // FONT_HEIGHT_OFFSET
int16_t ascender; // FONT_ASCEND_LEN
......@@ -288,8 +288,8 @@ struct GlyphNode {
uint32_t dataOff; // GLYPH_DATA_OFF_OFFSET
uint32_t kernOff; // GLYPH_KERN_OFF_OFFSET
uint16_t kernSize; // GLYPH_KERN_SIZE_OFFSET
uint16_t fontId; // GLYPH_FONT_ID
uint16_t dataFlag; // GLYPH_DATA_HEAD_FLAG
uint8_t fontId; // GLYPH_FONT_ID
uint8_t dataFlag; // GLYPH_DATA_HEAD_FLAG
#if defined(ENABLE_VECTOR_FONT) && ENABLE_VECTOR_FONT
TextStyle textStyle; // GLYPH_TEXT_STYLE
#endif
......
......@@ -225,7 +225,7 @@ HWTEST_F(UIArcLabelTest, UIArcLabelSetFontId_001, TestSize.Level1)
EXPECT_EQ(1, 0);
return;
}
uint16_t fontId = 0;
uint8_t fontId = 0;
arcLabel_->SetFontId(fontId);
EXPECT_EQ(arcLabel_->GetFontId(), fontId);
}
......
......@@ -78,7 +78,7 @@ HWTEST_F(UIDigitalClockTest, UIDigitalClockSetFontId_001, TestSize.Level1)
EXPECT_EQ(1, 0);
return;
}
const uint16_t fontId = 10;
const uint8_t fontId = 10;
digitalClock_->SetFontId(fontId);
EXPECT_EQ(digitalClock_->GetStyle(STYLE_TEXT_FONT), fontId);
}
......
......@@ -234,7 +234,7 @@ HWTEST_F(UIEditTextTest, UIEditTextSetCursorColor_001, TestSize.Level1)
HWTEST_F(UIEditTextTest, UIEditTextSetFont_001, TestSize.Level1)
{
UIEditText* editText = new UIEditText();
uint16_t fontId = editText->GetFontId();
uint8_t fontId = editText->GetFontId();
const uint8_t fontSize = 20; // 20: font size for test
editText->SetFont("error_font_name", fontSize);
......
......@@ -196,7 +196,7 @@ HWTEST_F(UILabelButtonTest, UILabelButtonSetFontId_001, TestSize.Level0)
EXPECT_NE(0, 0);
return;
}
const uint16_t fontId = 16;
const uint8_t fontId = 16;
labelBtn_->SetFontId(fontId);
if (!UIFont::GetInstance()->IsVectorFont()) {
EXPECT_EQ(labelBtn_->GetFontId(), fontId);
......
......@@ -218,7 +218,7 @@ HWTEST_F(UILabelTest, UILabelSetFont_001, TestSize.Level1)
EXPECT_EQ(1, 0);
return;
}
uint16_t fontId = label_->GetFontId();
uint8_t fontId = label_->GetFontId();
const uint8_t fontSize = 20; // 20: font size for test
label_->SetFont("error_font_name", fontSize);
......@@ -293,7 +293,7 @@ HWTEST_F(UILabelTest, UILabelSetFontId_001, TestSize.Level0)
EXPECT_NE(0, 0);
return;
}
const uint16_t fontId = 16;
const uint8_t fontId = 16;
label_->SetFontId(fontId);
if (!UIFont::GetInstance()->IsVectorFont()) {
EXPECT_EQ(label_->GetFontId(), fontId);
......
......@@ -229,7 +229,7 @@ HWTEST_F(UIFontTest, Graphic_Font_Test_GetShapingFontId_001, TestSize.Level1)
{
uint8_t ttfId = 0;
uint32_t script = 0;
uint16_t fontId = UIFont::GetInstance()->GetShapingFontId("", ttfId, script, FONT_ID, 0);
uint8_t fontId = UIFont::GetInstance()->GetShapingFontId("", ttfId, script, FONT_ID, 0);
EXPECT_EQ(fontId, 0);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册