📄 languageutil.c
字号:
#include "user_init.h"
#include "LanguageUtil.h"
#ifdef SUPPORT_FONT_UTIL
#ifndef DVDRELEASE
#include "global.h"
#define FONT_UTIL_DBG 1
#endif
#ifdef FONT_UTIL_DBG
//#define FONT_UTIL_DBG_GENERAL
#endif
#include "memmap.h"
#include "memmap0.h"
#include "func.h"
#include "LanguageUtil.inc"
#ifndef FONT_UTIL_DBG
#undef printf
#undef print_block
#define printf(f, a...) do {} while (0)
#define print_block(x,y) do {} while (0)
#endif
// **************************************************************************************** //
#define MAX_FONT_NUM ( sizeof(g_aFontEntryTable)/sizeof(FontEntryType) )
// **************************************************************************************** //
extern UINT32 GetCharacterBmp( const UINT8* pCode, const UINT8** pBmp )
{
return ftGetCharacterBmp( pCode, pBmp );
}
// **************************************************************************************** //
extern UINT32 GetSupportedFontNum()
{
return MAX_FONT_NUM;
}
// **************************************************************************************** //
extern UINT32 SetCurrentFontByType( ENUM_FONT_TYPE enFontType )
{
UINT32 i = 0;
FontInfo* pFontInfo = NULL;
for( ; i < MAX_FONT_NUM; i++ )
{
pFontInfo = (FontInfo*)g_aFontEntryTable[ i ].pFontInfo;
if( pFontInfo && ( pFontInfo->enType == enFontType ) )
return SetCurrentFont( i );
}
return FALSE;
}
// **************************************************************************************** //
extern UINT32 SetCurrentFont( UINT32 uiFontIdx )
{
if( uiFontIdx >= MAX_FONT_NUM )
return FALSE;
BYTE* pFontData = NULL;
#ifdef FONT_COMPRESSED
if( g_aFontEntryTable[ uiFontIdx ].uiCompressed )
{
const BYTE* pCompressedBmp = g_aFontEntryTable[ uiFontIdx ].pFontData;
if( !pCompressedBmp )
{
#ifdef FONT_UTIL_DBG_GENERAL
printf( "pFontData is NULL\n" )
#endif
return FALSE;
}
pFontData = (BYTE*)( SDRAM_BASE + ( FONT_DECOMPRESS_YA << 10 ) );
int iRes = dsp3_decompress( pCompressedBmp, pFontData );
if( iRes <= 0 || iRes > ( FONT_DECOMPRESS_SIZE << 10 ) )
{
#ifdef FONT_UTIL_DBG_GENERAL
printf( "dsp3_decompress fail or font size too large\n" )
#endif
return FALSE;
}
}
else
#endif
{
pFontData = (BYTE*)g_aFontEntryTable[ uiFontIdx ].pFontData;
}
if( !ftSetCurrentFont( g_aFontEntryTable[ uiFontIdx ].pFontInfo, pFontData ) )
{
#ifdef FONT_UTIL_DBG_GENERAL
printf( "ftSetCurrentFont fail\n" )
#endif
return FALSE;
}
return TRUE;
}
// **************************************************************************************** //
extern UINT32 IsInCharacterSet( const UINT8* pCode )
{
if( !pCode )
return FALSE;
return ftIsInCharacterSet( pCode );
}
// **************************************************************************************** //
extern ENUM_FONT_TYPE GetFontType()
{
return ftGetFontType();
}
// **************************************************************************************** //
#else
extern UINT32 SetCurrentFont( UINT32 uiFontIdx ) { uiFontIdx = uiFontIdx; return FALSE; }
extern UINT32 GetSupportedFontNum() { return 0; }
extern UINT32 IsInCharacterSet( const UINT8* pCode ) { pCode = pCode; return FALSE; }
extern UINT32 GetCharacterBmp( const UINT8* pCode, const UINT8** pBmp ) { pCode = pCode; pBmp = pBmp; return FONT_NOT_IN_RANGE; }
extern ENUM_FONT_TYPE GetFontType() { return FONT_NONE; }
// **************************************************************************************** //
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -