📄 msapi_font.h
字号:
#ifndef _MSAPI_FONT_H
#define _MSAPI_FONT_H
#include "DataType.h"
#ifdef MSAPI_FONT_C
#define INTERFACE
#else
#define INTERFACE extern
#endif
// Tags to identify a valid font header
#define FONT_HEADER_TAG 0x466f4E74
// Font compression method
#define FONT_COMPRESSION_NONE 0x00
#define FONT_COMPRESSION_BOUND_RECTANGLE 0x01
#define FONT_COMPRESSION_RUN_LENGTH 0x02
//#define FONT_COMPRESSION_HUFFMAN 0x03
/// Font target bits per pixel
typedef enum // for ATSC_TRUNK
{
FONT_TARGET_BPP_NO_CHANGE, ///< Target BPP is the same as source
FONT_TARGET_BPP_I2_VARIANT ///< Target BPP is converted from I2 to 3 I1. Used for blinking text that appears in closed caption.
} EN_FONT_TARGET_BPP;
/// Structure for a font table
typedef struct
{
FONTHANDLE fHandle; ///< Font handle
} FONT;
/// Font bin header
typedef struct {
U32 u32Tag; ///< Default is 0x466f4E74
U32 u32BPP; ///< Bits Per Pixel. I1: 0x01, I2: 0x02, I2 variant: 0x03 (for Saturn)
U32 u32CharNum; ///< Character count
U32 u32Width; ///< Width in pixels of a font
U32 u32Height; ///< Height in pixels of a font
U32 u32Pitch; ///< Font pitch in bytes
U32 u32Compression; ///< 0x00 for none compression, 0x01 for bounding rectangle
// BBox (Bounding Box) describes the smallest rectangle that encloses the shape/outline of each glyph
U32 u32BBoxOffset; ///< Offset of BBox information
U32 u32CodemapOffset; ///< Offset of codemap block data. Each codemap block is a tuple of(start code, end code, start index)
U32 u32CodemapBlockNum; ///< Number of codemap block.
U32 u32CharGlyphBytes; ///< Size of one char glyph including possible paddings for alignment
U32 u32FontGlyphOffset; ///< Offset of glyph data
U32 u32FontGlyphBytes; ///< Length of all the glyph data, depending on u8Compression.
} FONT_BIN_HEADER;
INTERFACE bool msAPI_Font_ReadBinHeader(U16 u16FontBinID, FONT_BIN_HEADER *pFontBinHeader, U32 *pu32BinBaseAddr);
INTERFACE U8 msAPI_Font_GetLineBytes(const FONT_BIN_HEADER *pFontBinHeader);
INTERFACE U16 msAPI_Font_GetCharGlyphBytes(const FONT_BIN_HEADER *pFontBinHeader);
INTERFACE U32 msAPI_Font_GetFontGlyphBytes(const FONT_BIN_HEADER *pFontBinHeader);
#undef INTERFACE
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -