📄 tidtv_fontpool.c
字号:
/*******************************************************************************
* @ModuleName :: TiDTV_FontPool.c
*
* @Copyright :: Copyright 2005- Texas Instruments, Inc.
*
* @Description :: TI DTV Bitmapped Font Data
*
* @History ::
*---------------------------------------
* 04-21-2005 W.Shi Created
*******************************************************************************/
#include "TiDTV_DataType.h"
#include "TiDTV_GLib.h"
extern const UCHAR *pTiDTV_Font1_h20[]; // Small size
extern const UCHAR *pTiDTV_Font1_h24[]; // Defined in "ShincoDTV_Font1.c": Standard size
extern const UCHAR *pTiDTV_Font1_h28[]; // Large size
extern const UCHAR *pTiDTV_Font2_h20[]; // Small size
extern const UCHAR *pTiDTV_Font2_h24[]; // Defined in "ShincoDTV_Font2.c": Standard size
extern const UCHAR *pTiDTV_Font2_h28[]; // Large size
extern const UCHAR *pTiDTV_Font3_h20[]; // Small size
extern const UCHAR *pTiDTV_Font3_h24[]; // Defined in "ShincoDTV_Font3.c": Standard size
extern const UCHAR *pTiDTV_Font3_h28[]; // Large size
extern const UCHAR *pTiDTV_Font4_h20[]; // Small size
extern const UCHAR *pTiDTV_Font4_h24[]; // Defined in "ShincoDTV_Font4.c": Standard size
extern const UCHAR *pTiDTV_Font4_h28[]; // Large size
extern const UCHAR *pTiDTV_Font5_h20[]; // Small size
extern const UCHAR *pTiDTV_Font5_h24[]; // Defined in "ShincoDTV_Font5.c": Standard size
extern const UCHAR *pTiDTV_Font5_h28[]; // Large size
extern const UCHAR *pTiDTV_Font6_h20[]; // Small size
extern const UCHAR *pTiDTV_Font6_h24[]; // Defined in "ShincoDTV_Font6.c": Standard size
extern const UCHAR *pTiDTV_Font6_h28[]; // Large size
extern const UCHAR *pTiDTV_Font7_h20[]; // Small size
extern const UCHAR *pTiDTV_Font7_h24[]; // Defined in "ShincoDTV_Font7.c": Standard size
extern const UCHAR *pTiDTV_Font7_h28[]; // Large size
const UCHAR **pTiDTV_Eia708Font[] = {
pTiDTV_Font4_h20, // Small size
pTiDTV_Font4_h24, // Standard size
pTiDTV_Font4_h28, // Large size
pTiDTV_Font1_h20, // Small size
pTiDTV_Font1_h24, // Standard size
pTiDTV_Font1_h28, // Large size
pTiDTV_Font2_h20, // Small size
pTiDTV_Font2_h24, // Standard size
pTiDTV_Font2_h28, // Large size
pTiDTV_Font3_h24, // Standard size
pTiDTV_Font3_h20, // Small size
pTiDTV_Font3_h28, // Large size
pTiDTV_Font4_h20, // Small size
pTiDTV_Font4_h24, // Standard size
pTiDTV_Font4_h28, // Large size
pTiDTV_Font5_h20, // Small size
pTiDTV_Font5_h24, // Standard size
pTiDTV_Font5_h28, // Large size
pTiDTV_Font6_h20, // Small size
pTiDTV_Font6_h24, // Standard size
pTiDTV_Font6_h28, // Large size
pTiDTV_Font7_h20, // Small size
pTiDTV_Font7_h24, // Standard size
pTiDTV_Font7_h28, // Large size
};
const UCHAR TiDTV_FontCellSize[][2] = {
{20 + 2, 20 + 4},
{24 + 2, 24 + 4},
{28 + 2, 28 + 4},
};
/*******************************************************************************
* @RoutineName:: TiDTV_OsdGetCharPattern
*
* @Description:: Get the bitmap pattern of the Character:
* called by void TiDTV_OsdDrawChar()
* (can be used for both Bitmapped font and True Type Font)
*
* @Input ::
* USHORT CharCode : Character code
* pOsdWindow->Attrib : character attributes
*
* @Output ::
* pOsdWindow->CurCharPattern.CellWidth : Cell width
* pOsdWindow->CurCharPattern.CellHeight : Cell Height
* pOsdWindow->CurCharPattern.DeltaX : X-Offset for drawing the character
* pOsdWindow->CurCharPattern.DeltaY : Y-Offset for drawing the character
* pOsdWindow->CurCharPattern.Width : Character pixel Width
* pOsdWindow->CurCharPattern.Height : Character pixel Height
* pOsdWindow->CurCharPattern.pBitmap : the pointer to Bitmap data: 1-bpp
*
* @Return :: none
*******************************************************************************/
void TiDTV_OsdGetCharPattern(USHORT CharCode, TI_DTV_OSD_WINDOW *pOsdWindow)
{
USHORT Font = CharCode & TI_DTV_CHAR_SET_MASK;
TI_DTV_G_CHAR *pCharPattern = &pOsdWindow->CurCharPattern;
UCHAR *pFontSize = (UCHAR *) &(TiDTV_FontCellSize[pOsdWindow->CurCharAttrib.Bits.FontSize][0]);
UCHAR *pCharBitMap;
// Cell size for a character/space: default
if (pCharPattern->CellWidth == 0)
pCharPattern->CellWidth = *pFontSize;
if (pCharPattern->CellHeight == 0)
pCharPattern->CellHeight = *(pFontSize + 1);
// Init the pointer to the Bitmap data: 1-bpp
pCharPattern->pBitmap = (UCHAR *) 0;
switch (Font) {
case TI_DTV_CHAR_SET_EIA708B: // EIA-708-B Characters set: Latin Characters
Font = (CharCode & 0x0E00) >> 9; // Font code
CharCode &= 0x01ff; // clear the Font Code, and get the real Character Code
if (CharCode != 0) {
Font = Font * 3 + pOsdWindow->CurCharAttrib.Bits.FontSize;
// pointer to the Bitmap data: 1-bpp
pCharBitMap = (UCHAR *) (long) (pTiDTV_Eia708Font[Font][CharCode - 1]);
// Character pixel size: Width x Height
pCharPattern->Width = *pCharBitMap++;
pCharPattern->Height = *pCharBitMap++;
pCharPattern->pBitmap = pCharBitMap;
// Cell size for a character/space
if (pOsdWindow->CurCharAttrib.Bits.AutoCellSize) {
// Automatic Adjust Cell Size
pCharPattern->CellWidth = (pCharPattern->Width & 0x7f) + 2;
pCharPattern->CellHeight = (pCharPattern->Height & 0x7f) + 4;
// Offset of X/Y position for drawing the character
pCharPattern->DeltaX = pCharPattern->DeltaY = 0;
}
}
break;
case TI_DTV_CHAR_SET_CHINESE: // Chinese Characters set
break;
case TI_DTV_CHAR_SET_JAPANESE: // Japanese Characters set
break;
default: // invalid code: ignore
break; // should never get here !
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -