微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > mt2503 使用矢量字体时VKV1显示'口'或死机

mt2503 使用矢量字体时VKV1显示'口'或死机

时间:10-02 整理:3721RD 点击:
[DESCRIPTION]
之前设计VKV1时,矢量字的使用并不普遍,因而当时没有考虑到兼容矢量字的情况;引入矢量字后VK也更新到了VKV2,没有对VKV1进行兼容性升级
,因此导致了在11B1308MP之前的软件版本中存在这个遗留问题。
[SOLUTION]
把PixcomFontEngine.c中函数Get_CharBoundingBox替换成如下即可。
void Get_CharBoundingBox(
U32 Ch,
S32 *pCharWidth,
S32 *pCharHeight,
S32 *pBoxXoffset,
S32 *pBoxYoffset,
S32 *pBoxWidth,
S32 *pBoxHeight)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U32 data_attr = 1;
U16 data_height;
U16 data_width;
#if !defined(__MMI_VECTOR_FONT_SUPPORT__)
S32 fx1, fy1, fx2, fy2, x, y;
U8 *font_data;
U32 font_data_size;
S32 char_width;
S32 ascent = 0, descent = 0;
S32 dwidth;
S32 bearing_x;
MMI_BOOL valid;
#endif
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
GDI_LOCK;
FE_LOCK;
#ifdef __MMI_VECTOR_FONT_SUPPORT__
{
mmi_lm_cluster_info cluster = {0}, prev_cluster = {0}, prev2_cluster = {0};
cluster.data_ptr = (U8 *)&Ch;
mmi_lm_get_current_cluster(cluster.data_ptr, cluster.data_ptr, &prev2_cluster, &prev_cluster, &cluster);
data_width = cluster.w;
data_height = cluster.h;
}
#else
{
font_data_size = mmi_fe_get_font_data(
MMI_FALSE,
(U16) Ch,
&font_data,
&data_attr,
&char_width,
&dwidth,
&data_width,
&data_height,
&bearing_x,
&ascent,
&descent,
&valid);
}
#endif
FE_UNLOCK;
GDI_UNLOCK;
#if defined(__MMI_BDF_SW_COMPRESSION__) && !defined(__MMI_VECTOR_FONT_SUPPORT__)
{
int i = 0, j = 0, nIndex = 0;
unsigned __int64 nCurrent = 0, nMask = 0, bU8 = 0;
gdi_layer_struct *handle_layer = NULL;
unsigned __int64 char_buffer[200] = {0};
U8 glyph_buffer[200] = {0};
unsigned char nBitsCopied = 0;
int nSourceBitsCopied = 0;
int nPadding = 0;
gdi_color border_color = 0, text_color = 0;
border_color = gdi_act_color_fROM_rgb(
0xff,
g_mmi_fe_text_border_color.r,
g_mmi_fe_text_border_color.g,
g_mmi_fe_text_border_color.b);
text_color = gdi_act_color_from_rgb(0xff, g_mmi_fe_text_color.r, g_mmi_fe_text_color.g, g_mmi_fe_text_color.b);
gdi_layer_get_active((gdi_handle*) & handle_layer);
bfcDecSetAttribute(g_decoder, BFC_STYLE_NORMAL, text_color, border_color);
bfcDecSetCanvas(g_decoder, (U8*) char_buffer, 100, 8, 100, BFC_RGB_FORMAT_1BPP);
bfcDecSetCLIpWindow(g_decoder, 0, 0, 99, 99);
bfcDecDrawGlyph(g_decoder, (U8*) font_data, char_width, data_height, 0, 0);
if (char_width % 8) /* char_width == font real width */
nPadding = 8 - (char_width % 8);
else
nPadding = 0;
for (i = 0; i < data_height; i++)
{
/*
* Because HW compression will pass the font byte sequence is:
* Left side of glyph pixel is in little endian(low memory), which is reverse with the
* sequence of font engine pass to HW compression.
* So we should reverse the byte sequence, and make them to "Raw data".
*/
U8 width_byte = (char_width / 8) + (char_width % 8 ? 1 : 0);
char *pch = (char *) & char_buffer;
for (j = 0; j < (width_byte / 2); j++)
{
char chr = pch[j];
pch[j] = pch[width_byte - j - 1];
pch[width_byte - j - 1] = chr;
}
nSourceBitsCopied = 0;
nCurrent = char_buffer;
nCurrent = nCurrent >> nPadding;
nCurrent = ReverseBitOrdering(nCurrent, char_width);
nMask = 1;
for (j = 0; j < char_width; ++j)
{
unsigned char nTemp;
// bU8 = (nCurrent)&nMask; /* the bit value, get each bit of width data */
/* glyph_buffer[nIndex]|= (unsigned char)bU8; */
bU8 = (nCurrent) & nMask; /* the bit value, get each bit of width data */
if (bU8 > 0)
{
bU8 = 0x01;
}
else
{
bU8 = 0x00;
}
bU8 = bU8 << nBitsCopied; /* Adjust to filled bit position. */
nTemp = (unsigned char)bU8;
glyph_buffer[nIndex] |= (unsigned char)nTemp;
++nBitsCopied; /* Note the count of current font data byte bit */
++nSourceBitsCopied; /* Note the count of current width bit */
nMask = nMask << 1;
if (nBitsCopied >= 8)
{
++nIndex;
nCurrent = char_buffer;
nCurrent = nCurrent >> nPadding;
nCurrent = ReverseBitOrdering(nCurrent, char_width);
nMask = 1 << nSourceBitsCopied;
nBitsCopied = 0;
}
}
if (nBitsCopied >= 8)
{
++nIndex;
nCurrent = char_buffer;
nCurrent = nCurrent >> nPadding;
nCurrent = ReverseBitOrdering(nCurrent, char_width);
nBitsCopied = 0;
nMask = 1 << nSourceBitsCopied;
}
}
font_data_size = nIndex + 1;
font_data = glyph_buffer;
}
#endif /* __MMI_BDF_SW_COMPRESSION__ */
#if !defined(__MMI_VECTOR_FONT_SUPPORT__)
*pCharWidth = data_width;
*pCharHeight = data_height;
fx1 = data_width - 1; /* min X of drawn area */
fx2 = 0; /* max X of drawn area */
fy1 = data_height - 1; /* min Y of drawn area */
fy2 = 0; /* max Y of drawn area */
x = 0;
y = 0;
#endif
#if defined(__MMI_VECTOR_FONT_SUPPORT__)
if (data_attr)
{
*pBoxXoffset = 0;
*pBoxYoffset = 0;
*pBoxWidth = data_width;
*pBoxHeight = data_height;
return;
}
#endif /* defined(__MMI_VECTOR_FONT_SUPPORT__) */
#if !defined(__MMI_VECTOR_FONT_SUPPORT__)
while (font_data_size--)
{
U8 pattern = *font_data++;
if (!pattern)
{
U32 nTemp;
x += 8;
nTemp = x / data_width;
if (nTemp)
{
y += nTemp;
data_height -= (U16) nTemp;
if (!data_height)
{
break;
}
}
x %= data_width;
}
else
{
S32 i;
for (i = 0; i < 8; i++)
{
if (pattern & 1)
{
if (x < fx1)
{
fx1 = x;
}
if (y < fy1)
{
fy1 = y;
}
if (x > fx2)
{
fx2 = x;
}
if (y > fy2)
{
fy2 = y;
}
}
x++;
if (x == (S32) data_width)
{
y++;
data_height--;
x = 0;
if (!data_height)
{
break;
}
}
pattern >>= 1;
}
}
}
MMI_DBG_ASSERT(fx2 >= fx1 && fy2 >= fy1);
*pBoxXoffset = fx1;
*pBoxYoffset = fy1;
*pBoxWidth = fx2 - fx1 + 1;
*pBoxHeight = fy2 - fy1 + 1;
#endif
}

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

网站地图

Top