static S32 ShowLimitLineText(S32 x1, S32 y1, S32 width, color c,
UI_string_type strBuffer, BOOL is_underline)
{
UI_string_type chrPtr = strBuffer;
U32 chrW = 0;
U32 chrH = 0;
S32 lineTextW, lineTextH;
U8 lineNum = 1;
U32 x = x1;
U8 lineTextC = 0;
U8 i=0;
UI_font_type f = NPR_Pub_Getfont();
U16 printedTextC = 0, totalC = mmi_ucs2strlen((CHAR *)strBuffer);
if(is_underline)
f->underline = 1;
gui_set_font(f);
chrW = NPR_SM_CHINESE_CHARACTER_W;
chrH = NPR_PUB_LINE_INTERVAL + 2;
gui_set_text_color(c);
lineTextC = width / chrW;
while(app_ucs2_strlen((kal_int8*) chrPtr) >= lineTextC && printedTextC < totalC)
{
if(printedTextC + lineTextC > totalC) lineTextC = totalC - printedTextC;
lineTextW = gui_get_string_width_n(chrPtr, lineTextC);
for(i = 0; lineTextW < width, printedTextC + lineTextC < totalC; i++, lineTextC++)
{
lineTextW = gui_get_string_width_n(chrPtr, lineTextC);
if(lineTextW > width)
{
lineTextC--;
break;
}
}
lineTextH = gui_get_string_height(chrPtr);
gui_move_text_cursor(x, y1 + (lineNum - 1) * chrH + (chrH - lineTextH >> 1));
gui_print_text_n(chrPtr, lineTextC);
printedTextC += lineTextC;
lineNum++;
chrPtr += lineTextC;
lineTextC = width / chrW;
}
if(app_ucs2_strlen((kal_int8*) chrPtr) < lineTextC && printedTextC < totalC)
{
lineTextH = gui_get_string_height(chrPtr);
gui_move_text_cursor(x, y1 + lineNum * chrH - lineTextH);
gui_print_text(chrPtr);
}
f->underline = 0;
return (lineNum - 1);
}

被折叠的 条评论
为什么被折叠?



