⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osd_show_font.c

📁 Sunplus 8202S source code.
💻 C
📖 第 1 页 / 共 2 页
字号:
		BYTE    c1;
		int     iRes = 0;
        
		//  which character
		c = *p;
		c1 = *(p + 1);

#if defined(USE_KOREAN_FONT)
        if(((c >= 0x81) && (c <= 0xFE)) && ((c1 >= 0x41 && c1 <= 0x5A) || (c1 >= 0x61 && c1 <= 0x7A)|| (c1 >= 0x81 && c1 <= 0xFE))) 
        {
            //KSC code
			iRes = 5;
        }
        else  
#endif
            
#if defined(USE_JAPANESE_FONT)
        if (((c >= 0x81 && c <= 0x9F)||(c >= 0xE0 && c <= 0xFC)) && ((c1 >= 0x40) && (c1 <= 0xFC)))  //JIS code           
        {
            iRes = 4;
        }
        else  
#endif		

#if defined(USE_GB2312_FONT)||defined(USE_RUSSIAN_LANGUAGE)
		if (((c >= 0xA1) && (c <= 0xF8)) && ((c1 >= 0xA1) && (c1 < 0xFF))) // GB code            
		 {			
			iRes = 3;
		 }
		 else  
#endif

#if defined( USE_BIG5_FONT ) || defined( USE_BIG5_COMMON_FONT )
		if(((c >= 0xA1) && (c <= 0xF9)) && ((c1 >= 0x40 && c1 <= 0x7E) || (c1 >= 0xA1 && c1 <= 0xFE))) // Big5 code
		{			
			iRes = 2;
		}
		else 
#endif

#if defined(EUROPE_FOREIGN_LANGUAGES) || defined(MIDDLE_EUROPE_LANGUAGES) || defined (SUPPORT_TURKISH_LANGUAGES)
		if ((c >= 32) && (c <= 255)) // ISO 8859-1 code
		{	
			iRes = 1;
		}
#else
		if ((c >= 32) && (c <= 126)) // ASC code( before 127)
		{
			iRes = 1;
		}
#endif
		else //other
		{
			iRes = 0;
			c = '_';
		}

		if ((iRes == 0) || (iRes == 1))
		{
            p++;	    
   
#if !defined(EUROPE_FOREIGN_LANGUAGES) && !defined(MIDDLE_EUROPE_LANGUAGES) && !defined (SUPPORT_TURKISH_LANGUAGES)
            i += 9;
    #if defined(SUPPORT_CHINESE_FONT)||defined(USE_RUSSIAN_LANGUAGE)||defined(USE_JAPANESE_FONT)||defined(USE_KOREAN_FONT)// Clead
			if ((c == '!') || (c == '"') || (c == '#') || (c == '$') ||
				(c == '&') || (c == '\'') || (c == '(') || (c == ')') ||
				(c == ',') || (c == ';') || (c == '=') || (c == '^'))
        #if defined(USE_GB2312_FONT)||defined(USE_RUSSIAN_LANGUAGE)
			{
				c1 = 0x03 + 0xa0;
				c = c + 0x80;
				OSD_GBShowChar((x+i), y, c1, c, fontcolor, r);
			}
			else
        #elif defined( USE_BIG5_FONT ) || defined( USE_BIG5_COMMON_FONT )
			{
				if(c < 114)
				{
					c1 = 0xa2;
					c = c + 0x8e;
				}
				else
				{
					c1 = 0xa3;
					c = c - 113 + 0x40;
				}
				OSD_Big5ShowChar((x+i), y, c1, c, fontcolor, r);
			}
			else
	    #elif defined(USE_JAPANESE_FONT)
            {
                if (c == '!') c =0x49; 
                else if (c == '#') c =0x94;
                else if (c == '$') c =0x90;
                else if (c == '(') c =0x69;
                else if (c == ')') c =0x6A;
                else if (c == ',') c =0x43;
                else if (c == ';') c =0x47;
                else if (c == '=') c =0x81;
                else if (c == '^') c =0xC8;
                else if (c == '&') c =0x95;
                
                c1 = 0x81;
                
                OSD_JISShowChar((x+i), y, c1,c, fontcolor, r);
            }
            else
        #elif defined(USE_KOREAN_FONT)
            {
                if (c == '!') c =0x49; 
                else if (c == '#') c =0x94;
                else if (c == '$') c =0x90;
                else if (c == '(') c =0x69;
                else if (c == ')') c =0x6A;
                else if (c == ',') c =0x43;
                else if (c == ';') c =0x47;
                else if (c == '=') c =0x81;
                else if (c == '^') c =0xC8;
                else if (c == '&') c =0x95;
                
                c1 = 0x81;
                
                OSD_KSCShowChar((x+i), y, c1,c, fontcolor, r);
            }
            else
        #endif
    
    #endif
				OSD_ShowChar((x+i), y, c, fontcolor, r);
    
#else//#ifndef EUROPE_FOREIGN_LANGUAGES
        i += 6;
    		OSD_ISOShowChar((x+i), y, c, fontcolor, r);
    
#endif//#ifndef EUROPE_FOREIGN_LANGUAGES
    
		}

