diff --git a/inc/hgl/graph/text/FontInfo.Attrib.h b/inc/hgl/graph/text/FontInfo.Attrib.h deleted file mode 100644 index cb0c7e4b..00000000 --- a/inc/hgl/graph/text/FontInfo.Attrib.h +++ /dev/null @@ -1,25 +0,0 @@ - static FontInfo *DefaultFont; - -private: - - UTF16String name; - - int width,height; - bool bold,italic; - -protected: - - UTF16String &GetName(){return name;} - void SetName(UTF16String &); - - int GetWidth(){return width;} - int GetHeight(){return height;} - bool GetBold(){return bold;} - bool GetItalic(){return italic;} - - void SetWidth(int); - void SetHeight(int); - void SetBold(bool); - void SetItalic(bool); - - void InitPrivate(); diff --git a/inc/hgl/graph/text/FontInfo.h b/inc/hgl/graph/text/FontInfo.h deleted file mode 100644 index 491023a4..00000000 --- a/inc/hgl/graph/text/FontInfo.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef HGL_FONT_INFO_INCLUDE -#define HGL_FONT_INFO_INCLUDE - -#include -#include -#include -namespace hgl -{ - /** - * 字体数据结构
- * 用于记录字体名称,粗体,斜体,下划线等等信息 - */ - class FontInfo ///字体数据结构 - { - #include - - public: //属性 - - Property Name; ///<字体名称 - - Property Width; ///<平均字体宽度 - Property Height; ///<字体高度 - - Property Bold; ///<是否粗体 - Property Italic; ///<是否斜体 - - public: //事件 - - DefEvent(void,OnChange,(FontInfo *)); ///<字体改变事件 - - public: //方法 - - FontInfo(); - FontInfo(const FontInfo &); - FontInfo(const UTF16String &,int,int,bool=false,bool=false); - - static void SetDefaultFont(const UTF16String &,int,int,bool,bool); ///<设置缺省字体 - static void SetDefaultFont(const FontInfo &); ///<设置缺省字体 - static void ClearDefaultFont(); ///<清除缺省字体 - - void Set(const UTF16String &,int,int,bool=false,bool=false); ///<设置字体 - - public: //操作符重载 - - bool operator == (const FontInfo &); - bool operator != (const FontInfo &); - - void operator = (const FontInfo &); - };//class FontInfo -}//namespace hgl -#endif//HGL_FONT_INFO_INCLUDE diff --git a/inc/hgl/graph/text/FontSource.h b/inc/hgl/graph/text/FontSource.h deleted file mode 100644 index 6ab82a70..00000000 --- a/inc/hgl/graph/text/FontSource.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef HGL_GRAPH_FONT_SOURCE_INCLUDE -#define HGL_GRAPH_FONT_SOURCE_INCLUDE - -#include -namespace hgl -{ - namespace graph - { - /** - * 字体数据源抽像基类
- * 主要提供点阵字体的数据产生管理 - */ - class FontSource - { - public: - - /** - * 字体位图数据 - */ - struct Bitmap - { - int x,y; //图像显示偏移 - int w,h; //图像尺寸 - - int adv_x,adv_y;//字符尺寸 - - unsigned char *data; - };//struct Bitmap - - protected: - - FontInfo fnt; - - FontSource::Bitmap char_bitmap[0xFFFF]; ///<字符位图数据 - - protected: - - virtual bool MakeCharBitmap(u16char)=0; ///<产生字体数据 - virtual int GetLineHeight()const=0; ///<取得行高 - - public: - - FontSource(const FontInfo &); - virtual ~FontSource(); - - FontSource::Bitmap *GetCharBitmap(u16char); ///<取得字体数据 - };//class FontSource - }//namespace graph -}//namespace hgl -#endif//HGL_GRAPH_FONT_SOURCE_INCLUDE diff --git a/inc/hgl/graph/text/TileFont.h b/inc/hgl/graph/text/TileFont.h deleted file mode 100644 index 3d2255cc..00000000 --- a/inc/hgl/graph/text/TileFont.h +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef HGL_GRAPH_TILE_FONT_INCLUDE -#define HGL_GRAPH_TILE_FONT_INCLUDE - -#include -#include -#include -#include -#include -#include -#include -namespace hgl -{ - namespace graph - { - struct FontInfo; - class Renderable; - class Material; - - /** - * 使用每个Tile代表一个字符的管理模块
- * 即可以使用系统字体,由程序实时生成字符;也可以使用由美术制作好的字体图片。 - */ - class TileFont ///Tile字体 - { - protected: - - TileData *tile_data; /// fud; ///<字体缓冲管理 - - uint8 *char_bitmap_buffer; ///<字符位图缓冲区 - uint char_bitmap_bytes; ///<字符位图字节数 - - VB2f *vertex2d; ///<绘制用顶点坐标 - VB2f *tex_coord; ///<绘制用顶点坐标 -// VB1ui *vertex_color; ///<绘制用顶点色 - Material *fnt_mtl; ///<绘制用材质 - Renderable *fnt_draw; ///<绘制用对象 - - int tile_width,tile_height; ///<所使用的Tile宽高 - int font_height; - int line_distance; - - protected: - - void Clear(const u16char &,TileData::Object *&); ///<清除某个字 - - FontSource::Bitmap *GetCharBitmap(const u16char &ch) ///<取得字符位图数据 - {return ((ch<=0xFF?eng_source:chs_source)->GetCharBitmap(ch));} - - FontSource::Bitmap *MakeCharBitmap(const u16char &ch); ///<生成字符位图数据 - - TileData::Object *GetCharData(const u16char &); ///<取得字符数据 - - bool MakeupText(Makeup &,int,int,const u16char *,int); ///<排版字符串 - - public: - - int GetHeight ()const {return font_height;} ///<取得字符高度 - int GetLineDistance ()const {return line_distance;} ///<取得行间距 - - void SetLineDistance(int n) {line_distance=n;} - - public: //属性 - - Color4f Color; ///<颜色 - - public: - - TileFont(int,TileData *,FontSource *,FontSource *); - virtual ~TileFont(); - - float CharWidth(u16char); ///<指定字符宽度 - float GetStringWidth(const u16char *,int=-1); ///<求字符串宽度 - - public: - - bool MakeupText(Makeup &,const u16char *,int=-1); ///<排版字符串 - bool MakeupText(Makeup &,const u16char *,int,TextAlignment); ///<排版字符串 - - void Draw(const Matrix4f *,const Makeup &,int=-1); ///<根据排版进行绘制 - - void Draw(float l,float t,const Makeup &makeup,int limit_char=-1) ///<根据排版进行绘制 - { - const Matrix4f mat=translate(l,t,0); - - Draw(&mat,makeup,limit_char); - } - - /** - * 绘制一个字符串,可限制字数,并且处理\n - * @param mat modelview变换矩阵 - * @param str 字符串 - * @param limit_char 限制的字数,-1表示不限制 - * @return 字符串的象素级宽度 - * @return <0 错误 - */ - float DrawString(const Matrix4f *mat,const u16char *str,int limit_char=-1) ///<绘制一个字符串,可限制字数,并且处理\n - { - Makeup m; - - if(!MakeupText(m,str,limit_char)) - return(-1); - - Draw(mat,m,limit_char); - - return m.Width; - } - - /** - * 绘制一个字符串,可限制字数,并且处理\n - * @param x X坐标 - * @param y Y坐标 - * @param str 字符串 - * @param limit_char 限制的字数,-1表示不限制 - * @return 字符串的象素级宽度 - * @return <0 错误 - */ - float DrawString(float x,float y,const u16char *str,int limit_char=-1) ///<绘制一个字符串,可限制字数,并且处理\n - { - const Matrix4f mat=translate(x,y,0); - - return DrawString(&mat,str,limit_char); - } - - float DrawFormat(const Matrix4f *mat,const u16char *,...); ///<绘制一个格式化的字符串 - float DrawFormat(float,float,const u16char *,...); ///<绘制一个格式化的字符串 - };//class TileFont - - TileFont *CreateTileFont(const FontInfo &,const FontInfo &,int=-1); ///<创建一个字体,使用系统字体 - - /** - * 通过系统字体创建一个Tile字体 - * @param chs_fontname 中文字体名称 - * @param eng_fontname 英文字体名称 - * @param width 宽,可以为0,表示默认。 - * @param height 高 - * @param bold 加粗,默认false - * @param italic 斜体,默认false - * @param anti 是否抗矩齿,默认true - * @param count 缓冲区内保存的字符个数 - */ - TileFont *CreateTileFont(const u16char *chs_fontname,const u16char *eng_fontname,int width,int height,bool bold=false,bool italic=false,bool anti=true,int count=-1); - - /** - * 通过系统字体创建一个Tile字体,中英文字体相同 - * @param fontname 字体名称 - * @param width 宽,可以为0,表示默认。 - * @param height 高 - * @param bold 加粗,默认false - * @param italic 斜体,默认false - * @param anti 是否抗矩齿,默认true - * @param count 缓冲区内保存的字符个数 - */ - __inline TileFont *CreateTileFont(const u16char *fontname,int width,int height,bool bold=false,bool italic=false,bool anti=true,int count=-1) - { - return CreateTileFont(fontname,fontname,width,height,bold,italic,anti,count); - } - - /** - * 通过系统字体创建一个Tile字体,无斜体,无加粗 - * @param chs_fontname 中文字体名称 - * @param eng_fontname 英文字体名称 - * @param width 宽,可以为0,表示默认。 - * @param height 高 - * @param count 缓冲区内保存的字符个数 - */ - __inline TileFont *CreateTileFont(const u16char *chs_fontname,const u16char *eng_fontname,int width,int height,int count=-1) - { - return CreateTileFont(chs_fontname,eng_fontname,width,height,false,false,true,count); - } - }//namespace graph -}//namespace hgl -#endif//HGL_GRAPH_TILE_FONT_INCLUDE