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

📄 fontinterface.c

📁 此业功能代码的主要功能是8859系列字库的制作和和相关的字库函数的调用
💻 C
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************

  Copyright (c) 2005 SunMedia technology (Chengdu) co. Ltd.All right reserved! 

 ******************************************************************************
  File Name     : FontInterFace.c
  Version       : Initial Draft
  Author        : qu.huang
  Created       : 2007/9/19
  Last Modified :
  Description   : font interface c file
  Function List :
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/19                    qu.huang                       Created function  

******************************************************************************/
#include "user_init.h"

#ifdef PHILIPS_GUI
/*---------------------------------------------------------------------------*
 *                            INCLUDE   DECLARATIONS                         *
 *---------------------------------------------------------------------------*/
#include "FontInterFace.h"


#ifndef DVDRELEASE
   #define PHILIPS_FONT_DBG
#endif

#ifndef PHILIPS_BROWSER_DBG
#undef printf
#undef print_block
#define printf(f, a...) do {} while (0)
#define print_block(x,y) do {} while (0)
#endif

#define PHILIPS_FONT_8859_ENTRY( a )	stPhilips_ISO8859_##a##_EntryItem
#define ADD_FONT_ISO8859( a )	QSIPDVD_Font_FontAdd( &PHILIPS_FONT_8859_ENTRY(a) )

/*---------------------------------------------------------------------------*
 *                            EXTERNAL   REFERENCES                          *
 *---------------------------------------------------------------------------*/
extern void Philips_Osd_DrawBmpFont( const BYTE pFont[], int xStart, int yStart, 
        unsigned int fwidth, unsigned int fhight, BYTE fontcolor,BYTE BgColor,BYTE number);
extern const FONTENTRYTABLE_S stPhilips_CP1252_EntryItem; 

#ifdef SUPPORT_ISO8859_1
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(1);
#endif
#ifdef SUPPORT_ISO8859_2
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(2);
#endif
#ifdef SUPPORT_ISO8859_3
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(3);
#endif
#ifdef SUPPORT_ISO8859_4
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(4);
#endif
#ifdef SUPPORT_ISO8859_5
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(5);
#endif
#ifdef SUPPORT_ISO8859_6
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(6);
#endif
#ifdef SUPPORT_ISO8859_7
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(7);
#endif
#ifdef SUPPORT_ISO8859_8
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(8);
#endif
#ifdef SUPPORT_ISO8859_9
extern const FONTENTRYTABLE_S PHILIPS_FONT_8859_ENTRY(9);
#endif
/*---------------------------------------------------------------------------*
 *                            MACRO   DECLARATIONS                           *
 *---------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------*
 *                            GLOBAL   VARIABLES                             *
 *---------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------*
 *                          FUNCTION   DECLARATIONS                          *
 *---------------------------------------------------------------------------*/
static FONTENTRYTABLE_S FontEntryTable[PHILIPS_FONT_MAX_NUMS] = {{NULL,NULL,PHILIPS_FONT_NONE},};

static PFONTENTRYTABLE s_pCurUseFont = NULL;


/*****************************************************************************
 Function Name: QSIPDVD_Philips_FontAdd                                        
 Purposes     : 
 Description  : 
 Arguments    : 
       [In]  pFontInfo <  >
       [In]  unsigned char *pBmp <  >
       [In]  FontType  <  >
       [Out] None
 Return Value : 
          None
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/19                    qu.huang                       Created function  
*******************************************************************************/
UINT8 QSIPDVD_Font_FontAdd( const PFONTENTRYTABLE pFontEntry ) 
{
   INT16 uiFontIdx = pFontEntry->uFontCPType;
   
   if( uiFontIdx >=  PHILIPS_FONT_MAX_NUMS || uiFontIdx < PHILIPS_FONT_CP1250 )
   {
      return FALSE;	  
   }

   FontEntryTable[uiFontIdx].pFontInfo = pFontEntry->pFontInfo;
   FontEntryTable[uiFontIdx].pBmp = pFontEntry->pBmp;
   FontEntryTable[uiFontIdx].uFontCPType = pFontEntry->uFontCPType;
   
   return TRUE;
   
}


/*****************************************************************************
 Function Name: QSIPDVD_Font_SetFont                                           
 Purposes     : 
 Description  : 
 Arguments    : 
       [In]  CPType  <  >
       [Out] None
 Return Value : 
          None
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/19                    qu.huang                       Created function  
*******************************************************************************/
UINT8 QSIPDVD_Font_SetFont( const CODEPAGETYPE_E CPType )
{
   int uiFontIdx =  CPType;
   
   if( uiFontIdx >=  PHILIPS_FONT_MAX_NUMS || uiFontIdx < PHILIPS_FONT_CP1250 )
   {
      return FALSE;	  
   }

   if( FontEntryTable[uiFontIdx].pBmp != NULL && FontEntryTable[uiFontIdx].uFontCPType == uiFontIdx )
   {
      s_pCurUseFont = &FontEntryTable[uiFontIdx];
  //    printf("set font to PHILIPS_FONT_CP125%d \n",FontEntryTable[uiFontIdx].uFontCPType);	
      return TRUE;	  
   }
   else
   {
      return FALSE;
   }
   
}

/*****************************************************************************
 Function Name: GetFontType                                                    
 Purposes     : 
 Description  : 
 Arguments    : 
       [Out] None
 Return Value : 
          None
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/19                    qu.huang                       Created function  
*******************************************************************************/
CODEPAGETYPE_E QSIPDVD_Font_GetFontType( void )
{
   if(  s_pCurUseFont == NULL )
   {
     return PHILIPS_FONT_NONE;
   }

   return s_pCurUseFont->uFontCPType;
   
}
/*****************************************************************************
 Function Name: QSIPDVD_Font_GetBmpWidth                                       
 Purposes     : 
 Description  : 
 Arguments    : 
       [In]   <  >
       [Out] None
 Return Value : 
          None
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/19                    qu.huang                       Created function  
*******************************************************************************/
UINT8 QSIPDVD_Font_GetBmpHeight( void )
{
    if(  s_pCurUseFont == NULL )
    {
     //  printf("Get Bmp Height Failed!\n");
       return 0;
    }

     return s_pCurUseFont->pFontInfo->pFntBmpSzTbl[0];

}

