codes layout

This commit is contained in:
hyzboy 2022-02-18 19:07:02 +08:00
parent 556e523684
commit 33b8ce120e
4 changed files with 16 additions and 14 deletions

2
CMCore

@ -1 +1 @@
Subproject commit 9a2368d749699b67065646265110ba089a0264a4
Subproject commit 53449b1d4c579efd6f8bd2de6b315cc0663a1ecd

View File

@ -56,7 +56,7 @@ namespace hgl
/**
*
*/
struct TextLayoutAttributes
struct TextLayoutAttribute
{
FontSource * font_source =nullptr; ///<字符源
CharLayoutAttr *char_layout_attr =nullptr; ///<缺省字符排版属性
@ -78,7 +78,9 @@ namespace hgl
float tab_size =4.0f; ///<Tab符号尺寸(对应字符高度的系数)
bool compress_punctuation =false; ///<压缩标点符号
};//struct TextLayoutAttributes
};//struct TextLayoutAttribute
using TLA=TextLayoutAttribute;
using TEXT_COORD_TYPE=int; //字符必须坐标对齐显示才能不模糊,所以这里坐标系全部使用整型坐标
@ -87,7 +89,7 @@ namespace hgl
protected:
FontSource *font_source;
TextLayoutAttributes tla;
TextLayoutAttribute tla;
protected:
@ -155,10 +157,10 @@ namespace hgl
virtual ~TextLayout()=default;
void Set (const TextLayoutAttributes *_tla) {if(_tla)hgl_cpy(&tla,_tla);}
void SetFont (FontSource *fs) {if(fs)font_source=fs;}
void SetTextDirection (const uint8 &td) {tla.text_direction=td;}
void SetAlign (const TextAlign &ta) {tla.align=ta;}
void Set (const TLA * _tla) {if(_tla)hgl_cpy(&tla,_tla);}
void SetFont ( FontSource * fs) {if(fs)font_source=fs;}
void SetTextDirection (const uint8 & td) {tla.text_direction=td;}
void SetAlign (const TextAlign & ta) {tla.align=ta;}
void SetMaxWidth (const float mw) {tla.max_width=mw;}
void SetMaxHeight (const float mh) {tla.max_height=mh;}

View File

@ -42,7 +42,7 @@ namespace hgl
bool TextRender::InitTextLayoutEngine()
{
CharLayoutAttr cla;
TextLayoutAttributes tla;
TextLayoutAttribute tla;
cla.CharColor=Color4f(COLOR::White);
cla.BackgroundColor=Color4f(COLOR::Black);