#include "w25qxx.h" #include "ltdc_drv.h" #include "font_text.h" #include "string.h" #include "lcd_base_display.h" #include "file_cache.h" #include "internal_flash.h" #define F24addr FLASH_FONT_START_ADDR void set_font_color(unsigned int point_color, unsigned int back_color) { POINT_COLOR = point_color; BACK_COLOR = back_color; } //code 字符指针开始 //从字库中查找出字模 //code 字符串的开始地址,GBK码 //mat 数据存放地址 (size/8+((size%8)?1:0))*(size) bytes大小 //size:字体大小 void Get_HzMat(unsigned char *code,unsigned char *mat,unsigned char size) { static unsigned char kkk[256]; unsigned char qh,ql; unsigned char i; unsigned long foffset; unsigned char csize=(size/8+((size%8)?1:0))*(size);//得到字体一个字符对应点阵集所占的字节数 qh=*code; ql=*(++code); /* if(qh<0x81||ql<0x40||ql==0xff||qh==0xff)//非常用汉字 { for(i=0;i0x80)bHz=1;//中文 else //字符 { if(x>(x0+width-size/2))//换行 { y+=size; x=x0; } if(y>(y0+height-size))break;//越界返回 if(*str==13)//换行符号 { y+=size; x=x0; str++; } else LCD_ShowChar(x,y,*str,size,mode);//有效部分写入 str++; x+=size/2; //字符,为全字的一半 } }else//中文 { bHz=0;//有汉字库 if(x>(x0+width-size))//换行 { y+=size; x=x0; } if(y>(y0+height-size))break;//越界返回 Show_Font(x,y,str,size,mode); //显示这个汉字,空心显示 str+=2; x+=size;//下一个汉字偏移 } } } //在指定宽度的中间显示字符串 //如果字符长度超过了len,则用Show_Str显示 //len:指定要显示的宽度 void Show_Str_Mid(unsigned short x,unsigned short y,unsigned char*str,unsigned char size,unsigned char len) { unsigned short strlenth=0; strlenth=strlen((const char*)str); strlenth*=size/2; /* if(strlenth>len)Show_Str(x,y,lcddev.width,lcddev.height,str,size,1); else { strlenth=(len-strlenth)/2; Show_Str(strlenth+x,y,lcddev.width,lcddev.height,str,size,1); } */ }