#if defined( USE_BIG5_FONT ) || defined( USE_BIG5_COMMON_FONT )
		else if(iRes == 2)  //BIG5 code
		{
			OSD_Big5ShowChar( (x+i), y, c, c1, fontcolor, r);
			i += 14;
			p += 2;
		}
#endif

#if  defined(USE_GB2312_FONT)||defined(USE_RUSSIAN_LANGUAGE)
		else if (iRes == 3) //GB code
		{
			OSD_GBShowChar((x+i), y, c, c1, fontcolor, r);
			i += 14;
			p += 2;
		} 
#endif

#ifdef USE_JAPANESE_FONT
		else if(iRes == 4)  //JIS code
		{
			OSD_JISShowChar( (x+i), y, c, c1, fontcolor, r);
			i += 14;
			p += 2;
		}
#endif

#ifdef USE_KOREAN_FONT
		else if(iRes == 5)  //KSC code
		{
			OSD_KSCShowChar( (x+i), y, c, c1, fontcolor, r);
			i += 14;
			p += 2;
		}
#endif
        // for limiting the length of OSD_ShowString
        // the following number 14 is for limiting display half of chinese font
		if (i > (region[r].osd_w-x-14)) 
			break; 
	}
}

#ifdef SUPPORT_OSDSRT
/*
 *Function:display text to osd,display max line:7,display max chinese font in a line:19
 *Parameter:*p:input string
 *           Size:length of string
 *Return:none      
 *Creator:suqiaoli
 *Date:2004-3-17
 *Date:2004/09/10 yltseng modify
*/
void ShowOSDText(const char *p,  UINT16 size)
{
    // 2004/09/03 yltseng
    #define MAX_WORD    50
#ifdef SDRAM_16Mb_Mode
    #define MAX_LINE    2
#else
	#define MAX_LINE	7
#endif
	
	BYTE*pStr = (BYTE *)p;
	BYTE c,c1;
	
	BYTE *old_pStr;
	int old_i_len;
	
	int  show_line = -1;
	int  show_word = 0;
	UINT16  nsize=0;
	int  i_len;
	int xstart,ystart;
	int len[MAX_LINE];
	int i;
	int count;//ASCII count in a line

	int    width;
	int    height;

	width=(int) region[3].osd_w;
	height=(int) region[3].osd_h/MAX_LINE;  // 2004/09/03 yltseng
	
	//All char will be put into this str array
	//if string long,it will newline
	BYTE str[MAX_LINE][MAX_WORD];

	osd_tog_region(3,OSD_ON);
	
	//Read and parse each char,display them on osd
	//include function:display more lines,newline,
	//when string length>276,it will newline
	while(nsize<size)
	{
		show_word = 0;
		i_len = 0;
		count = 0;
		show_line++;
        if( show_line > MAX_LINE - 1 )//most displayed line is 7 line
        {
            show_line = MAX_LINE - 1;
            break;
        }

		//read string to string buffer,except "return","next line"
		while(((*pStr) != '\r')&& ((*pStr)!='\n') ) 
		{	
			c = *pStr;
			c1 = *(pStr + 1);

//Double ASCII code			
#if defined(USE_GB2312_FONT) || defined(USE_RUSSIAN_LANGUAGE)||defined(USE_BIG5_FONT)||defined(USE_BIG5_COMMON_FONT)||defined(USE_JAPANESE_FONT)||defined(USE_KOREAN_FONT)
			
    #if defined(USE_GB2312_FONT) || defined(USE_RUSSIAN_LANGUAGE)			
			if (((c >= 0xA1) && (c <= 0xF8)) && ((c1 >= 0xA1) && (c1 < 0xFF))) 	//gb2312		

    #elif defined(USE_BIG5_FONT) || defined( USE_BIG5_COMMON_FONT )
			if(((c >= 0xA1) && (c <= 0xF9)) && ((c1 >= 0x40 && c1 <= 0x7E) || (c1 >= 0xA1 && c1 <= 0xFE))) // big5 

    #elif defined(USE_JAPANESE_FONT)
            if (((c >= 0x81 && c <= 0x9F)||(c >= 0xE0 && c <= 0xFC)) && ((c1 >= 0x40) && (c1 <= 0xFC)))             

    #elif defined(USE_KOREAN_FONT)
            if(((c >= 0x81) && (c <= 0xFE)) && ((c1 >= 0x41 && c1 <= 0x5A) || (c1 >= 0x61 && c1 <= 0x7A)|| (c1 >= 0x81 && c1 <= 0xFE)))                 

    #endif			
			{
				str[show_line][show_word]=c;
				str[show_line][show_word+1]=c1;
				show_word+= 2;
				i_len+= 14;
				nsize+= 2;
				pStr += 2;
				if((((i_len-count*9)%2==0)&&(i_len>275))||(((i_len-count*9)%2==0)&&(i_len>276)))
					break;
			}
			else
#endif

//Single ASCII code
#if defined(EUROPE_FOREIGN_LANGUAGES) || defined(MIDDLE_EUROPE_LANGUAGES) || defined (SUPPORT_TURKISH_LANGUAGES)
			if (((c >= 32) && (c <= 126)) ||((c >= 160) && (c <= 255)))// ISO 8859-1 code
#else
            if ((c >= 32) && (c <= 126))
#endif
			{
				old_pStr = pStr;
			    old_i_len = i_len;
				str[show_line][show_word]=c;
				show_word += 1;
				i_len += FONT_LEN;//len
				nsize += 1;
				pStr += 1;
				
				if(c == 32) //not to cut off a long word,according to space's position
				{
    			    do
    			    {
    			        old_pStr ++;
    			        old_i_len += FONT_LEN;//len
    			        if((*old_pStr == 32)|| (*old_pStr == '\r')||(old_i_len > 276))
    			            break;
    		    
    			    }while(1);
			    
    			    if (old_i_len > 276)
    			        break;
				}
				else
				{
				    count++;
				    if (i_len>276)
					    break;	
			    }
			}				

//other code
			else
			{
				c = '_';
				str[show_line][show_word]=c;
				show_word+= 1;
				nsize+= 1;
				i_len+= 9;
				pStr += 1;
				count++;
				if (i_len>276)
					break;
			}
				
		}//while(((*pStr) != '\r')&& ((*pStr)!='\n') )
		
		if(((*pStr) == '\r')||((*pStr) == '\n'))//count nsize,'\r':when "return",'\n':next line is blank
		{
			pStr++;
			nsize++;
		}

		len[show_line]=i_len;
		
		str[show_line][show_word]='\0';
		
		if( show_word <= 0 )//if blank line,string line will skip
			show_line--;		
	}//while(nsize<size)

    for(i=show_line;i>=0;i--)//display each line srt title
    {
        xstart=(width-len[i])/2;
        ystart=height*(MAX_LINE-(show_line-i)-1);
        OSD_ShowString(xstart,ystart,str[i],2,3);
    }
}

#endif //#ifdef SUPPORT_OSDSRT

#endif//#ifdef OSD_FONT_API

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -