mtk 平板项目中由于默认使用的是8*16的点阵字体在显示中看起来明显偏小,因此使用24*48的字体显示比较大。

  需要修改的文件:

  1、 video_font.h

  更换对用宏定义

#define MTK_VFC 256 //characters

#define MTK_VFW 24 //width

#define MTK_VFH 48 //height
#define MTK_VFS (MTK_VFC * MTK_VFH *MTK_VFW/8) //size

以及字库

static unsigned char mtk_vdo_fntdata[MTK_VFS] = {};

  由于字库比较大就不直接粘贴出来,找对用的字库 风格即可,与单片机的使用类似。

  2、修改字体显示函数 mtk_cfb.c

  由于字体显示是相当于一个个点将点阵的数据输出到显示区域,原来的8*16的模式的函数不能正常使用,必须对应的修改,否则有可能不能使用。主要修改下列函数即可,我使用的平台使用的显示格式为CFB_565RGB_16BIT,故只需修改对应的case 即可。

static void cfb_lk_dchars (int xx, int yy, unsigned char *s, int count)
{
unsigned char *pos = NULL;
unsigned char *tdest = NULL;
unsigned char *pdest = NULL;
unsigned char *tdest_temp = NULL;
unsigned char *pdest_temp = NULL;
int row = 0;
int col = 0;
unsigned int data_fmt = 0;
int offs = 0;

pdest = cfb_fb_addrs + yy * LINE_LEN + xx * PIXEL_SIZE;
data_fmt = DATA_FMT;

switch (data_fmt)
{

case CFB_555RGB_15BIT:
while (count--)
{
offs = (*s++) * MTK_VFH;
pos = mtk_vdo_fntdata + offs;
row = MTK_VFH;
for (tdest = pdest;row--;tdest += LINE_LEN)
{
unsigned char bits = *pos++;
((unsigned int *) tdest)[0] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits >> 6] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[1] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits >> 4 & 3] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[2] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits >> 2 & 3] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[3] = SHTSWAP32 ((lk_cfb_font_dtable15 [bits & 3] & cfb_eorx) ^ cfb_bgx);
}
pdest = pdest + MTK_VFW * PIXEL_SIZE;
}
break;
// use case CFB_565RGB_16BIT
case CFB_565RGB_16BIT:
while (count--)
{
offs = (*s++) * MTK_VFH * MTK_VFW /8;
pos = mtk_vdo_fntdata + offs;
row = MTK_VFH;
col = 3;
pdest_temp = pos;
int num= 0;// num++
for (int i = 0 ,tdest = pdest;row--;tdest += LINE_LEN)
{

for(int j = 0,tdest_temp = tdest;j != col;tdest_temp +=16){
unsigned char bits_tmp = *(pdest_temp + num);
((unsigned int *) tdest_temp)[0] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp >> 6] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest_temp)[1] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp >> 4 & 3] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest_temp)[2] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp >> 2 & 3] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest_temp)[3] = SHTSWAP32 ((lk_cfb_font_dtable16 [bits_tmp & 3] & cfb_eorx) ^ cfb_bgx);
num++;
j++;
}
i++;
}
pdest = pdest + MTK_VFW * PIXEL_SIZE;
}
break;
case CFB_332RGB_8BIT:
case CFB_FMT_8BIT:
while (count--)
{
offs = (*s++) * MTK_VFH;
pos = mtk_vdo_fntdata + offs;
row = MTK_VFH;
for (tdest = pdest;row--;tdest += LINE_LEN)
{
unsigned char bits = *pos++;
((unsigned int *) tdest)[0] = (lk_cfb_font_dtable8[bits >> 4] & cfb_eorx) ^ cfb_bgx;
((unsigned int *) tdest)[1] = (lk_cfb_font_dtable8[bits & 15] & cfb_eorx) ^ cfb_bgx;
}
pdest = pdest + MTK_VFW * PIXEL_SIZE;
}
break;

case CFB_888RGB_24BIT:
while (count--)
{
offs = (*s++) * MTK_VFH;
pos = mtk_vdo_fntdata + offs;
row = MTK_VFH;
for (tdest = pdest;row--;tdest += LINE_LEN)
{
unsigned char bits = *pos++;

((unsigned int *) tdest)[0] = (lk_cfb_font_dtb24[bits >> 4][0] & cfb_eorx) ^ cfb_bgx;
((unsigned int *) tdest)[1] = (lk_cfb_font_dtb24[bits >> 4][1] & cfb_eorx) ^ cfb_bgx;
((unsigned int *) tdest)[2] = (lk_cfb_font_dtb24[bits >> 4][2] & cfb_eorx) ^ cfb_bgx;
((unsigned int *) tdest)[3] = (lk_cfb_font_dtb24[bits & 15][0] & cfb_eorx) ^ cfb_bgx;
((unsigned int *) tdest)[4] = (lk_cfb_font_dtb24[bits & 15][1] & cfb_eorx) ^ cfb_bgx;
((unsigned int *) tdest)[5] = (lk_cfb_font_dtb24[bits & 15][2] & cfb_eorx) ^ cfb_bgx;
}
pdest = pdest + MTK_VFW * PIXEL_SIZE;
}
break;

case CFB_X888RGB_32BIT:
while (count--)
{
offs = (*s++) * MTK_VFH;
pos = mtk_vdo_fntdata + offs;
row = MTK_VFH;
for (tdest = pdest;row--;tdest += LINE_LEN)
{
unsigned char bits = *pos++;

((unsigned int *) tdest)[0] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][0] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[1] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][1] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[2] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][2] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[3] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits >> 4][3] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[4] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][0] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[5] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][1] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[6] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][2] & cfb_eorx) ^ cfb_bgx);
((unsigned int *) tdest)[7] = 0xff000000|SWAP32 ((lk_cfb_font_dtable32 [bits & 15][3] & cfb_eorx) ^ cfb_bgx);
}
pdest = pdest + MTK_VFW * PIXEL_SIZE;
}
break;

default:
break;
}

}