/*****************************************************************************
 Function Name: QSIPDVD_Font_GetBmpWidth                                       
 Purposes     : 
 Description  : 
 Arguments    : 
       [In]   <  >
       [Out] None
 Return Value : 
          None
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/20                    qu.huang                       Created function  
*******************************************************************************/
UINT8 QSIPDVD_Font_GetCharBmpWidth( UINT16 uiChar )
{
   UINT8 bfound = 0;
   UINT16 uChar = uiChar;
   UINT32 isegNums = 0;
   UINT32 irgetblsz = 0;
   UINT8 iBmpWd = 0;
   UINT32 i = 0,j = 0; 

   if ( uChar == 0x20 )
   {
       iBmpWd = 4;
       return iBmpWd;
   }
   if (  s_pCurUseFont == NULL )
    {
       printf("Get Bmp Failed!\n");
       return 0;
    }

   irgetblsz = s_pCurUseFont->pFontInfo->uRgeTblNums;
   for ( i = 0; i < irgetblsz; i++ )
   {
     if( ( uChar >= s_pCurUseFont->pFontInfo->pStCdRgeTbl[i].uiCodeSt )&&
	   ( uChar  <= s_pCurUseFont->pFontInfo->pStCdRgeTbl[i].uiCodeEnd )	
	)
     {
       bfound = 1;
       break;
     }

   }
 
   if ( bfound )
   {
     while ( j < i )
     {
       isegNums += s_pCurUseFont->pFontInfo->pStCdRgeTbl[j].uiSegSize;
       j++;
	   
     }
     isegNums += ( uChar-s_pCurUseFont->pFontInfo->pStCdRgeTbl[i].uiCodeSt +1 ); //the index in uFntbmpTbleSz.
     iBmpWd = s_pCurUseFont->pFontInfo->pFntBmpSzTbl[isegNums]; //get the bmp width from pFntBmpSzTbl.
     return iBmpWd;	 
	 
   }
   else 
   {
      return 0;
   }
	
}
/*
UINT8 QSIPDVD_Font_GetCharBmpWidth( UINT16 uiChar )
{
   UINT8 bfound = 0;
   UINT16 uChar = uiChar;
   UINT32 isegNums = 0;
   UINT32 irgetblsz = 0;
   UINT8 iBmpWd = 0;
   UINT32 i = 0,j = 0; 

   if ( uChar == 0x20 )
   {
       iBmpWd = 4;
       return iBmpWd;
   }
   if (  s_pCurUseFont == NULL )
    {
       printf("Get Bmp Failed!\n");
       return 0;
    }

   irgetblsz = s_pCurUseFont->pFontInfo->uRgeTblNums;
   for ( i = 0; i < irgetblsz; i++ )
   {
     if( ( uChar >= s_pCurUseFont->pFontInfo->pStCdRgeTbl[i].uiCodeSt )&&
	   ( uChar  <= s_pCurUseFont->pFontInfo->pStCdRgeTbl[i].uiCodeEnd )	
	)
     {
       bfound = 1;
       break;
     }

   }
 
   if ( bfound )
   {
     while ( j < i )
     {
       isegNums += s_pCurUseFont->pFontInfo->pStCdRgeTbl[j].uiSegSize;
       j++;
	   
     }
     isegNums += ( uChar-s_pCurUseFont->pFontInfo->pStCdRgeTbl[i].uiCodeSt +1 ); //the index in uFntbmpTbleSz.
     iBmpWd = s_pCurUseFont->pFontInfo->pFntBmpSzTbl[isegNums]; //get the bmp width from pFntBmpSzTbl.
     return iBmpWd;	 
	 
   }
   else 
   {
      return 0;
   }
	
}
*/
/*****************************************************************************
 Function Name: QSIPDVD_Font_GetStringWidth                                    
 Purposes     : 
 Description  : 
 Arguments    : 
       [In]  BYTE *pCode <  >
       [Out] None
 Return Value : 
          None
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/20                    qu.huang                       Created function  
*******************************************************************************/
UINT32 QSIPDVD_Font_GetStringWidth( const BYTE *pCode )
{
       UINT32  uiTotalWidth = 0;
       const BYTE *p = pCode;
       UINT8 uiWidth = 0;
  
      while( *p )
      {	   
          uiWidth = QSIPDVD_Font_GetCharBmpWidth( *p );
	   uiTotalWidth += uiWidth ;
	   p++ ;	  		            
      }
	  
     return ( uiTotalWidth );

}
/*****************************************************************************
 Function Name: QSIPDVD_Font_GetBmpHeight                                      
 Purposes     : 
 Description  : 
 Arguments    : 
       [In]   <  > the char wanna search.
       [Out] :font bmp array 's address.
 Return Value : 
          the font bmp's width
 See also :
          None
 
 History Information Description                                               
 Date                         Author                         Modification      
 2007/9/19                    qu.huang                       Created function  
*******************************************************************************/
UINT8 QSIPDVD_Font_GetBmpInfo( const UINT16 uChar, const BYTE **pBmp,UINT16 *pBmpBytes )
{
    UINT32 i = 0,j = 0;;
    UINT16  irgetblsz = s_pCurUseFont->pFontInfo->uRgeTblNums;
    UINT32 isegNums = 0;	
    UINT8  iBmpWd = 0;
    UINT8 iBmpHgt = s_pCurUseFont->pFontInfo->pFntBmpSzTbl[0];	
    UINT8 bfound = 0;	
    UINT32 ibmpbites = 0;	
    UINT32 ibmpbytes = 0;
    UINT32 ibmpByteIdx = 0;	
	
    if (  s_pCurUseFont == NULL )
    {
       printf("Get Bmp Failed!\n");
       return 0;

⌨️ 快捷键说明

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