long int Get_GBK_OffSet_Addr( unsigned int Hz,unsigned char Font_Size)
{
unsigned char CodeH = 0,CodeL=0;
long int Addr;
CodeH = ( unsigned char)(Hz >> 8);
CodeL = ( unsigned char)(Hz & 0x00FF);
Addr = (((CodeH - 0xA0 - 1)*94) + (CodeL-0xA0 - 1)) * (Font_Size * Font_Size / 8);
return Addr;
}
void Show_Font(uint16_t x,uint16_t y,uint16_t font,uint8_t size,uint8_t mode,uint16_t color)
{
uint8_t temp,t,t1;
uint16_t y0=y;
uint8_t dzk[512];
long int DZK_OFFSET;
uint16_t csize=(size/8+((size%8)?1:0))*(size);
DZK_OFFSET=Get_GBK_OffSet_Addr(font,size) ;
SPI_FLASH_BufferRead(dzk,DZK_OFFSET+ZIKU_OFFSET_ADDR,csize);
//Get_HzMat(font,dzk,size);
for(t=0;t<csize;t++)
{
temp=dzk[t];
for(t1=0;t1<8;t1++)
{
if(temp&0x80)LCD_DrawPoint(x,y,color);
else if(mode==0)LCD_DrawPoint(x,y,0x0000);
temp<<=1;
y++;
if((y-y0)==size)
{
y=y0;
x++;
break;
}
}
}
}
void Show_Str(uint16_t x,uint16_t y,uint16_t width,uint16_t height,uint8_t*str,uint8_t size,uint8_t mode,uint16_t color)
{
uint16_t x0=x;
uint16_t y0=y;
uint16_t H_DATA;
uint8_t L_DATA;
uint8_t bHz=0;
while(*str!=0)
{
if(!bHz)
{
if(*str>0x80)
{
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
{
// if(size>=40)
LCD_ShowChar(x,y,*str,size,mode,color);
// else
// LCD_ShowChar(x,y-16,*str,size+16,mode, color);
}
str++;
if(size>=40)
x+=size/2;
else
x+=(size)/2;
}
}else //中文
{
bHz=0;
if(x>(x0+width-size))
{
y+=size;
x=x0;
}
if(y>(y0+height-size))break;
H_DATA=*str;
L_DATA=*(str+1); //指针+1个位置
H_DATA=(H_DATA<<8)|L_DATA;
Show_Font(x,y,H_DATA,size,mode, color);
str+=2;
x+=size;
}
}
}