From 22c30427b3fe3371b03ae172662811b7bf571da6 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Fri, 24 Jul 2020 17:51:36 +0800 Subject: [PATCH] update Font codes. --- inc/hgl/graph/font/Font.h | 2 +- inc/hgl/graph/font/TextLayout.h | 2 +- inc/hgl/graph/font/TextRenderable.h | 14 ++++++++++++++ src/SceneGraph/font/FontSourceSingle.cpp | 4 ++-- src/SceneGraph/font/FontSourceWin.cpp | 4 ++-- 5 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 inc/hgl/graph/font/TextRenderable.h diff --git a/inc/hgl/graph/font/Font.h b/inc/hgl/graph/font/Font.h index b5ed4ed2..322b6062 100644 --- a/inc/hgl/graph/font/Font.h +++ b/inc/hgl/graph/font/Font.h @@ -13,7 +13,7 @@ namespace hgl */ struct Font { - char name[128]; ///<字体名称(utf8) + os_char name[128]; ///<字体名称 int width; ///<宽度 int height; ///<高度 diff --git a/inc/hgl/graph/font/TextLayout.h b/inc/hgl/graph/font/TextLayout.h index 0bd31288..5df9941e 100644 --- a/inc/hgl/graph/font/TextLayout.h +++ b/inc/hgl/graph/font/TextLayout.h @@ -101,7 +101,7 @@ namespace hgl bool end_disable; ///<是否行尾禁用符号 bool vrotate; ///<竖排时是否需要旋转 - FontAdvInfo adv_info; ///<字符绘制信息 + CharMetricsInfo adv_info; ///<字符绘制信息 };//struct CharLayoutAttributes using CLA=CharLayoutAttributes; diff --git a/inc/hgl/graph/font/TextRenderable.h b/inc/hgl/graph/font/TextRenderable.h new file mode 100644 index 00000000..dcebb50e --- /dev/null +++ b/inc/hgl/graph/font/TextRenderable.h @@ -0,0 +1,14 @@ +#ifndef HGL_GRAPH_TEXT_RENDERABLE_INCLUDE +#define HGL_GRAPH_TEXT_RENDERABLE_INCLUDE + +#include +namespace hgl +{ + namespace graph + { + class TextRenderable:public vulkan::Renderable + { + };// + }//namespace graph +}//namespace hgl +#endif//HGL_GRAPH_TEXT_RENDERABLE_INCLUDE diff --git a/src/SceneGraph/font/FontSourceSingle.cpp b/src/SceneGraph/font/FontSourceSingle.cpp index e2066ac9..a5640713 100644 --- a/src/SceneGraph/font/FontSourceSingle.cpp +++ b/src/SceneGraph/font/FontSourceSingle.cpp @@ -30,14 +30,14 @@ namespace hgl } } - const bool FontSourceSingle::GetCharAdvInfo(FontAdvInfo &adv_info,const u32char &ch) + const bool FontSourceSingle::GetCharMetrics(CharMetricsInfo &adv_info,const u32char &ch) { FontBitmap *bmp=GetCharBitmap(ch); if(!bmp) return false; - adv_info=bmp->adv_info; + adv_info=bmp->metrics_info; return(true); } }//namespace graph diff --git a/src/SceneGraph/font/FontSourceWin.cpp b/src/SceneGraph/font/FontSourceWin.cpp index e1b1267c..f68d0ef7 100644 --- a/src/SceneGraph/font/FontSourceWin.cpp +++ b/src/SceneGraph/font/FontSourceWin.cpp @@ -61,7 +61,7 @@ namespace hgl { hdc=CreateCompatibleDC(0); - hfont=CreateFont( -fnt.height, + hfont=CreateFontW( -fnt.height, fnt.width, 0, 0, @@ -144,4 +144,4 @@ namespace hgl return(new WinBitmapFont(f)); } }//namespace graph -}//namespace hgl \ No newline at end of file +}//namespace hgl