Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

16x16 Chinese font modulo description: Difference between revisions

From LCD wiki
Lin (talk | contribs)
Created page with "'''16x16 Chinese font modulo description''' :The size settings are as shown below: :750px :After the modulo is successful, you need to define the follo..."
 
Lin (talk | contribs)
No edit summary
 
Line 2: Line 2:
:The size settings are as shown below:
:The size settings are as shown below:
:[[File:Module-014.jpg|750px]]
:[[File:Module-014.jpg|750px]]
:After the modulo is successful, you need to define the following structure array to store the modulo data (see the important note above for the structure definition):
:After the modulo is successful, you need to define the following structure array to store the modulo data (the definition of structure is in the [http://www.lcdwiki.com/Chinese_and_English_display_modulo_settings '''Chinese_and_English_display_modulo_settings''']):
{{code|1=
{{code|1=
const typFNT_GB16 tfont16[]=   
const typFNT_GB16 tfont16[]=   

Latest revision as of 11:46, 14 March 2020

16x16 Chinese font modulo description

The size settings are as shown below:
After the modulo is successful, you need to define the following structure array to store the modulo data (the definition of structure is in the Chinese_and_English_display_modulo_settings):
const typFNT_GB16 tfont16[]=   
{
  "中",0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x3F,0xF8,0x21,0x08,0x21,0x08,0x21,0x08,
  0x21,0x08,0x21,0x08,0x3F,0xF8,0x21,0x08,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,
};
The function is defined as follows:
void GUI_DrawFont16(u16 x, u16 y, u16 fc, u16 bc, u8 *s,u8 mode)
{
   u8 i,j;
   u16 k;
   u16 HZnum;
   u16 x0=x;
   HZnum=sizeof(tfont16)/sizeof(typFNT_GB16);	//Automatic statistics of the number of Chinese characters
   for (k=0;k<HZnum;k++) 
   {
       if((tfont16[k].Index[0]==*(s))&&(tfont16[k].Index[1]==*(s+1)))
       { 	
           LCD_SetWindows(x,y,x+16-1,y+16-1);
	   for(i=0;i<16*2;i++)
           {
		for(j=0;j<8;j++)
		{	
		     if(!mode) //Non-overlay mode: The font has a background color, which will overwrite the original display
		     {
			  if(tfont16[k].Msk[i]&(0x80>>j))
                          {	
                               Lcd_WriteData_16Bit(fc);
                          }			  
                          else 
                          {
                               Lcd_WriteData_16Bit(bc);
			  }
		     }
		     else //Overlay mode: the font does not have a background color, and is directly superimposed and displayed on the original display content
		     {
			  POINT_COLOR=fc;
			  if(tfont16[k].Msk[i]&(0x80>>j))						
                          {
                               LCD_DrawPoint(x,y);//Draw a point  
			  }
			  x++;
			  if((x-x0)==16)
			  {
			       x=x0;
			       y++;
			       break;
			  }
		     }
	        }
	    }
	 }				  	
	 continue;  //Find the corresponding dot matrix font to exit immediately, to prevent the impact of multiple Chinese characters repeated modulo
    }
    LCD_SetWindows(0,0,lcddev.width-1,lcddev.height-1);//Restore window to full screen
}