⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fontmng.h

📁 好记星的控件,包括button,list,对文件操作
💻 H
字号:
/****************************************************************************/
/*                                                                          */
/*              Copyright (C) 2005 SHENZHEN MEIJIN CO.LTD                   */
/*                                                                          */
/* FILE NAME:   FontMng.h                                                   */
/* MODULE NAME: FONTMNG                                                     */
/* DESCRIPTION: font manager head file                                      */
/*                                                                          */
/****************************************************************************/
/*    DTAE       AUTHOR     VERSION                 REMARKS                 */
/* ==========  ============   ==============================================*/
/* 2005-3-22   maying        V1.0     create                                */
/****************************************************************************/

#ifndef __FONTMNG_H__
#define __FONTMNG_H__


/* 字库信息定义 */
typedef struct
{
    UINT16      wFontLibID;        /* 字库的标识ID号 */
    UINT16      wStrID;            /* 字库标识名称的字符串ID */
    UINT		uFontWidth;		   /* 等宽字体的宽度*/
    UINT        uFontHeight;       /* 字库的点阵高度 */
    UINT        uLibSaveType;      /* 字库存放形式 */
    UINT8*	    pFontLibAddr;      /* 字库起始地址,字库以数据块形式装在Rom或Norflash中
    时为物理地址,字库以文件形式装在NandFlash中时为字库文件名的const地址*/
    UINT32      wCodeStart;        //内码起始位置
    UINT32      wCodeEnd;          //内码结束位置
	UINT32      wCodeOffset;       //使用编码与内码起始位置的偏移
	UINT32      *pCodeWidth;       //编码的行宽
} FontLibInfo;

typedef struct {
	UINT16 wFontWidth;			/* 字符宽度 */
	UINT16 wFontHeight;			/* 字符高度 */
} FontInfo;

/*字库文件的结构*/
typedef struct
{
    UINT16      wCodeStart;        //内码起始位置
    UINT16      wCodeEnd;          //内码结束位置
    UINT32      dwBlkOffset;       //分块的偏移量
} FontBlock; //有[wBlocks]个结构数组

//字库文件的头信息(用于Nandflash中的字库文件,与ED115相同)
//本结构的部分成员是冗余的,在本模块未使用,保留下来是为与ED115的字库文件一致。
typedef struct
{
    UINT16		baFontLibFlag;		/*字库标志0x7466,用于下载字库的校验*/
    UINT8		baFontInfo[10];		/*字库名称*/
    UINT16      wFontLibID;         /* 字库的标识ID号 */
    UINT16		wStyle;				/*字库样式*/ 
    UINT8		byFontWidth;		/* 等宽字体的宽度*/
    UINT8       byFontHeight;       /* 字库的点阵高度 */
    UINT16		wBlocks;		    /*分块数*/
    UINT8		*pStartAddr;		/*本结构在内存中的位置, 如果为文件则为指向文件名的const地址,  
                                    制作字库时置为NULL, 由加载程序在注册字库时完成此项内容填写*/

} FontLibFileHead;


/* 系统字库结构定义 */
/*
typedef struct  tagFontInfo {
    UINT16      wStyle;				//字库样式
    UINT8		fontWidth;
    UINT8		fontHeight;
    UINT8 		*pDotInfo;			//字符信息, 对于单色字体,直接为点阵内容,
									//否则为RGB色彩值,RGB|RBG|RGB...
} FontInfo;
*/
#define     SYSFONTFLAG				0x7466

/* 常量定义 */
#define     SYSFONTWIDTH   18        //系统默认字体的宽
#define     SYSFONTHEIGHT  16        //系统默认字体的高

#define     SYSTLIB        FONT16_NORMAL_FONT
#define		SYSTLIBTOTAL   6

#define FONTLIB_GBk12    12      /* GBk 12点阵字体,即12*12 */
#define FONTLIB_GBk16    16      /* GBk 16*16 16点阵字体*/
#define FONTLIB_GBK24    24      /* GBk 24*24 点阵字体*/

#define FONT12_NORMAL_FONT      0                          //12*12正常字体
#define FONT12_BLOD_FONT        1                          //12*12粗体
#define FONT12_ITALIC_FONT      2                          //12*12斜体

#define FONT16_NORMAL_FONT      3                          //16*16正常字体
#define FONT16_BLOD_FONT        4                          //16*16粗体
#define FONT16_ITALIC_FONT      5                          //16*16斜体

//#define FONT24_NORMAL_FONT      6                          //24*24正常字体
//#define FONT24_BLOD_FONT        7                          //24*24粗体
//#define FONT24_ITALIC_FONT      8                          //24*24斜体

#define FONTSAVETYPE_DATA    1         /*字库以数据块形式存放*/ 
#define FONTSAVETYPE_FILE    2         /*字库以文件形式存放*/

BOOL FontMngInitialize(void);
UINT16 FontSetLib (UINT16 wFontlibID);
UINT16 FontGetLib (VOID);
UINT FontGetHeight(UINT16 wFontLibID);
BOOL FontGetCharInfo (UINT16 wFontLibID, UINT32 wCode, FontInfo *pFontInfo,UINT8 *lpDotArray);
UINT16 FontGetAsciiWidth(UINT16 wFontLibID, UINT8	ch);
UINT16 FontGetStringWidth (UINT16 wFontLibID, UINT8* lpString);
UINT16 FontGetRectCharNum (UINT16 wFontLibID, UINT16 *width, UINT16 *height, UINT8* lpString);
BOOL FontIsComposeFont(UINT32 wCode);
BOOL FontGetStringRect(UINT16 *width, UINT16 *height, UINT8 *lpString);
//高林辉新加的一些工具函数
BOOL IsSmallFont(UINT32 wCode);		// 函数描述: 判断是否为半角自造字
BOOL IsUserFont(UINT32 wCode);		// 函数描述: 判断是否为半角字
INT FontGetCharCodeWidth(UINT8 *str);  //获取字符的编码宽度

/*--------------------------------------字库构成说明------------------------------------*/
/*																						*/
/*	1.所有字库都包含FontLibHead头结构和wCodeStart[wBlocks]、byCodeEnd[wBlocks],点阵数据 */
/*	  行字节对齐, wBlocks  为大于0的数,所有偏移量都以FontLibInfo开始的地方为基准        */
/*																						*/
/*	2.对于等宽字库, 结构为	FontLibHead                                                 */
/*                          FontBlock[wBlocks]                                          */
/*                          DotInfo                                                     */
/*																						*/
/*--------------------------------------------------------------------------------------*/


/*--------------------------------------字库构成说明------------------------------------*/
/*																						*/
/*	1.所有字库都包含FontLibInfo头结构和wCodeStart[wBlocks]、byCodeEnd[wBlocks],点阵数据 */
/*	  行字节对齐, wBlocks  为大于0的数,所有偏移量都以FontLibInfo开始的地方为基准        */
/*																						*/
/*	2.对于等宽字库, 结构为	FontLibInfo                                                 */
/*                          FontBlock[wBlocks]                                          */
/*                          DotInfo                                                     */
/*																						*/
/*	  对于不等宽字库, 结构为FontLibInfo                                                 */
/*                          FontBlock[wBlocks]                                          */
/*                          『                                                          */
/*                            pIndex (UINT32类型)                                       */
/*                            DotInfo 』[wBlocks]                                       */
/*	  																					*/
/*	3.ClearType字体均为不等宽字体                                                       */
/*                  结构为  FontLibInfo                                                 */
/*                          FontBlock[wBlocks]                                          */
/*                          『                                                          */
/*                            pIndex (UINT32类型)                                       */
/*                            DotInfo(其数据格式为RGB|RBG|RGB|...) 』[wBlocks]		    */
/*--------------------------------------------------------------------------------------*/


#endif  /* #ifndef __FONTMNG_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -