在emwin中显示字库芯片GT23L24M0140的字模
本文博客链接:http://blog.csdn.net/jdh99,作者:jdh,转载请注明.
环境:
主机:WIN8
开发环境:MDK5.13
mcu: stm32f407VGIGH6
emwin: STemWin5.22
字库芯片:GT23L24M0140
说明:
项目中需要显示生僻字,所以不能使用GB2312,选择字库芯片GT23L24M0140,支持GB18030标准。
难点在于在emwin中嵌入此字库芯片的字符,emwin本身有一套接口,所以必须满足这套接口才能显示。
解决的方法是先移植在emwin中显示sd卡/flash中字库的函数,然后将具体读取函数替换成直接读取字库芯片的函数。
字库芯片的驱动程序见此文:驱动字库芯片GT23L24M0140
显示效果:
源代码:
GUI_UC_EncodeNone.c
/* ********************************************************************************************************* * uC/GUI * Universal graphic software for embedded applications * * (c) Copyright 2002, Micrium Inc., Weston, FL * (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH * * 礐/GUI is protected by international copyright laws. Knowledge of the * source code may not be used to write a similar product. This file may * only be used in accordance with a license and should not be redistributed * in any way. We appreciate your understanding and fairness. * ---------------------------------------------------------------------- File : GUI_UC_EncodeNone.c Purpose : Encoding routines for non unicode systems (default) ---------------------------END-OF-HEADER------------------------------ */ //#include "GUI_Protected.h" #include "GUI_Private.h" /********************************************************************* * * Static code * ********************************************************************** */ /********************************************************************* * * _GetCharCode * * Purpose: * Return the UNICODE character code of the current character. */ static U16 _GetCharCode(const char GUI_UNI_PTR * s) { if((*s) > 0xA0) { return *(const U16 GUI_UNI_PTR *)s; } return *(const U8 GUI_UNI_PTR *)s; } /********************************************************************* * * _GetCharSize * * Purpose: * Return the number of bytes of the current character. */ static int _GetCharSize(const char GUI_UNI_PTR * s) { GUI_USE_PARA(s); if((*s) > 0xA0) { return 2; } return 1; } /********************************************************************* * * _CalcSizeOfChar * * Purpose: * Return the number of bytes needed for the given character. */ static int _CalcSizeOfChar(U16 Char) { GUI_USE_PARA(Char); if(Char > 0xA0A0) { return 2; } return 1; } /********************************************************************* * * _Encode * * Purpose: * Encode character into 1/2/3 bytes. */ static int _Encode(char *s, U16 Char) { if(Char > 0xA0A0) { *((U16 *)s) = (U16)(Char); return 2; } *s = (U8)(Char); return 1; } /********************************************************************* * * Static data * ********************************************************************** */ /********************************************************************* * * _API_Table */ const GUI_UC_ENC_APILIST GUI__API_TableNone = { _GetCharCode, /* return character code as U16 */ _GetCharSize, /* return size of character: 1 */ _CalcSizeOfChar, /* return size of character: 1 */ _Encode /* Encode character */ }; /********************************************************************* * * Exported code * ********************************************************************** */ /********************************************************************* * * GUI_UC_SetEncodeNone */ void GUI_UC_SetEncodeNone_User(void) { GUI_LOCK(); //GUI_Context.pUC_API = &GUI__API_TableNone; GUI_pUC_API = &GUI__API_TableNone; GUI_UNLOCK(); } /*************************** End of file ****************************/
GUI_CharPEx.c
#include <stddef.h> /* needed for definition of NULL */ #include "GUI_Private.h" //#include "ff.h" #include "string.h" #include "inf_font.h" #include "font_type.h" //字模数据的暂存数组,以单个字模的最大字节数为设定值 #define BYTES_PER_FONT 1024 static U8 GUI_FontDataBuf[BYTES_PER_FONT]; ///*---------------------------------------------------------------------------*/ ///*字库外部函数部分-----------------------------------------------------------*/ //void GUI_X_GetFontData(char* font, U32 oft, U8 *ptr, U8 bytes) //{ //// FIL fsrc; // 定义文件操作类 //// FRESULT res; // 定义操作结果变量 //// UINT br; // 定义读写数量变量 //// res = f_open(&fsrc, font, FA_OPEN_EXISTING | FA_READ); //打开字库文件 //// if(res != FR_OK) //// { //// //// } //// res = f_lseek(&fsrc,oft); //找到首地址 //// res = f_read(&fsrc, ptr, bytes, &br); //读取32个字库点阵数据 //// res = f_close(&fsrc); //关闭字体 // //memcpy(ptr,acFontHZ12_b9da1,24); // //memcpy(ptr,read_buf,24); // // // bytes = inf_font_read(ASCII_7X8,'j',ptr); //} static void GUI_GetDataFromMemory(const GUI_FONT_PROP GUI_UNI_PTR *pProp, U16P c) { U16 BytesPerFont; U32 oft; char *font = (char *)pProp->paCharInfo->pData; //汉字正序 uint8_t c1 = c >> 8; uint8_t c2 = c; uint16_t c3 = (c2 << 8) + c1; BytesPerFont = GUI_pContext->pAFont->YSize * pProp->paCharInfo->BytesPerLine; //每个字模的数据字节数 if (BytesPerFont > BYTES_PER_FONT) {BytesPerFont = BYTES_PER_FONT;} if (c < 0x80) //英文字符地址偏移算法 { oft = (c-0x20) * BytesPerFont; BytesPerFont = inf_font_read(Font_Now,c,GUI_FontDataBuf); } else { oft = ((((c >> 8)-0xA1)) + ((c & 0xFF)-0xb0) * 94)* BytesPerFont; //中文字符地址偏移算法包括符号 BytesPerFont = inf_font_read(Font_Now,c3,GUI_FontDataBuf); // if (strncmp(FontEx_HZ,font,sizeof(FontEx_HZ)) == 0) // { // // } } //GUI_X_GetFontData(font, oft, GUI_FontDataBuf, BytesPerFont); // BytesPerFont = inf_font_read(Font_Now,c,GUI_FontDataBuf); } void GUIPROP_X_DispChar(U16P c) { int BytesPerLine; GUI_DRAWMODE DrawMode = GUI_pContext->TextMode; const GUI_FONT_PROP GUI_UNI_PTR *pProp = GUI_pContext->pAFont->p.pProp; //搜索定位字库数据信息 for (; pProp; pProp = pProp->pNext) { if ((c >= pProp->First) && (c <= pProp->Last))break; } if (pProp) { GUI_DRAWMODE OldDrawMode; const GUI_CHARINFO GUI_UNI_PTR * pCharInfo = pProp->paCharInfo; GUI_GetDataFromMemory(pProp, c);//取出字模数据 BytesPerLine = pCharInfo->BytesPerLine; OldDrawMode = LCD_SetDrawMode(DrawMode); LCD_DrawBitmap(GUI_pContext->DispPosX, GUI_pContext->DispPosY, pCharInfo->XSize, GUI_pContext->pAFont->YSize, GUI_pContext->pAFont->XMag, GUI_pContext->pAFont->YMag, 1, /* Bits per Pixel */ BytesPerLine, &GUI_FontDataBuf[0], &LCD_BKCOLORINDEX ); /* Fill empty pixel lines */ if (GUI_pContext->pAFont->YDist > GUI_pContext->pAFont->YSize) { int YMag = GUI_pContext->pAFont->YMag; int YDist = GUI_pContext->pAFont->YDist * YMag; int YSize = GUI_pContext->pAFont->YSize * YMag; if (DrawMode != LCD_DRAWMODE_TRANS) { LCD_COLOR OldColor = GUI_GetColor(); GUI_SetColor(GUI_GetBkColor()); LCD_FillRect(GUI_pContext->DispPosX, GUI_pContext->DispPosY + YSize, GUI_pContext->DispPosX + pCharInfo->XSize, GUI_pContext->DispPosY + YDist); GUI_SetColor(OldColor); } } LCD_SetDrawMode(OldDrawMode); /* Restore draw mode */ GUI_pContext->DispPosX += pCharInfo->XDist * GUI_pContext->pAFont->XMag; } } /********************************************************************* * * GUIPROP_GetCharDistX */ int GUIPROP_X_GetCharDistX(U16P c) { const GUI_FONT_PROP GUI_UNI_PTR * pProp = GUI_pContext->pAFont->p.pProp; for (; pProp; pProp = pProp->pNext) { if ((c >= pProp->First) && (c <= pProp->Last))break; } return (pProp) ? (pProp->paCharInfo)->XSize * GUI_pContext->pAFont->XMag : 0; }
font_type.h
/********************************************************************* * 字体类型定义头文件 * (c)copyright 2015,jdh * All Right Reserved *修改日期:2015/2/2 by jdh **********************************************************************/ #ifndef _FONT_TYPE_H_ #define _FONT_TYPE_H_ /********************************************************************* * 头文件 **********************************************************************/ #include "GUI.h" #include "inf_font.h" /********************************************************************* * 全局变量 **********************************************************************/ /********************************************************************* * 当前字体 **********************************************************************/ extern uint8_t Font_Now; /********************************************************************* * GUI结构:7*8点阵ASCII标准字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_7X8; /********************************************************************* * GUI结构:7*8点阵ASCII粗体字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_BOLD_7X8; /********************************************************************* * GUI结构:6*12点阵ASCII标准字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_6X12; /********************************************************************* * GUI结构:8*16点阵ASCII标准字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_8X16; /********************************************************************* * GUI结构:8*16点阵ASCII粗体字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_BOLD_8X16; /********************************************************************* * GUI结构:12*24点阵ASCII标准字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_12X24; /********************************************************************* * GUI结构:16*32点阵ASCII标准字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_16X32; /********************************************************************* * GUI结构:16*32点阵ASCII粗体字符 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_ASCII_BOLD_16X32; /********************************************************************* * GUI结构:12*12点阵GB18030汉字 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_GB18030_12X12; /********************************************************************* * GUI结构:16*16点阵GB18030汉字 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_GB18030_16X16; /********************************************************************* * GUI结构:24*24点阵GB18030汉字 **********************************************************************/ extern GUI_CONST_STORAGE GUI_FONT GUI_GB18030_24X24; /********************************************************************* * 函数 **********************************************************************/ /********************************************************************* * 设置字体 *说明:在使用字体前,必须先调用此函数 *参数:font:字体 **********************************************************************/ void set_font(uint8_t font); #endif
font_type.c
/********************************************************************* * 字体类型定义文件 * (c)copyright 2015,jdh * All Right Reserved *修改日期:2015/2/2 by jdh *修改日期:2015/2/3 by jdh *修改日期:2015/2/5 by jdh **********************************************************************/ #include "font_type.h" extern int GUIPROP_X_GetCharDistX(U16P c); extern void GUIPROP_X_DispChar(U16P c) ; extern void GUI_UC_SetEncodeNone_User(void); /********************************************************************* * 全局变量 **********************************************************************/ /********************************************************************* * 当前字体 **********************************************************************/ uint8_t Font_Now = 0; GUI_CONST_STORAGE GUI_CHARINFO GUI_FontHZ12_CharInfo[2] = { { 6, 6, 1, (void *)"1:/system/gui_font/ASC6x12.bin" }, //&ASC_ROM_8X16 { 12, 12, 2, (void *)"1:/system/gui_font/HZ12x12.bin"}, //&HZ_ROM_16X16 }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_FontHZ12_PropHZ= { // 0xA1A1, // 0xF7FE, 0xA1A1, 0xFFFF, &GUI_FontHZ12_CharInfo[1], (void *)0, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_FontHZ12_PropASC= { 0x0000, 0x007F, &GUI_FontHZ12_CharInfo[0], (void GUI_CONST_STORAGE *)&GUI_FontHZ12_PropHZ, }; //GUI_CONST_STORAGE GUI_FONT GUI_FontHZ12 = //{ // GUI_FONTTYPE_PROP_USER, // 12, //XSIZE // 12, //YSIZE // 1, //X方向放大倍数 // 1, //Y方向放大倍数 // (void GUI_CONST_STORAGE *)&GUI_FontHZ12_PropASC //}; GUI_CONST_STORAGE GUI_FONT GUI_FontHZ12 = { GUI_FONTTYPE_PROP_USER, 12, //XSIZE 12, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_FontHZ12_PropASC }; GUI_CONST_STORAGE GUI_FONT GUI_FontHZ12x2 = { GUI_FONTTYPE_PROP_USER, 12, 12, 2, 2, (void GUI_CONST_STORAGE *)&GUI_FontHZ12_PropASC }; /********************************************************************* * GUI结构:7*8点阵ASCII标准字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_7X8_CharInfo[1] = { { ASCII_7X8_WIDTH, ASCII_7X8_HEIGHT, 1, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_7X8_PropASC = { 0x0000, 0x007F, &GUI_ASCII_7X8_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_7X8 = { GUI_FONTTYPE_PROP_USER, ASCII_7X8_WIDTH * 2, //XSIZE ASCII_7X8_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_7X8_PropASC }; /********************************************************************* * GUI结构:7*8点阵ASCII粗体字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_BOLD_7X8_CharInfo[1] = { { ASCII_BOLD_7X8_WIDTH, ASCII_BOLD_7X8_HEIGHT, 1, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_BOLD_7X8_PropASC = { 0x0000, 0x007F, &GUI_ASCII_BOLD_7X8_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_BOLD_7X8 = { GUI_FONTTYPE_PROP_USER, ASCII_BOLD_7X8_WIDTH * 2, //XSIZE ASCII_BOLD_7X8_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_BOLD_7X8_PropASC }; /********************************************************************* * GUI结构:6*12点阵ASCII标准字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_6X12_CharInfo[1] = { { ASCII_6X12_WIDTH, ASCII_6X12_HEIGHT / 2, 1, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_6X12_PropASC = { 0x0000, 0x007F, &GUI_ASCII_6X12_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_6X12 = { GUI_FONTTYPE_PROP_USER, ASCII_6X12_WIDTH * 2, //XSIZE ASCII_6X12_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_6X12_PropASC }; /********************************************************************* * GUI结构:8*16点阵ASCII标准字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_8X16_CharInfo[1] = { { ASCII_8X16_WIDTH, ASCII_8X16_HEIGHT / 2, 1, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_8X16_PropASC = { 0x0000, 0x007F, &GUI_ASCII_8X16_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_8X16 = { GUI_FONTTYPE_PROP_USER, ASCII_8X16_WIDTH * 2, //XSIZE ASCII_8X16_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_8X16_PropASC }; /********************************************************************* * GUI结构:8*16点阵ASCII粗体字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_BOLD_8X16_CharInfo[1] = { { ASCII_BOLD_8X16_WIDTH, ASCII_BOLD_8X16_HEIGHT / 2, 1, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_BOLD_8X16_PropASC = { 0x0000, 0x007F, &GUI_ASCII_BOLD_8X16_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_BOLD_8X16 = { GUI_FONTTYPE_PROP_USER, ASCII_BOLD_8X16_WIDTH * 2, //XSIZE ASCII_BOLD_8X16_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_BOLD_8X16_PropASC }; /********************************************************************* * GUI结构:12*24点阵ASCII标准字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_12X24_CharInfo[1] = { { ASCII_12X24_WIDTH, ASCII_12X24_HEIGHT / 2, 2, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_12X24_PropASC = { 0x0000, 0x007F, &GUI_ASCII_12X24_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_12X24 = { GUI_FONTTYPE_PROP_USER, ASCII_12X24_WIDTH * 2, //XSIZE ASCII_12X24_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_12X24_PropASC }; /********************************************************************* * GUI结构:16*32点阵ASCII标准字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_16X32_CharInfo[1] = { { ASCII_16X32_WIDTH, ASCII_16X32_HEIGHT / 2, 2, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_16X32_PropASC = { 0x0000, 0x007F, &GUI_ASCII_16X32_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_16X32 = { GUI_FONTTYPE_PROP_USER, ASCII_16X32_WIDTH * 2, //XSIZE ASCII_16X32_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_16X32_PropASC }; /********************************************************************* * GUI结构:16*32点阵ASCII粗体字符 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_ASCII_BOLD_16X32_CharInfo[1] = { { ASCII_BOLD_16X32_WIDTH, ASCII_BOLD_16X32_HEIGHT / 2, 2, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_ASCII_BOLD_16X32_PropASC = { 0x0000, 0x007F, &GUI_ASCII_BOLD_16X32_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_ASCII_BOLD_16X32 = { GUI_FONTTYPE_PROP_USER, ASCII_BOLD_16X32_WIDTH * 2, //XSIZE ASCII_BOLD_16X32_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_ASCII_BOLD_16X32_PropASC }; /********************************************************************* * GUI结构:12*12点阵GB18030汉字 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_GB18030_12X12_CharInfo[1] = { { GB18030_12X12_WIDTH, GB18030_12X12_HEIGHT, 2, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_GB18030_12X12_PropASC = { 0x0, 0xFFFF, &GUI_GB18030_12X12_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_GB18030_12X12 = { GUI_FONTTYPE_PROP_USER, GB18030_12X12_WIDTH, //XSIZE GB18030_12X12_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_GB18030_12X12_PropASC }; /********************************************************************* * GUI结构:16*16点阵GB18030汉字 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_GB18030_16X16_CharInfo[1] = { { GB18030_16X16_WIDTH, GB18030_16X16_HEIGHT, 2, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_GB18030_16X16_PropASC = { 0x0, 0xFFFF, &GUI_GB18030_16X16_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_GB18030_16X16 = { GUI_FONTTYPE_PROP_USER, GB18030_16X16_WIDTH, //XSIZE GB18030_16X16_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_GB18030_16X16_PropASC }; /********************************************************************* * GUI结构:24*24点阵GB18030汉字 **********************************************************************/ GUI_CONST_STORAGE GUI_CHARINFO GUI_GB18030_24X24_CharInfo[1] = { { GB18030_24X24_WIDTH, GB18030_24X24_HEIGHT, 3, (void *)0 }, }; GUI_CONST_STORAGE GUI_FONT_PROP GUI_GB18030_24X24_PropASC = { 0x0, 0xFFFF, &GUI_GB18030_24X24_CharInfo[0], (void *)0 }; GUI_CONST_STORAGE GUI_FONT GUI_GB18030_24X24 = { GUI_FONTTYPE_PROP_USER, GB18030_24X24_WIDTH, //XSIZE GB18030_24X24_HEIGHT, //YSIZE 1, //X方向放大倍数 1, //Y方向放大倍数 (void GUI_CONST_STORAGE *)&GUI_GB18030_24X24_PropASC }; /********************************************************************* * 设置字体 *说明:在使用字体前,必须先调用此函数 *参数:font:字体 **********************************************************************/ void set_font(uint8_t font) { GUI_UC_SetEncodeNone_User(); Font_Now = font; // switch (font) // { // case ASCII_7X8: // { // GUI_SetFont(&GUI_ASCII_7X8); // break; // } // case ASCII_BOLD_7X8: // { // GUI_SetFont(&GUI_ASCII_BOLD_7X8); // break; // } // case ASCII_6X12: // { // GUI_SetFont(&GUI_ASCII_6X12); // break; // } // case ASCII_8X16: // { // GUI_SetFont(&GUI_ASCII_8X16); // break; // } // case ASCII_BOLD_8X16: // { // GUI_SetFont(&GUI_ASCII_BOLD_8X16); // break; // } // case ASCII_12X24: // { // GUI_SetFont(&GUI_ASCII_12X24); // break; // } // case ASCII_16X32: // { // GUI_SetFont(&GUI_ASCII_16X32); // break; // } // case ASCII_BOLD_16X32: // { // GUI_SetFont(&GUI_ASCII_BOLD_16X32); // break; // } // case GB18030_12X12: // { // GUI_SetFont(&GUI_GB18030_12X12); // break; // } // case GB18030_16X16: // { // GUI_SetFont(&GUI_GB18030_16X16); // break; // } // case GB18030_24X24: // { // GUI_SetFont(&GUI_GB18030_24X24); // break; // } // } }
测试代码:
set_font(ASCII_7X8); GUI_SetFont(&GUI_ASCII_7X8); GUI_DispStringAtCEOL("ASCII_7X8:I am jdh!", 0, 0); set_font(ASCII_BOLD_7X8); GUI_SetFont(&GUI_ASCII_BOLD_7X8); GUI_DispStringAtCEOL("ASCII_7X8_BOLD:I am jdh!", 0, 20); set_font(ASCII_6X12); GUI_SetFont(&GUI_ASCII_6X12); GUI_DispStringAtCEOL("ASCII_6X12:I am jdh!", 0, 40); set_font(ASCII_8X16); GUI_SetFont(&GUI_ASCII_8X16); GUI_DispStringAtCEOL("ASCII_8X16:I am jdh!", 0, 60); set_font(ASCII_BOLD_8X16); GUI_SetFont(&GUI_ASCII_BOLD_8X16); GUI_DispStringAtCEOL("ASCII_8X16_BOLD:I am jdh!", 0, 80); set_font(ASCII_12X24); GUI_SetFont(&GUI_ASCII_12X24); GUI_DispStringAtCEOL("ASCII_12X24:I am jdh!", 0, 100); set_font(ASCII_16X32); GUI_SetFont(&GUI_ASCII_16X32); GUI_DispStringAtCEOL("ASCII_16X32:I am jdh!", 0, 130); set_font(ASCII_BOLD_16X32); GUI_SetFont(&GUI_ASCII_BOLD_16X32); GUI_DispStringAtCEOL("ASCII_16X32_BOLD:I am jdh!", 0, 170); set_font(GB18030_12X12); GUI_SetFont(&GUI_GB18030_12X12); inf_font_asc2gb18030(str,"12X12:我是jdh!"); GUI_DispStringAtCEOL(str, 0, 200); set_font(GB18030_16X16); GUI_SetFont(&GUI_GB18030_16X16); inf_font_asc2gb18030(str,"16X16:我是jdh!"); GUI_DispStringAtCEOL(str, 0, 230); set_font(GB18030_24X24); GUI_SetFont(&GUI_GB18030_24X24); inf_font_asc2gb18030(str,"24X24:我是jdh!"); GUI_DispStringAtCEOL(str, 0, 260);