update TextLayout
This commit is contained in:
@@ -13,6 +13,14 @@ namespace hgl
|
||||
{
|
||||
namespace graph
|
||||
{
|
||||
struct FontAdvInfo
|
||||
{
|
||||
int x,y; //图像显示偏移
|
||||
int w,h; //图像尺寸
|
||||
|
||||
int adv_x,adv_y;//字符尺寸
|
||||
};//struct FontAdvInfo
|
||||
|
||||
/**
|
||||
* 字体位图数据
|
||||
*/
|
||||
@@ -20,10 +28,7 @@ namespace hgl
|
||||
{
|
||||
int count; //使用次数
|
||||
|
||||
int x,y; //图像显示偏移
|
||||
int w,h; //图像尺寸
|
||||
|
||||
int adv_x,adv_y;//字符尺寸
|
||||
FontAdvInfo adv_info;
|
||||
|
||||
uint8 *data;
|
||||
};//struct FontBitmap
|
||||
@@ -41,9 +46,9 @@ namespace hgl
|
||||
|
||||
virtual ~FontSource()=default;
|
||||
|
||||
virtual FontBitmap *GetCharBitmap(const u32char &)=0; ///<取得字符位图数据
|
||||
virtual int GetCharAdvWidth(const u32char &)=0; ///<取得字符绘制宽度
|
||||
virtual int GetCharHeight()const=0; ///<取得字符高度
|
||||
virtual FontBitmap *GetCharBitmap (const u32char &)=0; ///<取得字符位图数据
|
||||
virtual const bool GetCharAdvInfo (FontAdvInfo &,const u32char &); ///<取得字符绘制信息
|
||||
virtual int GetCharHeight ()const=0; ///<取得字符高度
|
||||
|
||||
void RefAcquire(void *); ///<引用请求
|
||||
void RefRelease(void *); ///<引用释放
|
||||
@@ -70,9 +75,9 @@ namespace hgl
|
||||
FontSourceSingle(const Font &f){fnt=f;}
|
||||
virtual ~FontSourceSingle()=default;
|
||||
|
||||
FontBitmap *GetCharBitmap(const u32char &ch) override; ///<取得字符位图数据
|
||||
virtual int GetCharAdvWidth(const u32char &)=0; ///<取得字符绘制宽度
|
||||
virtual int GetCharHeight()const override{return fnt.height;} ///<取得字符高度
|
||||
FontBitmap *GetCharBitmap (const u32char &ch) override; ///<取得字符位图数据
|
||||
const bool GetCharAdvInfo (FontAdvInfo &,const u32char &); ///<取得字符绘制信息
|
||||
virtual int GetCharHeight ()const override{return fnt.height;} ///<取得字符高度
|
||||
};//class FontSourceSingle:public FontSource
|
||||
|
||||
/**
|
||||
@@ -105,9 +110,9 @@ namespace hgl
|
||||
void Remove(UnicodeBlock);
|
||||
void Remove(FontSource *);
|
||||
|
||||
FontBitmap *GetCharBitmap(const u32char &ch) override;
|
||||
int GetCharAdvWidth(const u32char &) override;
|
||||
int GetCharHeight()const override; ///<取得字符高度
|
||||
FontBitmap *GetCharBitmap (const u32char &ch) override;
|
||||
const bool GetCharAdvInfo (FontAdvInfo &,const u32char &); ///<取得字符绘制信息
|
||||
int GetCharHeight ()const override; ///<取得字符高度
|
||||
};//class FontSourceMulti:public FontSource
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
|
@@ -32,7 +32,6 @@ namespace hgl
|
||||
{
|
||||
uint vertical:1; ///<是否竖排
|
||||
uint right_to_left:1; ///<是否从右往左
|
||||
uint bottom_to_top:1; ///<是否从下到上
|
||||
};
|
||||
};//union TextDirection
|
||||
|
||||
@@ -79,7 +78,7 @@ namespace hgl
|
||||
|
||||
int TextLayout(RenderableCreater *,const TextLayoutAttributes *,const int max_chars,const UTF16String &);
|
||||
|
||||
int PlaneTextLayout(RenderableCreater *,FontSource *font_source,const int max_chars,const UTF16String &);
|
||||
int PlaneTextLayout(RenderableCreater *,FontSource *font_source,const int max_chars,const UTF16String &,const uint8 text_direction=0);
|
||||
}//namespace graph
|
||||
}//namespace hgl
|
||||
#endif//HGL_GRAPH_TEXT_LAYOUT_INCLUDE
|
||||
|
Reference in New Issue
Block a user