const void* FontLUT[] = {
&sVerdana20,
&sVerdana20_VU,
&sVerdana20_VD
};
void DrawFontChar(uchar cLayer, int x, int y, uchar d, uchar cFont, long color)
{
uchar cYSize, cXSize; // temps for char data
const struct FONT *pFont; // used to store ptr to font
const struct FONT_INTERVALINFO *pIntInfo; // used to store ptr to interval info
const struct FONT_CHARINFO *pCharInfo; // used to store ptr to character data
pFont = FontLUT[cFont]; // get ptr to font from FontLUT
pIntInfo = pFont->pInfo; // get ptr to first interval info
while(d < pIntInfo->cFirst || d > pIntInfo->cLast) { // check interval for character
pIntInfo = pIntInfo->pNextInfo; // get ptr to next interval info
if(pIntInfo == 0) return; // character not available
}
pCharInfo = pIntInfo->pChar+(d-pIntInfo->cFirst); // load ptr to current char - add offset
cXSize = pCharInfo->cXSize; // get X size of the char from charinfo
cYSize = pFont->cYSize; // get Y size of the font from fontinfo
GDC_CMD_TxBM(x, x+cXSize-1, y-cYSize+1, y, color, 0, 0, 0, 0, cLayer); // command for PP
GDC_FIFO_INP((ulong *)pCharInfo->pCharData, pCharInfo->cLongsPerChar); // data of bmp to FIFO
GDC_CMD_NOP();
}
|