打开/关闭菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

48x48 Chinese font modulo description:修订间差异

来自LCD wiki
Lin留言 | 贡献
无编辑摘要
Lin留言 | 贡献
无编辑摘要
 
第2行: 第2行:


:尺寸设置如下图所示:
:尺寸设置如下图所示:
:[[File:Module-008.jpg|750px]]
:[[File:Module-015.png|750px]]
:取模成功后需要定义以下结构体数组存放取模数据(结构体定义见[http://www.lcdwiki.com/zh/%E3%80%90%E6%95%99%E7%A8%8B%E3%80%91%E4%B8%AD%E8%8B%B1%E6%96%87%E6%98%BE%E7%A4%BA%E5%8F%96%E6%A8%A1%E8%AE%BE%E7%BD%AE#.E4.B8.AD.E6.96.87.E6.B1.89.E5.AD.97.E5.8F.96.E6.A8.A1 '''中英文显示取模设置''']):
:取模成功后需要定义以下结构体数组存放取模数据(结构体定义见[http://www.lcdwiki.com/zh/%E3%80%90%E6%95%99%E7%A8%8B%E3%80%91%E4%B8%AD%E8%8B%B1%E6%96%87%E6%98%BE%E7%A4%BA%E5%8F%96%E6%A8%A1%E8%AE%BE%E7%BD%AE#.E4.B8.AD.E6.96.87.E6.B1.89.E5.AD.97.E5.8F.96.E6.A8.A1 '''中英文显示取模设置''']):
{{code|1=
{{code|1=

2020年3月11日 (三) 11:49的最新版本

  • 48x48中文字体取模说明
尺寸设置如下图所示:
取模成功后需要定义以下结构体数组存放取模数据(结构体定义见中英文显示取模设置):
const typFNT_GB48 tfont48[]=
{
    "中",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,
    0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,0x03,0xC0,0x00,0x00,0x00,0x00,
    0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,
    0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,
    0x00,0x00,0x02,0x00,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x03,0xC0,0x03,0xFF,
    0xFF,0xFF,0xFF,0xC0,0x03,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,
    0x01,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,
    0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x01,0x80,
    0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,
    0x01,0x80,0x03,0x80,0x03,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x01,0xFF,0xFF,0xFF,
    0xFF,0x80,0x01,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,0x03,0x80,
    0x03,0x80,0x03,0x80,0x02,0x00,0x03,0x80,0x02,0x00,0x00,0x00,0x03,0x80,0x00,0x00,
    0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,
    0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,
    0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,
    0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x80,
    0x00,0x00,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
函数定义如下:
void GUI_DrawFont48(u16 x, u16 y, u16 fc, u16 bc, u8 *s,u8 mode)
{
    u8 j;
    u16 k,i;
    u16 HZnum;
    u16 x0=x;
    HZnum=sizeof(tfont48)/sizeof(typFNT_GB48);	//自动统计汉字数目
    for (k=0;k<HZnum;k++) 
    {
        if ((tfont48[k].Index[0]==*(s))&&(tfont48[k].Index[1]==*(s+1)))
        { 	
            LCD_SetWindows(x,y,x+48-1,y+48-1);
	    for(i=0;i<48*6;i++)
	    {
	        for(j=0;j<8;j++)
		{
		    if(!mode) //非叠加模式:字体带有背景色,显示时会将原来显示的内容覆盖掉
		    {
			if(tfont48[k].Msk[i]&(0x80>>j))	
                        {                        
                            Lcd_WriteData_16Bit(fc);
			}
                        else
                        { 
                            Lcd_WriteData_16Bit(bc);
			}				
                    }
		    else //叠加模式:字体不带背景色,直接叠加显示到原来显示的内容上
		    {
			POINT_COLOR=fc;
			if(tfont48[k].Msk[i]&(0x80>>j))	
                        {                        
                            LCD_DrawPoint(x,y);//画一个点
                        }
			x++;
			if((x-x0)==48)
			{
			    x=x0;
			    y++;
			    break;
			}
		    }
		}
	    }
        }				  	
        continue;  //查找到对应点阵字库立即退出,防止多个汉字重复取模带来影响
    }	
    LCD_SetWindows(0,0,lcddev.width-1,lcddev.height-1);//恢复窗口为全屏  
}