📄 fontinterface.c
字号:
}
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]+7)/8*8; //get the bmp width from pFntBmpSzTbl.
printf("uChar = %4x\n",uChar );
printf("idx = %d in range table,iBmp Wd = 0x%0x\n",isegNums, iBmpWd );
if( isegNums < s_pCurUseFont->pFontInfo->uFntbmpTbleSz )
{
ibmpbites = ((s_pCurUseFont->pFontInfo->pFntBmpSzTbl[isegNums]+7)/8*8)*iBmpHgt;
ibmpbytes = ibmpbites /8 ;
if ( ibmpbites %8 != 0 )
{
ibmpbytes += 1;
}
*pBmpBytes = ibmpbytes; // the last byte nums is the font bmp's nums.
printf("the bmp bytes:%d in bmp byte table \n",ibmpbytes);
j = 1;
while ( j < isegNums ) //calc the Index in bmp byte array,we can use Index talbe reduce the calc.
{
ibmpbites = ((s_pCurUseFont->pFontInfo->pFntBmpSzTbl[j]+7)/8*8)*iBmpHgt;
ibmpbytes = ibmpbites /8 ;
if ( ibmpbites %8 != 0 )
{
ibmpbytes += 1;
}
ibmpByteIdx += ibmpbytes;
j++;
}
printf("the bmp ByteIdx = %d in bmp byte table \n",ibmpByteIdx);
*pBmp = &s_pCurUseFont->pBmp[ibmpByteIdx];
return iBmpWd; //return the bmp data bit width.
}
}
return 0; //means:not in the range
}
/*
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;
}
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.
// printf("idx = %d in range table,iBmp Wd = 0x%0x\n",isegNums, iBmpWd );
if( isegNums < s_pCurUseFont->pFontInfo->uFntbmpTbleSz )
{
ibmpbites = s_pCurUseFont->pFontInfo->pFntBmpSzTbl[isegNums]*iBmpHgt;
ibmpbytes = ibmpbites /8 ;
if ( ibmpbites %8 != 0 )
{
ibmpbytes += 1;
}
*pBmpBytes = ibmpbytes; // the last byte nums is the font bmp's nums.
// printf("the bmp bytes:%d in bmp byte table \n",ibmpbytes);
j = 1;
while ( j < isegNums ) //calc the Index in bmp byte array,we can use Index talbe reduce the calc.
{
ibmpbites = s_pCurUseFont->pFontInfo->pFntBmpSzTbl[j]*iBmpHgt;
ibmpbytes = ibmpbites /8 ;
if ( ibmpbites %8 != 0 )
{
ibmpbytes += 1;
}
ibmpByteIdx += ibmpbytes;
j++;
}
// printf("the bmp ByteIdx = %d in bmp byte table \n",ibmpByteIdx);
*pBmp = &s_pCurUseFont->pBmp[ibmpByteIdx];
return iBmpWd; //return the bmp data bit width.
}
}
return 0; //means:not in the range
}
*/
/*****************************************************************************
Function Name: Philips_OSD_ShowString
Purposes :
Description :
Arguments :
[In] x < >
[In] y < >
[In] char *s < >
[In] fontcolor < >
[In] bgcolor < >
[In] reg < >
[Out] None
Return Value :
None
See also :
None
History Information Description
Date Author Modification
2007/9/20 qu.huang Created function
*******************************************************************************/
UINT32 QSIPDVD_Font_ShowString( int x, int y, const char *s, BYTE fontcolor, BYTE bgcolor,BYTE reg )
{
const BYTE* p = s;
const BYTE * pBmp;
BYTE ucFntH,ucFntW;
BYTE ucDispWidth = 0;
UINT32 uiDispX = x;
UINT32 uiDispY = y;
UINT16 uBmpBytes =0;
if ((s == NULL)||( s_pCurUseFont == NULL ))
{
return 0;
}
ucFntH = QSIPDVD_Font_GetBmpHeight();
if( ucFntH == 0 )
{
printf("get font height failed !\n");
return 0;
}
while( *p )
{
if( *p == 0x20 )
{
uiDispX+= 4;
p++;
}
else
{
ucFntW = QSIPDVD_Font_GetBmpInfo((UINT16 )*p,&pBmp , &uBmpBytes);
ucDispWidth = QSIPDVD_Font_GetCharBmpWidth( (UINT16 )*p );
if ( ucFntW == 0 )
{
printf("char not in the font lib!\n"); // "_".
ucFntW = QSIPDVD_Font_GetBmpInfo(0x5F,&pBmp , &uBmpBytes);
}
Philips_Osd_DrawBmpFont( pBmp, uiDispX, uiDispY, ucFntW, ucFntH, fontcolor,bgcolor, reg );
uiDispX += ucDispWidth;
p++;
}
if( uiDispX > region[reg].osd_visible_w )
{
break;
}
}
osd_tog_region(reg,OSD_ON);
return uiDispX;
}
/*****************************************************************************
Function Name: QSIPDVD_Font_SetSystemFont
Purposes :
Description :
Arguments :
[In] < >
[Out] None
Return Value :
None
See also :
None
History Information Description
Date Author Modification
2007/9/21 qu.huang Created function
*******************************************************************************/
void QSIPDVD_Font_SetSystemFont( void )
{
UINT8 uRet = 0;
//uRet = QSIPDVD_Font_FontAdd( &stPhilips_CP1252_EntryItem);
#ifdef SUPPORT_ISO8859_1
uRet = ADD_FONT_ISO8859( 1 );
#endif
#ifdef SUPPORT_ISO8859_2
uRet = ADD_FONT_ISO8859( 2 );
#endif
#ifdef SUPPORT_ISO8859_3
uRet = ADD_FONT_ISO8859( 3 );
#endif
#ifdef SUPPORT_ISO8859_4
uRet = ADD_FONT_ISO8859( 4 );
#endif
#ifdef SUPPORT_ISO8859_5
uRet = ADD_FONT_ISO8859( 5 );
#endif
#ifdef SUPPORT_ISO8859_6
uRet = ADD_FONT_ISO8859( 6 );
#endif
#ifdef SUPPORT_ISO8859_7
uRet = ADD_FONT_ISO8859( 7 );
#endif
#ifdef SUPPORT_ISO8859_8
uRet = ADD_FONT_ISO8859( 8 );
#endif
#ifdef SUPPORT_ISO8859_9
uRet = ADD_FONT_ISO8859( 9 );
#endif
if( uRet == FALSE )
{
printf("add font failed!\n");
return;
}
uRet = QSIPDVD_Font_SetFont(PHILIPS_FONT_CP1252);// //PHILIPS_FONT_CP1252
if( uRet == FALSE )
{
printf("Set font failed!\n");
return;
}
}
UINT32 QSIPDVD_Framebuf_ShowString( int x, int y, const char *s, UINT8 pY, UINT16 pCrCb,BYTE buf )
{
const BYTE* p = s;
const BYTE * pBmp;
BYTE ucFntH,ucFntW;
UINT32 uiDispX = x;
UINT32 uiDispY = y;
UINT16 uBmpBytes =0;
if ((s == NULL)||( s_pCurUseFont == NULL ))
{
return 0;
}
ucFntH = QSIPDVD_Font_GetBmpHeight();
if( ucFntH == 0 )
{
printf("get font height failed !\n");
return 0;
}
while( *p )
{
if( *p == 0x20 )
{
uiDispX+= 4;
p++;
}
else
{
ucFntW = QSIPDVD_Font_GetBmpInfo((UINT16 )*p,&pBmp , &uBmpBytes);
if ( ucFntW == 0 )
{
printf("char not in the font lib!\n"); // "_".
ucFntW = QSIPDVD_Font_GetBmpInfo(0x5F,&pBmp , &uBmpBytes);
}
FSGUI_PreDrawBmp(buf,pBmp,uiDispX, uiDispY, ucFntW, ucFntH,pY,pCrCb,0,0);
uiDispX += ucFntW;
p++;
}
}
return uiDispX;
}
#if 0
/*
*test function
*/
void testFontSet( void )
{
UINT8 uRet = 0;
UINT8 ufonthgt = 0;
const BYTE *pBmp;
UINT16 uBmpBytes = 0;
UINT8 bmpwd = 0;
int j = 0;
uRet = QSIPDVD_Font_FontAdd( &stPhilips_CP1252_EntryItem);
if( uRet == FALSE )
{
printf("add font failed!\n");
return;
}
uRet = QSIPDVD_Font_SetFont(PHILIPS_FONT_CP1252);
if( uRet == FALSE )
{
printf("Set font failed!\n");
return;
}
ufonthgt = QSIPDVD_Font_GetBmpHeight();
if( ufonthgt == 0 )
{
printf("get font height failed !\n");
return;
}
else
{
printf("get font height :%d\n",ufonthgt);
}
bmpwd = QSIPDVD_Font_GetBmpInfo(0xFF,&pBmp , &uBmpBytes);
{
if( bmpwd == 0)
{
printf("char not in the range!\n");
}
else
{
while( j < uBmpBytes )
{
printf(" 0x%0x ",pBmp[j]);
if( j % 8 == 0 && j != 0 )
{
printf("\n");
}
j++;
}
}
}
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -