微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > mt2503 字库中缺少某一特殊字符,如何添加

mt2503 字库中缺少某一特殊字符,如何添加

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]
字库中缺少某一特殊字符,如何添加
[SOLUTION]
可尝试两种方法:
1.生成一个新的字库,该字库中只包括缺少的那个字符,创建完成后,在查找mtk私有字库之前查找该字库。(可仿照函数MMI_fe_get_font_data_internal中index=mmi_fe_search_in_prop_font(ch,&nbase,&gMTKProprietaryFontFamily,&estraFontPtr);来做,其中
gMTKProprietaryFontFamily为mtk私有字库)
2.把该字符加到另外的一个字库中(有BDF文件,且字符大小相同),如英文字库
如下采用的是第一种方法,即重新创建一个新的字库,步骤如下:
1)用MCT工具生成该字符的BDF文件,把fontres.c中的代码复制到pixcomfontengine.c中(如下为mtk内部测试的字库,不可直接复制)
#if1
constRangeDatachar1_RangeData[1]={
{49,49},};
constRangeDetailschar1_RangeInfo={
1,
char1_RangeData
};
sCustFontDataalpha_small={
48,19,
#ifdefPLUTO_MMI
48,0,
#endif
0,114,500,
(U8*)char1_Width,(U8*)char1_Width,(U32*)char1_Offset,(U8*)char1_Data,(U32*)char1_RangeOffset,
{
{FONTATTRIB_NORMAL|FONTATTRIB_BOLD|FONTATTRIB_ITALIC|FONTATTRIB_OBLIQUE|FONTATTRIB_UNDERLINE|FONTATTRIB_STRIKETHROUGH,FONTATTRIB_N
ORMAL|FONTATTRIB_BOLD|FONTATTRIB_ITALIC|FONTATTRIB_OBLIQUE|FONTATTRIB_UNDERLINE|FONTATTRIB_STRIKETHROUGH},
{0,0},
{0,0},
{0,0},
{0,0}},
&char1_RangeInfo};
sCustFontDataalpha_medium={
48,19,
#ifdefPLUTO_MMI
48,0,
#endif
0,114,500,
(U8*)char1_Width,(U8*)char1_Width,(U32*)char1_Offset,(U8*)char1_Data,(U32*)char1_RangeOffset,
{
{0,0},
{FONTATTRIB_NORMAL|FONTATTRIB_BOLD|FONTATTRIB_ITALIC|FONTATTRIB_OBLIQUE|FONTATTRIB_UNDERLINE|FONTATTRIB_STRIKETHROUGH,FONTATTRIB_N
ORMAL|FONTATTRIB_BOLD|FONTATTRIB_ITALIC|FONTATTRIB_OBLIQUE|FONTATTRIB_UNDERLINE|FONTATTRIB_STRIKETHROUGH},
{0,0},
{0,0},
{0,0}},
&char1_RangeInfo};
sFontFamilyenglish_another={2,{&alpha_small,&alpha_medium,NULL,NULL,NULL}};
#endif1
把相应的.h文件放到目录\plutommi\mmi\Miscphp?mod=tag&id=6090" target="_blank" class="relatedlink">Framework\MiscFrameworkInc下,同时把该.h文件include到该.c文件中。

2)修改函数mmi_fe_get_font_data,在找不到字的情况下,即index==-1时:
index=mmi_fe_search_in_prop_font(Ch,&nBase,&english_another,&extraFontPtr);
nIndexInList=index+(Ch-nBase);
charHashTable[nHashKey].Width=*pnWidth=extraFontPtr->pWidthArray[nIndexInList];
charHashTable[nHashKey].DWidth=*advance_x=extraFontPtr->pWidthArray[nIndexInList];
charHashTable[nHashKey].NumChar=NumChar=
(extraFontPtr->pOffsetArray[nIndexInList+1]-extraFontPtr->pOffsetArray[nIndexInList]);
charHashTable[nHashKey].CharData=*ppCharData=
(extraFontPtr->pDataArray+extraFontPtr->pOffsetArray[nIndexInList]);
直接用到了私有字库的查找函数:mmi_fe_search_in_prop_font(若工程中没有该函数,可用函数SearchInPropFont),只是字库换成了我们自己定义
的&english_another,注意要打开宏__MMI_FONT_MULTIPLE_PROPRIETARY_SUPPORT__

666666

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top