提交 a8510621 编写于 作者: W wangtiantian

IssueNo:https://gitee.com/openharmony/graphic_ui/issues/I3YPUS

Description:add file offset interface
Sig:graphic
Feature or Bugfix:Bugfix
Binary Source:No
Signed-off-by: Nwangtiantian <wangtiantian19@huawei.com>
上级 5ebc3d27
......@@ -28,7 +28,7 @@
#endif
namespace OHOS {
UIFontBitmap::UIFontBitmap() : dynamicFont_(), dynamicFontRamUsed_(0), dynamicFontFd_(-1)
UIFontBitmap::UIFontBitmap() : dynamicFont_(), dynamicFontRamUsed_(0), dynamicFontFd_(-1), offset_(0)
{
SetBaseFontId(UIFontBuilder::GetInstance()->GetBitmapFontIdMax());
bitmapCache_ = nullptr;
......@@ -91,8 +91,7 @@ int8_t UIFontBitmap::SetFontPath(const char* dpath, const char* spath)
return INVALID_RET_VALUE;
}
dynamicFont_.SetRamBuffer(GetRamAddr());
uint32_t start = 0;
int32_t ret = dynamicFont_.SetFile(dynamicFontFd_, start);
int32_t ret = dynamicFont_.SetFile(dynamicFontFd_, offset_);
if (ret == INVALID_RET_VALUE) {
GRAPHIC_LOGE("GlyphsManager::SetFile failed");
close(dynamicFontFd_);
......@@ -308,4 +307,9 @@ int16_t UIFontBitmap::GetWidthInFontId(uint32_t unicode, uint8_t fontId)
}
return GetDynamicFontWidth(unicode, GetBaseFontId());
}
void UIFontBitmap::SetFontFileOffset(uint32_t offset)
{
offset_ = offset;
}
} // namespace
......@@ -41,6 +41,7 @@ public:
int8_t GetFontVersion(char* dVersion, uint8_t dLen, char* sVersion, uint8_t sLen) const override;
int8_t SetCurrentLangId(uint8_t langId) override;
UITextLanguageFontParam* GetFontInfo(uint8_t fontId) const override;
void SetFontFileOffset(uint32_t offset) override;
protected:
uint32_t GetBitmapRamUsed();
......@@ -65,6 +66,7 @@ private:
uint32_t bitmapRamUsed_;
UIFontCache* bitmapCache_;
int32_t dynamicFontFd_;
uint32_t offset_;
};
} // namespce OHOS
#endif // UI_FONT_BITMAP_H
\ No newline at end of file
......@@ -201,6 +201,8 @@ public:
return 0;
}
virtual void SetFontFileOffset(uint32_t offset) {}
/**
* @brief Get current font id
*
......
......@@ -223,6 +223,11 @@ public:
static UIFont* GetInstance();
void SetFont(BaseFont* font);
void SetFontFileOffset(uint32_t offset)
{
instance_->SetFontFileOffset(offset);
}
private:
UIFont();
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册