diff --git a/inc/hgl/graph/font/Font.h b/inc/hgl/graph/font/Font.h index 322b6062..be5b9e57 100644 --- a/inc/hgl/graph/font/Font.h +++ b/inc/hgl/graph/font/Font.h @@ -1,19 +1,20 @@ #ifndef HGL_GRAPH_FONT_INCLUDE #define HGL_GRAPH_FONT_INCLUDE -#include -#include +#include namespace hgl { namespace graph { + constexpr size_t MAX_FONT_NAME_LENGTH=128; + /** * 字体信息 */ struct Font { - os_char name[128]; ///<字体名称 + os_char name[MAX_FONT_NAME_LENGTH]; ///<字体名称 int width; ///<宽度 int height; ///<高度 @@ -26,7 +27,7 @@ namespace hgl public: Font(); - Font(const char *,int,int,bool,bool,bool=true); + Font(const os_char *,int,int,bool,bool,bool=true); CompOperatorMemcmp(const Font &); ///<比较操作符重载 };//struct Font diff --git a/src/SceneGraph/font/Font.cpp b/src/SceneGraph/font/Font.cpp index a9b32409..4c0fbcca 100644 --- a/src/SceneGraph/font/Font.cpp +++ b/src/SceneGraph/font/Font.cpp @@ -1,4 +1,5 @@ #include +#include namespace hgl { @@ -9,11 +10,11 @@ namespace hgl memset(this,0,sizeof(Font)); } - Font::Font(const char *n,int w,int h,bool b,bool i,bool aa) + Font::Font(const os_char *n,int w,int h,bool b,bool i,bool aa) { memset(this,0,sizeof(Font)); - strcpy(name,n); + hgl::strcpy(name,MAX_FONT_NAME_LENGTH,n); width=w; height=h;