FONT8_8.C
上传用户:zfj3589
上传日期:2022-07-13
资源大小:635k
文件大小:15k
- /****************************************************************************************
- * 文件名:FONT8_8.C
- * 功能:8*8 ASCII码字体及显示函数。
- * 作者:黄绍斌
- * 日期:2004.02.26
- * 备注:使用GUI_SetColor()函数设置前景颜色及背景色。
- ****************************************************************************************/
- #include "config.h"
- #if FONT8x8_EN==1
- /* 8*8字体定义 */
- const uint8 FONT8x8ASCII[][8] = {
- /* 空格 */
- {
- ________,
- ________,
- ________,
- ________,
- ________,
- ________,
- ________,
- ________}
-
- /* ! */
- ,{
- ___XX___,
- __XXXX__,
- __XXXX__,
- ___XX___,
- ___XX___,
- ________,
- ___XX___,
- ________}
- /* " */
- ,{
- _XX__XX_,
- _XX__XX_,
- __X__X__,
- ________,
- ________,
- ________,
- ________,
- ________}
- /* # */
- ,{
- _XX_XX__,
- _XX_XX__,
- XXXXXXX_,
- _XX_XX__,
- XXXXXXX_,
- _XX_XX__,
- _XX_XX__,
- ________}
- /* $ */
- ,{
- ___XX___,
- __XXXXX_,
- _XX_____,
- __XXXX__,
- _____XX_,
- _XXXXX__,
- ___XX___,
- ________}
- /* % */
- ,{
- ________,
- XX___XX_,
- XX__XX__,
- ___XX___,
- __XX____,
- _XX__XX_,
- XX___XX_,
- ________}
- /* & */
- ,{
- __XXX___,
- _XX_XX__,
- __XXX___,
- _XXX_XX_,
- XX_XXX__,
- XX__XX__,
- _XXX_XX_,
- ________}
- /* ' */
- ,{
- ___XX___,
- ___XX___,
- __XX____,
- ________,
- ________,
- ________,
- ________,
- ________}
- /* ( */
- ,{
- ____XX__,
- ___XX___,
- __XX____,
- __XX____,
- __XX____,
- ___XX___,
- ____XX__,
- ________}
- /* ) */
- ,{
- __XX____,
- ___XX___,
- ____XX__,
- ____XX__,
- ____XX__,
- ___XX___,
- __XX____,
- ________}
- /* * */
- ,{
- ________,
- _XX__XX_,
- __XXXX__,
- XXXXXXXX,
- __XXXX__,
- _XX__XX_,
- ________,
- ________}
- /* + */
- ,{
- ________,
- ___XX___,
- ___XX___,
- _XXXXXX_,
- ___XX___,
- ___XX___,
- ________,
- ________}
- /* , */
- ,{
- ________,
- ________,
- ________,
- ________,
- ________,
- ___XX___,
- ___XX___,
- __XX____}
- /* - */
- ,{
- ________,
- ________,
- ________,
- _XXXXXX_,
- ________,
- ________,
- ________,
- ________}
- /* . */
- ,{
- ________,
- ________,
- ________,
- ________,
- ________,
- ___XX___,
- ___XX___,
- ________}
- /* / */
- ,{
- _____XX_,
- ____XX__,
- ___XX___,
- __XX____,
- _XX_____,
- XX______,
- X_______,
- ________}
- /* 0 */
- ,{
- __XXX___,
- _XX_XX__,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XX_XX__,
- __XXX___,
- ________}
- /* 1 */
- ,{
- ___XX___,
- __XXX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- _XXXXXX_,
- ________}
- /* 2 */
- ,{
- _XXXXX__,
- XX___XX_,
- _____XX_,
- ___XXX__,
- __XX____,
- _XX__XX_,
- XXXXXXX_,
- ________}
- /* 3 */
- ,{
- _XXXXX__,
- XX___XX_,
- _____XX_,
- __XXXX__,
- _____XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* 4 */
- ,{
- ___XXX__,
- __XXXX__,
- _XX_XX__,
- XX__XX__,
- XXXXXXX_,
- ____XX__,
- ___XXXX_,
- ________}
- /* 5 */
- ,{
- XXXXXXX_,
- XX______,
- XX______,
- XXXXXX__,
- _____XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* 6 */
- ,{
- __XXX___,
- _XX_____,
- XX______,
- XXXXXX__,
- XX___XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* 7 */
- ,{
- XXXXXXX_,
- XX___XX_,
- ____XX__,
- ___XX___,
- __XX____,
- __XX____,
- __XX____,
- ________}
- /* 8 */
- ,{
- _XXXXX__,
- XX___XX_,
- XX___XX_,
- _XXXXX__,
- XX___XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* 9 */
- ,{
- _XXXXX__,
- XX___XX_,
- XX___XX_,
- _XXXXXX_,
- _____XX_,
- ____XX__,
- _XXXX___,
- ________}
- /* : */
- ,{
- ________,
- ___XX___,
- ___XX___,
- ________,
- ________,
- ___XX___,
- ___XX___,
- ________}
- /* ; */
- ,{
- ________,
- ___XX___,
- ___XX___,
- ________,
- ________,
- ___XX___,
- ___XX___,
- __XX____}
- /* < */
- ,{
- _____XX_,
- ____XX__,
- ___XX___,
- __XX____,
- ___XX___,
- ____XX__,
- _____XX_,
- ________}
- /* = */
- ,{
- ________,
- ________,
- _XXXXXX_,
- ________,
- ________,
- _XXXXXX_,
- ________,
- ________}
- /* > */
- ,{
- _XX_____,
- __XX____,
- ___XX___,
- ____XX__,
- ___XX___,
- __XX____,
- _XX_____,
- ________}
- /* ? */
- ,{
- _XXXXX__,
- XX___XX_,
- ____XX__,
- ___XX___,
- ___XX___,
- ________,
- ___XX___,
- ________}
- /* @ */
- ,{
- _XXXXX__,
- XX___XX_,
- XX_XXXX_,
- XX_XXXX_,
- XX_XXXX_,
- XX______,
- _XXXX___,
- ________}
- /* A */
- ,{
- __XXX___,
- _XX_XX__,
- XX___XX_,
- XXXXXXX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- ________}
- /* B */
- ,{
- XXXXXX__,
- _XX__XX_,
- _XX__XX_,
- _XXXXX__,
- _XX__XX_,
- _XX__XX_,
- XXXXXX__,
- ________}
- /* C */
- ,{
- __XXXX__,
- _XX__XX_,
- XX______,
- XX______,
- XX______,
- _XX__XX_,
- __XXXX__,
- ________}
- /* D */
- ,{
- XXXXX___,
- _XX_XX__,
- _XX__XX_,
- _XX__XX_,
- _XX__XX_,
- _XX_XX__,
- XXXXX___,
- ________}
- /* E */
- ,{
- XXXXXXX_,
- _XX___X_,
- _XX_X___,
- _XXXX___,
- _XX_X___,
- _XX___X_,
- XXXXXXX_,
- ________}
- /* F */
- ,{
- XXXXXXX_,
- _XX___X_,
- _XX_X___,
- _XXXX___,
- _XX_X___,
- _XX_____,
- XXXX____,
- ________}
- /* G */
- ,{
- __XXXX__,
- _XX__XX_,
- XX______,
- XX______,
- XX__XXX_,
- _XX__XX_,
- __XXX_X_,
- ________}
- /* H */
- ,{
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XXXXXXX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- ________}
- /* I */
- ,{
- __XXXX__,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- __XXXX__,
- ________}
- /* J */
- ,{
- ___XXXX_,
- ____XX__,
- ____XX__,
- ____XX__,
- XX__XX__,
- XX__XX__,
- _XXXX___,
- ________}
- /* K */
- ,{
- XXX__XX_,
- _XX__XX_,
- _XX_XX__,
- _XXXX___,
- _XX_XX__,
- _XX__XX_,
- XXX__XX_,
- ________}
- /* L */
- ,{
- XXXX____,
- _XX_____,
- _XX_____,
- _XX_____,
- _XX___X_,
- _XX__XX_,
- XXXXXXX_,
- ________}
- /* M */
- ,{
- XX___XX_,
- XXX_XXX_,
- XXXXXXX_,
- XXXXXXX_,
- XX_X_XX_,
- XX___XX_,
- XX___XX_,
- ________}
- /* N */
- ,{
- XX___XX_,
- XXX__XX_,
- XXXX_XX_,
- XX_XXXX_,
- XX__XXX_,
- XX___XX_,
- XX___XX_,
- ________}
- /* O */
- ,{
- _XXXXX__,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* P */
- ,{
- XXXXXX__,
- _XX__XX_,
- _XX__XX_,
- _XXXXX__,
- _XX_____,
- _XX_____,
- XXXX____,
- ________}
- /* Q */
- ,{
- _XXXXX__,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX__XXX_,
- _XXXXX__,
- ____XXX_}
- /* R */
- ,{
- XXXXXX__,
- _XX__XX_,
- _XX__XX_,
- _XXXXX__,
- _XX_XX__,
- _XX__XX_,
- XXX__XX_,
- ________}
- /* S */
- ,{
- __XXXX__,
- _XX__XX_,
- __XX____,
- ___XX___,
- ____XX__,
- _XX__XX_,
- __XXXX__,
- ________}
- /* T */
- ,{
- _XXXXXX_,
- _XXXXXX_,
- _X_XX_X_,
- ___XX___,
- ___XX___,
- ___XX___,
- __XXXX__,
- ________}
- /* U */
- ,{
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* V */
- ,{
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XX_XX__,
- __XXX___,
- ________}
- /* W */
- ,{
- XX___XX_,
- XX___XX_,
- XX___XX_,
- XX_X_XX_,
- XX_X_XX_,
- XXXXXXX_,
- _XX_XX__,
- ________}
- /* X */
- ,{
- XX___XX_,
- XX___XX_,
- _XX_XX__,
- __XXX___,
- _XX_XX__,
- XX___XX_,
- XX___XX_,
- ________}
- /* Y */
- ,{
- _XX__XX_,
- _XX__XX_,
- _XX__XX_,
- __XXXX__,
- ___XX___,
- ___XX___,
- __XXXX__,
- ________}
- /* Z */
- ,{
- XXXXXXX_,
- XX___XX_,
- X___XX__,
- ___XX___,
- __XX__X_,
- _XX__XX_,
- XXXXXXX_,
- ________}
- /* [ */
- ,{
- __XXXX__,
- __XX____,
- __XX____,
- __XX____,
- __XX____,
- __XX____,
- __XXXX__,
- ________}
- /* */
- ,{
- XX______,
- _XX_____,
- __XX____,
- ___XX___,
- ____XX__,
- _____XX_,
- ______X_,
- ________}
- /* ] */
- ,{
- __XXXX__,
- ____XX__,
- ____XX__,
- ____XX__,
- ____XX__,
- ____XX__,
- __XXXX__,
- ________}
- /* ^ */
- ,{
- ___X____,
- __XXX___,
- _XX_XX__,
- XX___XX_,
- ________,
- ________,
- ________,
- ________}
- /* _ */
- ,{
- ________,
- ________,
- ________,
- ________,
- ________,
- ________,
- ________,
- XXXXXXXX}
- /* ` */
- ,{
- __XX____,
- ___XX___,
- ____XX__,
- ________,
- ________,
- ________,
- ________,
- ________}
- /* a */
- ,{
- ________,
- ________,
- _XXXX___,
- ____XX__,
- _XXXXX__,
- XX__XX__,
- _XXX_XX_,
- ________}
- /* b */
- ,{
- XXX_____,
- _XX_____,
- _XXXXX__,
- _XX__XX_,
- _XX__XX_,
- _XX__XX_,
- XX_XXX__,
- ________}
- /* c */
- ,{
- ________,
- ________,
- _XXXXX__,
- XX___XX_,
- XX______,
- XX___XX_,
- _XXXXX__,
- ________}
- /* d */
- ,{
- ___XXX__,
- ____XX__,
- _XXXXX__,
- XX__XX__,
- XX__XX__,
- XX__XX__,
- _XXX_XX_,
- ________}
- /* e */
- ,{
- ________,
- ________,
- _XXXXX__,
- XX___XX_,
- XXXXXXX_,
- XX______,
- _XXXXX__,
- ________}
- /* f */
- ,{
- __XXXX__,
- _XX__XX_,
- _XX_____,
- XXXXX___,
- _XX_____,
- _XX_____,
- XXXX____,
- ________}
- /* g */
- ,{
- ________,
- ________,
- _XXX_XX_,
- XX__XX__,
- XX__XX__,
- _XXXXX__,
- ____XX__,
- XXXXX___}
- /* h */
- ,{
- XXX_____,
- _XX_____,
- _XX_XX__,
- _XXX_XX_,
- _XX__XX_,
- _XX__XX_,
- XXX__XX_,
- ________}
- /* i */
- ,{
- ___XX___,
- ________,
- __XXX___,
- ___XX___,
- ___XX___,
- ___XX___,
- __XXXX__,
- ________}
- /* j */
- ,{
- _____XX_,
- ________,
- _____XX_,
- _____XX_,
- _____XX_,
- _XX__XX_,
- _XX__XX_,
- __XXXX__}
- /* k */
- ,{
- XXX_____,
- _XX_____,
- _XX__XX_,
- _XX_XX__,
- _XXXX___,
- _XX_XX__,
- XXX__XX_,
- ________}
- /* l */
- ,{
- __XXX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- __XXXX__,
- ________}
- /* m */
- ,{
- ________,
- ________,
- XXX_XX__,
- XXXXXXX_,
- XX_X_XX_,
- XX_X_XX_,
- XX_X_XX_,
- ________}
- /* n */
- ,{
- ________,
- ________,
- XX_XXX__,
- _XX__XX_,
- _XX__XX_,
- _XX__XX_,
- _XX__XX_,
- ________}
- /* o */
- ,{
- ________,
- ________,
- _XXXXX__,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XXXXX__,
- ________}
- /* p */
- ,{
- ________,
- ________,
- XX_XXX__,
- _XX__XX_,
- _XX__XX_,
- _XXXXX__,
- _XX_____,
- XXXX____}
- /* q */
- ,{
- ________,
- ________,
- _XXX_XX_,
- XX__XX__,
- XX__XX__,
- _XXXXX__,
- ____XX__,
- ___XXXX_}
- /* r */
- ,{
- ________,
- ________,
- XX_XXX__,
- _XXX_XX_,
- _XX_____,
- _XX_____,
- XXXX____,
- ________}
- /* s */
- ,{
- ________,
- ________,
- _XXXXXX_,
- XX______,
- _XXXXX__,
- _____XX_,
- XXXXXX__,
- ________}
- /* t */
- ,{
- __XX____,
- __XX____,
- XXXXXX__,
- __XX____,
- __XX____,
- __XX_XX_,
- ___XXX__,
- ________}
- /* u */
- ,{
- ________,
- ________,
- XX__XX__,
- XX__XX__,
- XX__XX__,
- XX__XX__,
- _XXX_XX_,
- ________}
- /* v */
- ,{
- ________,
- ________,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XX_XX__,
- __XXX___,
- ________}
- /* w */
- ,{
- ________,
- ________,
- XX___XX_,
- XX_X_XX_,
- XX_X_XX_,
- XXXXXXX_,
- _XX_XX__,
- ________}
- /* x */
- ,{
- ________,
- ________,
- XX___XX_,
- _XX_XX__,
- __XXX___,
- _XX_XX__,
- XX___XX_,
- ________}
- /* y */
- ,{
- ________,
- ________,
- XX___XX_,
- XX___XX_,
- XX___XX_,
- _XXXXXX_,
- _____XX_,
- XXXXXX__}
- /* z */
- ,{
- ________,
- ________,
- _XXXXXX_,
- _X__XX__,
- ___XX___,
- __XX__X_,
- _XXXXXX_,
- ________}
- /* { */
- ,{
- ____XXX_,
- ___XX___,
- ___XX___,
- _XXX____,
- ___XX___,
- ___XX___,
- ____XXX_,
- ________}
- /* | */
- ,{
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ___XX___,
- ________}
-
- /* } */
- ,{
- _XXX____,
- ___XX___,
- ___XX___,
- ____XXX_,
- ___XX___,
- ___XX___,
- _XXX____,
- ________}
- /* ~ */
- ,{
- _XXX_XX_,
- XX_XXX__,
- ________,
- ________,
- ________,
- ________,
- ________,
- ________}
- /* 0x7f */
- ,{
- XXXXXX__,
- XXXXXX__,
- XXXXXX__,
- XXXXXX__,
- XXXXXX__,
- XXXXXX__,
- XXXXXX__,
- ________}
-
- };
- /****************************************************************************
- * 名称:GUI_PutChar8_8()
- * 功能:显示ASCII码(8*8字体),显示值为20H-7FH(若为其它值,则显示' ')。
- * 入口参数: x 指定显示位置,x坐标
- * y 指定显示位置,y坐标
- * ch 要显示的ASCII码值。
- * 出口参数:返回值为1时表示操作成功,为0时表示操作失败。
- * 说明:操作失败原因是指定地址超出有效范围。
- ****************************************************************************/
- uint8 GUI_PutChar8_8(uint32 x, uint32 y, uint8 ch)
- { uint8 font_dat;
- uint8 i, j;
- TCOLOR bakc;
- /* 参数过滤 */
- if( x>(GUI_LCM_XMAX-8) ) return(0);
- if( y>(GUI_LCM_YMAX-8) ) return(0);
- if( (ch<0x20) || (ch>0x7f) ) ch = 0x20;
-
- ch -= 0x20;
- for(i=0; i<8; i++)
- { /* 读取点阵数据 */
- font_dat = FONT8x8ASCII[ch][i];
-
- for(j=0; j<8; j++)
- { /* 设置相应的点为color或为back_color */
- if( (font_dat&DCB2HEX_TAB[j])==0 ) GUI_CopyColor(&bakc, back_color);
- else GUI_CopyColor(&bakc, disp_color);
- GUI_Point(x, y, bakc);
- x++;
- }
-
- y++; // 指向下一行
- x -= 8; // 恢复x值
- }
-
- return(1);
- }
- /****************************************************************************
- * 名称:GUI_PutString8_8()
- * 功能:输出显示字符串((8*8字体,没有自动换行功能)。
- * 入口参数: x 指定显示位置,x坐标
- * y 指定显示位置,y坐标
- * str 要显示的ASCII码字符串
- * 出口参数:无
- * 说明:操作失败原因是指定地址超出有效范围。
- ****************************************************************************/
- void GUI_PutString8_8(uint32 x, uint32 y, char *str)
- { while(1)
- { if( (*str)==' ' ) break;
- if( GUI_PutChar8_8(x, y, *str++)==0 ) break;
- x += 6; // 下一个字符显示位置,y不变(即不换行)
- }
- }
- /****************************************************************************
- * 名称:GUI_PutNoStr8_8()
- * 功能:输出显示字符串((8*8字体,没有自动换行功能),若显示的字符个数大于指定个数,则直接退出。
- * 入口参数: x 指定显示位置,x坐标
- * y 指定显示位置,y坐标
- * str 要显示的ASCII码字符串。
- * no 最大显示字符的个数
- * 出口参数:无
- * 说明:操作失败原因是指定地址超出有效范围。
- ****************************************************************************/
- void GUI_PutNoStr8_8(uint32 x, uint32 y, char *str, uint8 no)
- { if(no==0) return;
- for(; no>0; no--)
- { if( (*str)==' ' ) break;
- if( GUI_PutChar(x, y, *str++)==0 ) break;
- x += 6; // 下一个字符显示位置,y不变(即不换行)
- }
- }
- #endif