PixcomFontEngine.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:162k
源码类别:
MTK
开发平台:
C/C++
- {
- #if defined(__MMI_ZI__)
- index = SearchInPropFont(Ch, &nBase);
- if (index == -1)
- {
- #endif /* defined(__MMI_ZI__) */
- Ch = 65515;
- index = SearchInPropFont(Ch, &nBase);
- if (index == -1)
- {
- return index;
- }
- #if defined(__MMI_ZI__)
- }
- *pHeight = gMTKProprietaryFont.nHeight;
- *pWidth = gMTKProprietaryFont.pWidthArray[index];
- goto label_out2;
- #endif /* defined(__MMI_ZI__) */
- }
- #if defined(__MMI_ZI__)
- *pHeight = gZiExtraCharacter.nHeight;
- *pWidth = gZiExtraCharacter.pWidthArray[index];
- label_out2:;
- #else /* defined(__MMI_ZI__) */
- *pHeight = gMTKProprietaryFont.nHeight;
- *pWidth = gMTKProprietaryFont.pWidthArray[index];
- #endif /* defined(__MMI_ZI__) */
- /* MTK End */
- return index;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_StringWidthHeight
- * DESCRIPTION
- * To get string width and height
- *
- * This is used to get string widths
- * PARAMETERS
- * String [IN]
- * pWidth [?]
- * pHeight [?]
- * RETURNS
- * S32(?)
- *****************************************************************************/
- void Get_StringWidthHeight(U8 *String, S32 *pWidth, S32 *pHeight)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 StrWidth = 0;
- S32 nHeight = 0;
- S32 Counter = 0;
- U16 unicode = 0;
- U16 curCh = 0, preCh = 0, pre2Ch = 0;
- #if defined(__MMI_LANG_VIETNAMESE__)
- U16 next_unicode = 0;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #ifdef __MMI_BIDI_ALG__
- S32 nLen;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *pHeight = 0;
- *pWidth = 0;
- /* START VIJAY PMT 20050728 */
- #ifdef __MMI_HINDI_ALG__
- if (hf_is_reset_hindi_params())
- {
- reset_hindi_params();
- }
- if (hf_is_hindi_rules_parsing())
- {
- U16 cluster_fill[G_MAX];
- S32 cluster_length;
- U16 glyph_output[G_MAX];
- S32 Len;
- S32 len;
- S32 total_len = 0;
- S32 original_len = 0;
- S32 width, height;
- pre2Ch = 0;
- preCh = 0;
- if (String == NULL)
- {
- return;
- }
- /* PMT START LANGUAGE 20060104 */
- #if defined (__MMI_BIDI_ALG__)
- nLen = UCS2Strlen((const char*)String);
- //MMI_ASSERT(!(nLen > MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH));
- if(nLen>MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH) nLen = MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH;
- //UCS2Strcpy((S8*) show_pwcWord, (S8*) String);
- UCS2Strncpy((S8*) show_pwcWord, (S8*) String,nLen);
- show_pwcWord[nLen] = 0;
- nLen = UCS2Strlen((const char*)show_pwcWord);
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- #if defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__)
- if (nLen)
- {
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_PERSIAN__) && defined(__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_PERSIAN__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_AR, (U16 *) & nLen, show_pwcWord);
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape((U16 *) & nLen, show_pwcWord);
- #endif /* __MMI_ZI_V7__ */
- }
- #else /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- if (nLen)
- {
- ArabicShapeEngine((U16*) & nLen, show_pwcWord); /* output will replace the input string after returning */
- }
- #endif /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- String = (U8*) show_pwcWord;
- #endif /* defined (__MMI_BIDI_ALG__) */
- /* PMT END LANGUAGE 20060104 */
- init_cluster_start_p(String);
- len = gui_strlen((UI_string_type) String);
- if (len > 0)
- {
- init_cluster_end_p(String + (len * 2));
- }
- else
- {
- init_cluster_end_p(String + (2 * UCS2Strlen((const char*)String) + 1));
- }
- original_len = len;
- hf_disable_hindi_rules_parsing();
- hf_disable_hindi_reset_hindi_params();
- do
- {
- cluster_length = hf_get_cluster(cluster_fill);
- total_len += cluster_length;
- if (original_len > 0)
- {
- if (total_len > original_len)
- {
- break;
- }
- }
- if (cluster_length)
- {
- Len = hf_hindi_rules(glyph_output, cluster_fill, cluster_length);
- Get_StringWidthHeight((U8*) glyph_output, &width, &height);
- if (height > *pHeight)
- {
- *pHeight = height;
- }
- *pWidth += width;
- }
- } while (cluster_length);
- hf_enable_hindi_rules_parsing();
- hf_enable_hindi_reset_hindi_params();
- return;
- }
- #endif /* __MMI_HINDI_ALG__ */
- /* END VIJAY PMT 20050728 */
- if (String == NULL)
- {
- return;
- }
- /* PMT START LANGUAGE 20060104 */
- #if defined (__MMI_BIDI_ALG__) && !defined(__MMI_HINDI_ALG__)
- /* PMT END LANGUAGE 20060104 */
- nLen = UCS2Strlen((const char*)String);
- //MMI_ASSERT(!(nLen > MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH));
- if(nLen>MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH) nLen = MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH;
- //UCS2Strcpy((S8*) show_pwcWord, (S8*) String);
- UCS2Strncpy((S8*) show_pwcWord, (S8*) String,nLen);
- show_pwcWord[nLen] = 0;
- nLen = UCS2Strlen((const char*)show_pwcWord);
- /* PMT NO_AR_SL_DU START 20050909 */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- #if defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__)
- if (nLen)
- {
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_PERSIAN__) && defined(__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_PERSIAN__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_AR, (U16 *) & nLen, show_pwcWord);
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape((U16 *) & nLen, show_pwcWord);
- #endif /* __MMI_ZI_V7__ */
- }
- #else /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- if (nLen)
- {
- ArabicShapeEngine((U16*) & nLen, show_pwcWord); /* output will replace the input string after returning */
- }
- #endif /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /* PMT NO_AR_SL_DU END 20050909 */
- String = (U8*) show_pwcWord;
- #endif /* defined (__MMI_BIDI_ALG__) && !defined(__MMI_HINDI_ALG__) */
- while (1)
- {
- if ((String[0] == ' ') && (String[1] == ' '))
- {
- break;
- }
- memcpy(&unicode, String, 2);
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((unicode > 0x0040) && (unicode < 0x01B1))
- {
- next_unicode = String[2];
- next_unicode |= (String[3] << 8);
- tone_mark = mmi_viet_tone_mark(next_unicode);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(unicode);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- unicode = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- String += 2;
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- Get_CharWidthHeight(unicode, &StrWidth, &nHeight);
- /* Consider the Thai String length is different from others */
- curCh = unicode;
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- /* Base line character, can combinate with above vowels,bottom vowels, tone mark, and sign */
- if (IsThaiBaseLineChar(curCh))
- {
- //if the current character is 0x0E33 and previous or previous 2 character is base line character, 0x0E33 shall be
- //moved ahead to let the circyle sign on the top of previous or previous2 character
- if (curCh == 0x0E33 && (IsThaiBaseLineChar(preCh) || IsThaiBaseLineChar(pre2Ch)))
- {
- *pWidth = *pWidth - 4 + (S32) StrWidth + gThaiFontInterSpace;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- }
- /* For Thai digits and base line sign, the only thing we have to do is moving cursor */
- else if (IsThaiDigitChar(curCh) || IsThaiBaseSignChar(curCh))
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- else if (IsThaiToneMark(curCh))
- {
- if (IsThaiBaseLineChar(preCh) || IsThaiAboveLineChar(preCh) || IsThaiBottomLineChar(preCh))
- {
- }
- else if (preCh == 0x0E47 || preCh == 0x0E4C)
- {
- /* move the tone mark to next character space */
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- }
- *pHeight = gThaiLineHeight; /* If the string has Thai characters,the height will become gThaiLineHeight(now the value is 17) */
- pre2Ch = preCh;
- preCh = curCh;
- }
- #ifdef __MMI_HINDI_ALG__
- else if (UI_HINDI_CHARACTER_UCS2_RANGE(curCh))
- {
- U16 nextCharUCS2;
- memcpy(&nextCharUCS2, String + 2, 2);
- /* PMT START MAUI_00223197 */
- if ((curCh != S_VISARGA) && UI_HINDI_SIGN_RANGE(curCh))
- /* PMT END MAUI_00223197 */
- {
- (*pWidth) += 0;
- }
- else
- {
- if (UI_HINDI_CHARACTER_UCS2_RANGE(nextCharUCS2) || nextCharUCS2 == 0)
- {
- (*pWidth) += StrWidth;
- }
- else
- {
- Get_CharWidth(curCh, &StrWidth);
- (*pWidth) += StrWidth;
- }
- }
- }
- #endif /* __MMI_HINDI_ALG__ */
- else
- {
- (*pWidth) += StrWidth;
- }
- if (*pHeight < nHeight)
- {
- *pHeight = nHeight;
- }
- Counter++;
- String += 2;
- }
- return;
- }
- #if(FONTENGINE_IRAM_PLACEMENT)
- #ifdef __MTK_TARGET__
- #pragma arm section code
- #endif
- #endif /* (FONTENGINE_IRAM_PLACEMENT) */
- /* july-28-2002 manju: required by UI elements. This function measures a text string's width upto a given number of characters */
- /*****************************************************************************
- * FUNCTION
- * Get_StringWidthHeight_n
- * DESCRIPTION
- * To get string widths and height upto a given number of characters
- *
- * This is used to get string widths upto a given number of characters
- * PARAMETERS
- * String [IN]
- * n [IN]
- * pWidth [IN]
- * pHeight [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void Get_StringWidthHeight_n(U8 *String, S32 n, S32 *pWidth, S32 *pHeight)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 StrWidth = 0;
- S32 Counter = 0;
- S32 nHeight = 0;
- U16 unicode = 0;
- U16 curCh = 0, preCh = 0, pre2Ch = 0;
- #if defined(__MMI_LANG_VIETNAMESE__)
- U16 next_unicode = 0;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #ifdef __MMI_BIDI_ALG__
- S32 nLen;
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *pHeight = 0;
- *pWidth = 0;
- //Modified by Ailsa start
- #ifdef __MMI_HINDI_ALG__
- if (hf_is_reset_hindi_params())
- {
- reset_hindi_params();
- }
- if (hf_is_hindi_rules_parsing())
- {
- U16 cluster_fill[G_MAX];
- S32 cluster_length;
- U16 glyph_output[G_MAX];
- S32 Len;
- S32 len;
- S32 total_len = 0;
- S32 original_len = 0;
- S32 width, height;
- pre2Ch = 0;
- preCh = 0;
- if (String == NULL)
- {
- return;
- }
- //Modified by Ailsa end
- #if defined (__MMI_BIDI_ALG__)
- nLen = UCS2Strlen((const char*)String);
- //MMI_ASSERT(!(nLen > MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH));
- if(nLen>MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH) nLen = MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH;
- if(n< nLen) nLen = n;
- //UCS2Strcpy((S8*) show_pwcWord, (S8*) String);
- UCS2Strncpy((S8*) show_pwcWord, (S8*) String,nLen);
- show_pwcWord[nLen] = 0;
- nLen = UCS2Strlen((const char*)show_pwcWord);
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- #if defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__)
- if (nLen)
- {
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_PERSIAN__) && defined(__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_PERSIAN__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_AR, (U16 *) & nLen, show_pwcWord);
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape((U16 *) & nLen, show_pwcWord);
- #endif /* __MMI_ZI_V7__ */
- }
- #else /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- if (nLen)
- {
- ArabicShapeEngine((U16*) & nLen, show_pwcWord); /* output will replace the input string after returning */
- }
- #endif /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- String = (U8*) show_pwcWord;
- #endif /* defined (__MMI_BIDI_ALG__) */
- //Modified by Ailsa start
- init_cluster_start_p(String);
- len = gui_strlen((UI_string_type) String);
- if (len > 0)
- {
- init_cluster_end_p(String + (len * 2));
- }
- else
- {
- init_cluster_end_p(String + (2 * UCS2Strlen((const char*)String) + 1));
- }
- original_len = len;
- hf_disable_hindi_rules_parsing();
- hf_disable_hindi_reset_hindi_params();
- do
- {
- cluster_length = hf_get_cluster(cluster_fill);
- total_len += cluster_length;
- if (original_len > 0)
- {
- if (total_len > original_len)
- {
- break;
- }
- }
- if (cluster_length)
- {
- Len = hf_hindi_rules(glyph_output, cluster_fill, cluster_length);
- Get_StringWidthHeight((U8*) glyph_output, &width, &height);
- if (height > *pHeight)
- {
- *pHeight = height;
- }
- *pWidth += width;
- }
- } while (cluster_length);
- hf_enable_hindi_rules_parsing();
- hf_enable_hindi_reset_hindi_params();
- return;
- }
- #endif /* __MMI_HINDI_ALG__ */
- //Modified by Ailsa end
- if (String == NULL)
- {
- return;
- }
- #if defined (__MMI_BIDI_ALG__) && !defined(__MMI_HINDI_ALG__)
- nLen = UCS2Strlen((const char*)String);
- //MMI_ASSERT(!(nLen > MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH));
- if(nLen>MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH) nLen = MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH;
- if(n< nLen) nLen = n;
- //UCS2Strcpy((S8*) show_pwcWord, (S8*) String);
- UCS2Strncpy((S8*) show_pwcWord, (S8*) String,nLen);
- show_pwcWord[nLen] = 0;
- nLen = UCS2Strlen((const char*)show_pwcWord);
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- #if defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__)
- if (nLen)
- {
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_PERSIAN__) && defined(__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_PERSIAN__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_AR, (U16 *) & nLen, show_pwcWord);
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape((U16 *) & nLen, show_pwcWord);
- #endif /* __MMI_ZI_V7__ */
- }
- #else /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- if (nLen)
- {
- ArabicShapeEngine((U16*) & nLen, show_pwcWord); /* output will replace the input string after returning */
- }
- #endif /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- String = (U8*) show_pwcWord;
- #endif /* defined (__MMI_BIDI_ALG__) && !defined(__MMI_HINDI_ALG__) */
- while (Counter < n)
- {
- if ((String[0] == ' ') && (String[1] == ' '))
- {
- break;
- }
- memcpy(&unicode, String, 2);
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((unicode > 0x0040) && (unicode < 0x01B1))
- {
- next_unicode = String[2];
- next_unicode |= (String[3] << 8);
- tone_mark = mmi_viet_tone_mark(next_unicode);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(unicode);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- unicode = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- String += 2;
- n += 1;
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- Get_CharWidthHeight(unicode, &StrWidth, &nHeight);
- /* Consider the Thai String length is different from others */
- curCh = unicode;
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- /* Base line character, can combinate with above vowels,bottom vowels, tone mark, and sign */
- if (IsThaiBaseLineChar(curCh))
- {
- //if the current character is 0x0E33 and previous or previous 2 character is base line character, 0x0E33 shall be
- //moved ahead to let the circyle sign on the top of previous or previous2 character
- if (curCh == 0x0E33 && (IsThaiBaseLineChar(preCh) || IsThaiBaseLineChar(pre2Ch)))
- {
- *pWidth = *pWidth - 4 + (S32) StrWidth + gThaiFontInterSpace;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- }
- /* For Thai digits and base line sign, the only thing we have to do is moving cursor */
- else if (IsThaiDigitChar(curCh) || IsThaiBaseSignChar(curCh))
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- else if (IsThaiToneMark(curCh))
- {
- if (IsThaiBaseLineChar(preCh) || IsThaiAboveLineChar(preCh) || IsThaiBottomLineChar(preCh))
- {
- }
- else if (preCh == 0x0E47 || preCh == 0x0E4C)
- {
- /* move the tone mark to next character space */
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- }
- *pHeight = gThaiLineHeight; /* If the string has Thai characters,the height will become gThaiLineHeight(now the value is 17) */
- pre2Ch = preCh;
- preCh = curCh;
- }
- #ifdef __MMI_HINDI_ALG__
- else if (UI_HINDI_CHARACTER_UCS2_RANGE(curCh))
- {
- U16 nextCharUCS2;
- memcpy(&nextCharUCS2, String + 2, 2);
- /* PMT START MAUI_00223197 */
- if ((curCh != S_VISARGA) && UI_HINDI_SIGN_RANGE(curCh))
- /* PMT END MAUI_00223197 */
- {
- (*pWidth) += 0;
- }
- else
- {
- if (UI_HINDI_CHARACTER_UCS2_RANGE(nextCharUCS2) || nextCharUCS2 == 0)
- {
- (*pWidth) += StrWidth;
- }
- else
- {
- Get_CharWidth(curCh, &StrWidth);
- (*pWidth) += StrWidth;
- }
- }
- }
- #endif /* __MMI_HINDI_ALG__ */
- else
- {
- (*pWidth) += StrWidth;
- }
- if (*pHeight < nHeight)
- {
- *pHeight = nHeight;
- }
- Counter++;
- String += 2;
- }
- return;
- }
- /* PMT dara added for Multitap thai */
- /*****************************************************************************
- * FUNCTION
- * Get_StringWidthHeight_multitap
- * DESCRIPTION
- *
- * PARAMETERS
- * String [?]
- * w [IN]
- * pWidth [?]
- * pHeight [?]
- * RETURNS
- * void
- *****************************************************************************/
- void Get_StringWidthHeight_multitap(U8 *String, S32 w, S32 *pWidth, S32 *pHeight)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 StrWidth = 0;
- S32 Counter = 0;
- S32 nHeight = 0;
- U16 unicode = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *pHeight = 0;
- *pWidth = 0;
- if (String == NULL)
- {
- return;
- }
- while (1)
- {
- if ((String[0] == ' ') && (String[1] == ' '))
- {
- break;
- }
- memcpy(&unicode, String, 2);
- Get_CharWidthHeight(unicode, &StrWidth, &nHeight);
- /* Consider the Thai String length is different from others */
- (*pWidth) += (StrWidth + w);
- if (*pHeight < nHeight)
- {
- *pHeight = nHeight;
- }
- Counter++;
- String += 2;
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_StringWidthHeight_w
- * DESCRIPTION
- *
- * PARAMETERS
- * String [?]
- * w [IN]
- * pWidth [?]
- * pHeight [?]
- * RETURNS
- * void
- *****************************************************************************/
- void Get_StringWidthHeight_w(U8 *String, S32 w, S32 *pWidth, S32 *pHeight)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 StrWidth = 0;
- S32 Counter = 0;
- S32 nHeight = 0;
- U16 unicode = 0;
- U16 curCh = 0, preCh = 0, pre2Ch = 0;
- #if defined(__MMI_LANG_VIETNAMESE__)
- U16 next_unicode = 0;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *pHeight = 0;
- *pWidth = 0;
- if (String == NULL)
- {
- return;
- }
- while (1)
- {
- if ((String[0] == ' ') && (String[1] == ' '))
- {
- break;
- }
- memcpy(&unicode, String, 2);
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((unicode > 0x0040) && (unicode < 0x01B1))
- {
- next_unicode = String[2];
- next_unicode |= (String[3] << 8);
- tone_mark = mmi_viet_tone_mark(next_unicode);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(unicode);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- unicode = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- String += 2;
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- Get_CharWidthHeight(unicode, &StrWidth, &nHeight);
- /* Consider the Thai String length is different from others */
- curCh = unicode;
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- /* Base line character, can combinate with above vowels,bottom vowels, tone mark, and sign */
- if (IsThaiBaseLineChar(curCh))
- {
- //if the current character is 0x0E33 and previous or previous 2 character is base line character, 0x0E33 shall be
- //moved ahead to let the circyle sign on the top of previous or previous2 character
- if (curCh == 0x0E33 && (IsThaiBaseLineChar(preCh) || IsThaiBaseLineChar(pre2Ch)))
- {
- *pWidth = *pWidth - 4 + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- }
- /* For Thai digits and base line sign, the only thing we have to do is moving cursor */
- else if (IsThaiDigitChar(curCh) || IsThaiBaseSignChar(curCh))
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- else if (IsThaiToneMark(curCh))
- {
- if (IsThaiBaseLineChar(preCh) || IsThaiAboveLineChar(preCh) || IsThaiBottomLineChar(preCh))
- {
- }
- else if (preCh == 0x0E47 || preCh == 0x0E4C)
- {
- /* move the tone mark to next character space */
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- }
- *pHeight = gThaiLineHeight; /* If the string has Thai characters,the height will become gThaiLineHeight(now the value is 17) */
- pre2Ch = preCh;
- preCh = curCh;
- }
- else
- {
- (*pWidth) += (StrWidth + w);
- }
- if (*pHeight < nHeight)
- {
- *pHeight = nHeight;
- }
- Counter++;
- String += 2;
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_StringWidthHeight_wn
- * DESCRIPTION
- *
- * PARAMETERS
- * String [?]
- * w [IN]
- * n [IN]
- * pWidth [?]
- * pHeight [?]
- * RETURNS
- * void
- *****************************************************************************/
- void Get_StringWidthHeight_wn(U8 *String, S32 w, S32 n, S32 *pWidth, S32 *pHeight)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 StrWidth = 0;
- S32 Counter = 0;
- S32 nHeight = 0;
- U16 unicode = 0;
- U16 curCh = 0, preCh = 0, pre2Ch = 0;
- #if defined(__MMI_LANG_VIETNAMESE__)
- U16 next_unicode = 0;
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (String == NULL)
- {
- return;
- }
- *pHeight = 0;
- *pWidth = 0;
- while (Counter < n)
- {
- if ((String[0] == ' ') && (String[1] == ' '))
- {
- break;
- }
- memcpy(&unicode, String, 2);
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((unicode > 0x0040) && (unicode < 0x01B1))
- {
- next_unicode = String[2];
- next_unicode |= (String[3] << 8);
- tone_mark = mmi_viet_tone_mark(next_unicode);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(unicode);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- unicode = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- String += 2;
- n += 1;
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- Get_CharWidthHeight(unicode, &StrWidth, &nHeight);
- /* Consider the Thai String length is different from others */
- curCh = unicode;
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- //curCh = unicode;
- // Base line character, can combinate with above vowels,bottom vowels, tone mark, and sign
- if (IsThaiBaseLineChar(curCh))
- {
- //if the current character is 0x0E33 and previous or previous 2 character is base line character, 0x0E33 shall be
- //moved ahead to let the circyle sign on the top of previous or previous2 character
- if (curCh == 0x0E33 && (IsThaiBaseLineChar(preCh) || IsThaiBaseLineChar(pre2Ch)))
- {
- *pWidth = *pWidth - 4 + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- }
- /* For Thai digits and base line sign, the only thing we have to do is moving cursor */
- else if (IsThaiDigitChar(curCh) || IsThaiBaseSignChar(curCh))
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace;
- }
- else if (IsThaiToneMark(curCh))
- {
- if (IsThaiBaseLineChar(preCh) || IsThaiAboveLineChar(preCh) || IsThaiBottomLineChar(preCh))
- {
- }
- else if (preCh == 0x0E47 || preCh == 0x0E4C)
- {
- /* move the tone mark to next character space */
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- else
- {
- *pWidth = *pWidth + (S32) StrWidth + gThaiFontInterSpace + w;
- }
- }
- *pHeight = gThaiLineHeight; /* If the string has Thai characters,the height will become gThaiLineHeight(now the value is 17) */
- pre2Ch = preCh;
- preCh = curCh;
- }
- else
- {
- (*pWidth) += (StrWidth + w);
- }
- Counter++;
- String += 2;
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_CharHeight
- * DESCRIPTION
- * To get char height
- *
- * This is used to get char height
- * PARAMETERS
- * void
- * RETURNS
- * S32
- *****************************************************************************/
- S32 Get_CharHeight()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (S32) gpCurrentFont->nHeight;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_CharHeightOfAllLang
- * DESCRIPTION
- * To get maximum char height regardless of language
- *
- * Justin. for WAP layout formating.
- * PARAMETERS
- * size [IN]
- * RETURNS
- * S32
- *****************************************************************************/
- S32 Get_CharHeightOfAllLang(U8 size)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int lang_index;
- sFontFamily *pFontFamily;
- S32 height = 0, h;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (lang_index = 0; lang_index < gMaxDeployedLangs; lang_index++)
- {
- pFontFamily = gLanguageArray[lang_index].fontfamilyList[gLanguageArray[lang_index].nCurrentFamily];
- if ((h = (S32) pFontFamily->fontData[size]->nHeight) > height)
- {
- height = h;
- }
- }
- if (height < (S32) gMTKProprietaryFont.nHeight)
- {
- height = (S32) gMTKProprietaryFont.nHeight;
- }
- /* MTK Add steven 2005.06.03 */
- #if defined(__MMI_ZI__)
- if (height < (S32) gZiExtraCharacter.nHeight)
- {
- height = (S32) gZiExtraCharacter.nHeight;
- }
- #endif /* defined(__MMI_ZI__) */
- /* MTK End */
- return height;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_StringHeight
- * DESCRIPTION
- * To get string height
- *
- * This is used to get string height
- * PARAMETERS
- * void
- * RETURNS
- * S32
- *****************************************************************************/
- S32 Get_StringHeight()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- sFontFamily *pFontFamily;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pFontFamily = gLanguageArray[gCurrLangIndex].fontfamilyList[gLanguageArray[gCurrLangIndex].nCurrentFamily];
- return (S32) (pFontFamily->fontData[gnCurrentFont]->nHeight);
- #if 0
- /* under construction !*/
- #endif /* 0 */
- }
- /*****************************************************************************
- * FUNCTION
- * TestDiffFonts
- * DESCRIPTION
- * To test the different fonts with diferent sizes.
- *
- * This is used to test the different fonts with diferent sizes.
- * PARAMETERS
- * void
- * RETURNS
- * void
- * BOOL
- *
- *****************************************************************************/
- void TestDiffFonts()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 count = 0, y = 20;
- stFontAttribute fontInfo;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- fontInfo.bold = 0;
- fontInfo.italic = 0;
- fontInfo.underline = 0;
- fontInfo.size = 9; /* (size 8..15 FOR type 2..5 ) & (size 9...15 FOR type 1 ) */
- fontInfo.type = 1; /* 1...5 */
- for (count = 0; count < 2; count++)
- {
- ShowString(0, y, fontInfo, 0, (PU8) "abcdefghij", 30);
- y += 20;
- ShowString(0, y, fontInfo, 0, (PU8) "klmnopqrst", 30);
- y += 20;
- ShowString(0, y, fontInfo, 0, (PU8) "uvwxyz", 30);
- fontInfo.size += 1;
- y += 20;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * Get_FontHeight
- * DESCRIPTION
- *
- * PARAMETERS
- * f [IN]
- * arrCount [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 Get_FontHeight(stFontAttribute f, U8 arrCount)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- sFontFamily *pFontFamily;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pFontFamily = gLanguageArray[arrCount].fontfamilyList[gLanguageArray[arrCount].nCurrentFamily];
- return (S32) (pFontFamily->fontData[f.size]->nHeight);
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiToneMark
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiToneMark(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch == 0x0E48 || ch == 0x0E49 || ch == 0x0E4A || ch == 0x0E4B)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiBaseLineChar
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiBaseLineChar(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch >= 0x0E01 && ch <= 0x0E7F)
- {
- /* above vowels */
- if (ch != 0x0E31 && ch != 0x0E34 && ch != 0x0E35 && ch != 0x0E36 && ch != 0x0E37 &&
- /* Tone marks */
- ch != 0x0E48 && ch != 0x0E49 && ch != 0x0E4A && ch != 0x0E4B &&
- /* Below vowels */
- ch != 0x0E38 && ch != 0x0E39 && ch != 0X0E3A &&
- /* Signs */
- ch != 0x0E2F && ch != 0x0E3F && ch != 0x0E46 && ch != 0x0E47 && ch != 0x0E4C &&
- /* Exclude Thai digits */
- ch < 0x0E4F)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiAboveLineChar
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiAboveLineChar(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch == 0x0E31 || ch == 0x0E34 || ch == 0x0E35 || ch == 0x0E36 || ch == 0x0E37 || ch == 0x0E47 || ch == 0x0E4C)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiBottomLineChar
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiBottomLineChar(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch == 0x0E38 || ch == 0x0E39 || ch == 0x0E3A)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiLongTailChar
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiLongTailChar(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch == 0x0E1B || ch == 0x0E1D || ch == 0x0E1F)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiDigitChar
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiDigitChar(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch >= 0x0E50 && ch <= 0x0E59)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * IsThaiBaseSignChar
- * DESCRIPTION
- *
- * PARAMETERS
- * ch [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsThaiBaseSignChar(U16 ch)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ch == 0x0E2F || ch == 0x0E3F || ch == 0x0E46 || ch == 0x0E4F || ch == 0x0E5A || ch == 0x0E5B)
- {
- return TRUE;
- }
- else
- {
- return FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * HaveThaiCharacter
- * DESCRIPTION
- *
- * PARAMETERS
- * str [?]
- * RETURNS
- *
- *****************************************************************************/
- BOOL HaveThaiCharacter(U16 *str)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 ch = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (1)
- {
- ch = str[0];
- if (ch == 0)
- {
- return FALSE;
- }
- if (ch >= 0x0E01 && ch <= 0x0E7F)
- {
- return TRUE;
- }
- str++;
- }
- return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * RequireToMoveCursor
- * DESCRIPTION
- *
- * PARAMETERS
- * preCh [IN]
- * curCh [IN]
- * RETURNS
- *
- *****************************************************************************/
- BOOL RequireToMoveCursor(U16 preCh, U16 curCh)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- pBOOL isPreBaseLineChar = IsThaiBaseLineChar(preCh);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- if (IsThaiBaseLineChar(curCh) || IsThaiDigitChar(curCh) || IsThaiBaseSignChar(curCh))
- { /* For base level character */
- return TRUE;
- }
- else if (IsThaiAboveLineChar(curCh))
- { /* For above level character */
- if (isPreBaseLineChar)
- {
- return FALSE;
- }
- else if (curCh == 0x0E4C && preCh != 0x0E4C && preCh != 0x0E47)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
- }
- else if (IsThaiBottomLineChar(curCh))
- { /* For below level character */
- if (isPreBaseLineChar)
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
- }
- else if (IsThaiToneMark(curCh))
- { /* For Tone mark characters */
- if (isPreBaseLineChar || IsThaiAboveLineChar(preCh) || IsThaiBottomLineChar(preCh))
- {
- return FALSE;
- }
- else
- {
- return TRUE;
- }
- }
- else
- {
- return TRUE;
- }
- }
- else
- {
- return TRUE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ShowCharFuncDispatch
- * DESCRIPTION
- *
- * PARAMETERS
- * LineHeight [IN]
- * nWidth [IN]
- * nHgt [IN]
- * CurrentX [IN]
- * CurrentY [IN]
- * Font [IN]
- * BackGround [IN]
- * CharData [?]
- * NumChar [IN]
- * Bordered [IN]
- * RETURNS
- * void
- *****************************************************************************/
- __inline static void ShowCharFuncDispatch(
- U32 LineHeight,
- U16 nWidth,
- U16 nHgt,
- S32 CurrentX,
- S32 CurrentY,
- stFontAttribute Font,
- U8 BackGround,
- U8 *CharData,
- U32 NumChar,
- U32 Bordered)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 nXOffset, nYOffset;
- U8 font_attr = 0;
- gdi_color border_color = 0, text_color;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gnCurrentFontAttrib & FONTATTRIB_ITALIC)
- {
- font_attr |= FONTATTRIB_ITALIC;
- }
- else if (gnCurrentFontAttrib & FONTATTRIB_OBLIQUE)
- {
- font_attr |= FONTATTRIB_OBLIQUE;
- }
- if (Font.underline)
- {
- font_attr |= FONTATTRIB_UNDERLINE;
- }
- {
- if (Bordered)
- {
- border_color = gdi_act_color_from_rgb(0xff, UI_text_border_color.r, UI_text_border_color.g, UI_text_border_color.b);
- }
- text_color = gdi_act_color_from_rgb(0xff, UI_current_text_color.r, UI_current_text_color.g, UI_current_text_color.b);
- }
- /*
- * MTK Terry to consider Thai display in ShowStackedString
- * if(LineHeight>0)
- * {
- *
- * if(LineHeight==gThaiLineHeight ) //If the line height is equal to 17 points
- * CurrentY+=(LineHeight-(S32)nHgt-1); // Lower one pixel to centralize ThaiFont
- * else
- * CurrentY+=(LineHeight-(S32)nHgt);
- *
- * }
- */
- nXOffset = CurrentX + nWidth;
- nYOffset = CurrentY + nHgt;
- if (Bordered)
- {
- gdi_show_char_bordered(
- CurrentX,
- CurrentY,
- text_color,
- border_color,
- CharData,
- NumChar,
- nWidth,
- nHgt,
- font_attr);
- }
- else if (!
- (gnCurrentFontAttrib & FONTATTRIB_BOLD &&
- gpCurrentFont->pFontType[gnCurrentFont][gbFontType] & FONTATTRIB_BOLD) ||
- !(gpCurrentFont->pFontType[gnCurrentFont][gbFontType] & FONTATTRIB_NORMAL))
- {
- gdi_show_char(CurrentX, CurrentY, text_color, CharData, NumChar, nWidth, nHgt, font_attr);
- }
- else
- {
- gdi_show_char(CurrentX + 1, CurrentY, text_color, CharData, NumChar, nWidth, nHgt, font_attr);
- gdi_show_char(CurrentX, CurrentY, text_color, CharData, NumChar, nWidth, nHgt, font_attr);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ShowStackedString
- * DESCRIPTION
- *
- * PARAMETERS
- * CurrentX [IN]
- * CurrentY [IN]
- * Font [IN]
- * BackGround [IN]
- * String [?]
- * LineHeight [IN]
- * Bordered [IN]
- * len [IN]
- * RETURNS
- *
- *****************************************************************************/
- U32 ShowStackedString(
- S32 CurrentX,
- S32 CurrentY,
- stFontAttribute Font,
- U8 BackGround,
- U8 *String,
- U32 LineHeight,
- U32 Bordered,
- S32 len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* GDI_ENTER_CRITICAL_SECTION(ShowStackedString) */
- U8 *CharData;
- U32 NumChar;
- U16 nHgt;
- U16 nWidth;
- S32 temp_len = 0;
- BOOL has_thai_char = MMI_FALSE;
- S32 iX, iY;
- static U16 curCh = 0, preCh = 0, pre2Ch = 0, nextCharUCS2 = 0;
- S32 interLeaving = gThaiFontInterSpace;
- gdi_color border_color, text_color;
- U8 font_attr = 0;
- S32 str_width, str_height;
- S32 clip_x1, clip_y1, clip_x2, clip_y2;
- #if defined(__MMI_LANG_VIETNAMESE__)
- viet_tone_mark tone_mark = VIET_TONE_NONE;
- viet_vowel_letter viet_vowel = VIET_VOWEL_NONE;
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #ifdef __MMI_HINDI_ALG__
- U16 nDWidth = 0;
- static S32 single_time_bidi = 0; /* added farhad 20012004 */
- static S32 hindi_rule_string = 1;
- #endif /* __MMI_HINDI_ALG__ */
- #ifdef __MMI_BIDI_ALG__
- PMT_BIDI_TYPES default_direction = BIDI_L;
- U16 logical_cur_pos;
- U8 *temp_text_P;
- U16 visual_str_len;
- U16 visual_cur_pos;
- S32 nLen;
- U16 visual_hilight_start;
- U16 visual_hilight_end;
- #endif /* __MMI_BIDI_ALG__ */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gdi_layer_get_clip(&clip_x1, &clip_y1, &clip_x2, &clip_y2);
- Get_StringWidthHeight(String, &str_width, &str_height);
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- mmi_trace_screen_string(CurrentX, CurrentY, String, len, Bordered);
- #endif
- #ifdef __MMI_HINDI_ALG__
- if (!single_time_bidi && !cancelWidth)
- #endif
- {
- #ifdef __MMI_BIDI_ALG__
- nLen = UCS2Strlen((const char*)String);
- if(nLen > MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH)
- len = MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH;
- // MMI_ASSERT(!(nLen > MAX_SHOW_STRING_TEXT_LENGTH - ENCODING_LENGTH));
- if (len > 0)
- {
- UCS2Strncpy((S8*) show_pwcWord, (S8*) String, len);
- }
- else
- {
- UCS2Strcpy((S8*) show_pwcWord, (S8*) String);
- }
- nLen = UCS2Strlen((const char*)show_pwcWord);
- /* PMT NO_AR_SL_DU START 20050909 */
- #if defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__)
- #if defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__)
- if (nLen)
- {
- #ifdef __MMI_ZI_V7__
- #if defined(__MMI_ZI_PERSIAN__) && defined(__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_PERSIAN__)
- ZiStringShape(ZI8_LANG_FA, (U16 *) & nLen, show_pwcWord);
- #elif defined (__MMI_ZI_ARABIC__)
- ZiStringShape(ZI8_LANG_AR, (U16 *) & nLen, show_pwcWord);
- #endif
- #else /* __MMI_ZI_V7__ */
- ArabicStringShape((U16 *) & nLen, show_pwcWord);
- #endif /* __MMI_ZI_V7__ */
- }
- #else /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- if (nLen)
- {
- ArabicShapeEngine((U16*) & nLen, show_pwcWord); /* output will replace the input string after returning */
- }
- #endif /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- #endif /* defined(__MMI_LANG_ARABIC__) || defined(__MMI_LANG_PERSIAN__) */
- /* PMT NO_AR_SL_DU END 20050909 */
- String = (U8*) show_pwcWord;
- bidi_get_char_type((U8*) String, (U8*) & default_direction);
- logical_cur_pos = 0;
- if (default_direction == BIDI_R || default_direction == AL)
- {
- bidi_main(
- (U8*) String,
- (U16) UCS2Strlen((const S8*)String),
- logical_cur_pos,
- show_visual_str,
- &visual_str_len,
- &visual_cur_pos,
- MMI_TRUE,
- MMI_bidi_input_type,
- 0,
- 0,
- &visual_hilight_start,
- &visual_hilight_end);
- default_direction = BIDI_R;
- }
- else /* if(default_direction == BIDI_L) */
- {
- bidi_main(
- (U8*) String,
- (U16) UCS2Strlen((const S8*)String),
- logical_cur_pos,
- show_visual_str,
- &visual_str_len,
- &visual_cur_pos,
- MMI_FALSE,
- MMI_bidi_input_type,
- 0,
- 0,
- &visual_hilight_start,
- &visual_hilight_end);
- default_direction = BIDI_L;
- }
- /* START FARHAD PMT 20050211 */
- #ifdef __MMI_HINDI_ALG__
- if (r2lMMIFlag)
- {
- get_hindi_rules_for_whole_string(show_visual_str);
- hindi_rule_string = 0;
- }
- #endif /* __MMI_HINDI_ALG__ */
- /* END FARHAD PMT 20050211 */
- if ((r2lMMIFlag && default_direction == BIDI_L) || (!r2lMMIFlag && default_direction != BIDI_L))
- {
- bidi_reverse(show_visual_str, (U16) UCS2Strlen((const S8*)show_visual_str));
- }
- temp_text_P = String;
- String = show_visual_str;
- #endif /* __MMI_BIDI_ALG__ */
- } /* added farhad 20012005 */
- if (gnCurrentFontAttrib & FONTATTRIB_ITALIC)
- {
- font_attr |= FONTATTRIB_ITALIC;
- }
- else if (gnCurrentFontAttrib & FONTATTRIB_OBLIQUE)
- {
- font_attr |= FONTATTRIB_OBLIQUE;
- }
- if (Font.underline)
- {
- font_attr |= FONTATTRIB_UNDERLINE;
- }
- if (Bordered)
- {
- border_color = gdi_act_color_from_rgb(0xff, UI_text_border_color.r, UI_text_border_color.g, UI_text_border_color.b);
- }
- text_color = gdi_act_color_from_rgb(0xff, UI_current_text_color.r, UI_current_text_color.g, UI_current_text_color.b);
- gdi_font_begin(text_color, font_attr);
- //UI_current_text_color = UI_text_color;
- //Process string
- #ifdef __MMI_HINDI_ALG__
- if (hf_is_reset_hindi_params())
- {
- reset_hindi_params();
- }
- if (Font.color == 0)
- {
- Font.color = 15;
- }
- //For hindi character sudden disappear
- //UI_current_text_color = UI_text_color;
- if (hf_is_hindi_rules_parsing())
- {
- U16 cluster_fill[G_MAX];
- S32 cluster_length;
- U16 glyph_output[G_MAX];
- S32 Len;
- /* PMT FARHAD START 20050708 */
- S32 total_len = 0;
- S32 original_len = 0;
- /* PMT FARHAD END 20050708 */
- S32 width, height;
- pre2Ch = 0;
- preCh = 0;
- init_cluster_start_p(String);
- /* PMT FARHAD START 20050708 */
- if (len > 0)
- {
- init_cluster_end_p(String + (len * 2));
- }
- else
- {
- init_cluster_end_p(String + (2 * UCS2Strlen((const char*)String) + 1));
- }
- original_len = len;
- /* PMT FARHAD END 20050708 */
- hf_disable_hindi_rules_parsing();
- hf_disable_hindi_reset_hindi_params();
- /* W05.34 For Hindi with Bidi issue */
- single_time_bidi = 1;
- do
- {
- cluster_length = hf_get_cluster(cluster_fill);
- /* PMT FARHAD START 20050708 */
- total_len += cluster_length;
- if (original_len > 0)
- {
- if (total_len > original_len)
- {
- break;
- }
- }
- /* PMT FARHAD END 20050708 */
- if (cluster_length)
- {
- Len = hf_hindi_rules(glyph_output, cluster_fill, cluster_length);
- ShowStackedString(CurrentX, CurrentY, Font, BackGround, (U8*) glyph_output, LineHeight, Bordered, len);
- Get_StringWidthHeight((U8*) glyph_output, &width, &height);
- CurrentX += width;
- }
- } while (cluster_length);
- hf_enable_hindi_rules_parsing();
- hf_enable_hindi_reset_hindi_params();
- /* W05.34 For Hindi with Bidi issue */
- single_time_bidi = 0;
- gdi_font_end();
- return 0;
- /* GDI_RETURN(0); */
- }
- #endif /* __MMI_HINDI_ALG__ */
- if (r2lMMIFlag)
- {
- while (1)
- {
- curCh = (String[temp_len] | (String[temp_len + 1] << 8));
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- has_thai_char = MMI_TRUE;
- break;
- }
- temp_len += 2;
- if (curCh == 0x0000)
- {
- break;
- }
- }
- if (has_thai_char == MMI_TRUE)
- {
- bidi_reverse(String, (U16) UCS2Strlen((const S8*)String));
- Get_StringWidthHeight(String, &str_width, &str_height);
- CurrentX -= str_width;
- }
- }
- while (len != 0)
- {
- iX = CurrentX;
- iY = CurrentY;
- /* prepare the unicode of current and next characters */
- curCh = (String[0] | (String[1] << 8));
- nextCharUCS2 = (String[2] | (String[3] << 8));
- if (curCh == 0x0000)
- {
- break;
- }
- len--;
- if (FONT_TEST_CONTROL_CHAR(curCh))
- {
- curCh = 0x20;
- }
- #if defined(__MMI_LANG_VIETNAMESE__)
- if ((curCh > 0x0040) && (curCh < 0x01B1))
- {
- tone_mark = mmi_viet_tone_mark(nextCharUCS2);
- if (VIET_TONE_NONE != tone_mark)
- {
- viet_vowel = mmi_viet_vowel_letter(curCh);
- if (VIET_VOWEL_NONE != viet_vowel)
- {
- curCh = mmi_viet_combine_vowel_tone(viet_vowel, tone_mark);
- String += 2;
- }
- }
- }
- #endif /* defined(__MMI_LANG_VIETNAMESE__) */
- #if defined(__MMI_HINDI_ALG__)
- NumChar = GetFontdata(curCh, Font, &CharData, &nWidth, &nDWidth, &nHgt);
- get_text_x(&iX, curCh, iY, nDWidth, nWidth);
- #else /* defined(__MMI_HINDI_ALG__) */
- NumChar = GetFontdata(curCh, Font, &CharData, &nWidth, &nHgt);
- #endif /* defined(__MMI_HINDI_ALG__) */
- /* check if current character is in Thai character ranges */
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- /* Base line character, can combinate with above vowels,bottom vowels, tone mark, and sign */
- if (IsThaiBaseLineChar(curCh))
- {
- //if the current character is 0x0E33 and previous or previous 2 character is base line character, 0x0E33 shall be
- //moved ahead to let the circyle sign on the top of previous or previous2 character
- if (curCh == 0x0E33 && (IsThaiBaseLineChar(preCh) || IsThaiBaseLineChar(pre2Ch)))
- {
- iX -= 4;
- }
- CurrentX = (iX + (S32) nWidth + interLeaving);
- }
- /* For Thai digits and base line sign, the only thing we have to do is moving cursor */
- else if (IsThaiDigitChar(curCh) || IsThaiBaseSignChar(curCh))
- {
- CurrentX = (iX + (S32) nWidth + interLeaving);
- }
- else if (IsThaiAboveLineChar(curCh))
- {
- /* Above line characters */
- iY -= 1; /* Reserver 1 pixtel vertical interleaving */
- if (IsThaiBaseLineChar(preCh))
- {
- /* Process the X coordinate when combining with other base line characters */
- iX -= ((S32) nWidth + interLeaving);
- if (IsThaiLongTailChar(preCh)) /* move ahead 3 pixels, */
- {
- iX -= 3;
- }
- else if (preCh == 0x0E0A || preCh == 0x0E0B)
- {
- iX -= 2;
- }
- else if (preCh == 0x0E2C) /* move ahead 6 pixels */
- {
- iX -= 6;
- }
- }
- }
- else if (IsThaiBottomLineChar(curCh))
- {
- /* Bottom line characters */
- iY += interLeaving;
- if (IsThaiBaseLineChar(preCh))
- {
- iX -= ((S32) nWidth + interLeaving);
- if (preCh == 0x0E2C)
- {
- iX -= 2; /* move ahead for 2 pixels */
- }
- }
- }
- else if (IsThaiToneMark(curCh))
- {
- /* Tone marks */
- iY -= 1;
- if (IsThaiBaseLineChar(preCh))
- {
- iX -= ((S32) nWidth + interLeaving);
- if (preCh == 0x0E33)
- {
- iY -= 3; /* move tone mark higher */
- if (IsThaiBaseLineChar(pre2Ch))
- {
- iX -= 7; /* Move tone mark ahead across the width of */
- }
- }
- else if (nextCharUCS2 == 0x0E33)
- {
- iY -= 3; /* move tone mark higher */
- }
- else if (IsThaiLongTailChar(preCh))
- {
- iX -= 3; /* move tone mark ahead for 3 pixel */
- }
- else if (preCh == 0x0E0A || preCh == 0x0E0B)
- {
- iX -= 2;
- }
- else if (preCh == 0x0E2C)
- {
- iX -= 6;
- }
- }
- else if (IsThaiAboveLineChar(preCh))
- {
- iY -= 3;
- iX -= ((S32) nWidth + interLeaving);
- if (IsThaiLongTailChar(pre2Ch))
- {
- iX -= 3;
- }
- else if (pre2Ch == 0x0E0A || pre2Ch == 0x0E0B)
- {
- iX -= 2;
- }
- else if (pre2Ch == 0x0E2C)
- {
- iX -= 6;
- }
- }
- else if (IsThaiBottomLineChar(preCh))
- {
- iX -= ((S32) nWidth + interLeaving);
- if (IsThaiLongTailChar(pre2Ch))
- {
- iX -= 3;
- }
- }
- else if (preCh == 0x0E47 || preCh == 0x0E4C)
- {
- /* move the tone mark to next character space */
- iX += ((S32) nWidth + interLeaving);
- CurrentX += ((S32) nWidth + interLeaving);
- }
- else
- {
- CurrentX += ((S32) nWidth + interLeaving);
- }
- }
- iY += (str_height - nHgt);
- ShowCharFuncDispatch(LineHeight, nWidth, nHgt, iX, iY, Font, BackGround, CharData, NumChar, Bordered);
- }
- else /* non-Thai char */
- {
- if (r2lMMIFlag
- #ifdef __MMI_HINDI_ALG__
- && (!cancelWidth)
- #endif
- )
- {
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(curCh))
- {
- /* PMT START MAUI_00223197 */
- if ((preCh != S_VISARGA) && UI_HINDI_SIGN_RANGE(preCh))
- /* PMT END MAUI_00223197 */
- {
- CurrentX -= 0;
- }
- /* PMT START MAUI_00223197 */
- else if ((curCh != S_VISARGA) && UI_HINDI_SIGN_RANGE(curCh))
- /* PMT END MAUI_00223197 */
- {
- CurrentX -= nWidth;
- }
- else
- {
- CurrentX -= nDWidth;
- }
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- if (!has_thai_char)
- {
- CurrentX -= nWidth;
- }
- }
- /* PMT FARHAD START 20050708 */
- #ifndef __MMI_HINDI_ALG__
- iX = CurrentX;
- #endif
- /* PMT FARHAD END 20050708 */
- iY += (str_height - nHgt);
- ShowCharFuncDispatch(LineHeight, nWidth, nHgt, iX, iY, Font, BackGround, CharData, NumChar, Bordered);
- if (!r2lMMIFlag || has_thai_char)
- {
- CurrentX += nWidth;
- }
- }
- nHgt = (U8) LineHeight;
- pre2Ch = preCh;
- preCh = curCh;
- String += 2;
- /* W05.50 Skip unnecessary action when the character is out of clip */
- if ((iX > clip_x2) && !r2lMMIFlag)
- {
- break;
- }
- }
- gdi_font_end();
- return CurrentX;
- //GDI_RETURN(CurrentX);
- //GDI_EXIT_CRITICAL_SECTION(ShowStackedString)
- }
- /*****************************************************************************
- * FUNCTION
- * ShowStackedChar
- * DESCRIPTION
- *
- * PARAMETERS
- * CurrentX [IN]
- * CurrentY [IN]
- * Font [IN]
- * BackGround [IN]
- * curCh [IN]
- * LineHeight [IN]
- * Bordered [IN]
- * pre2Ch [IN]
- * preCh [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ShowStackedChar(
- S32 CurrentX,
- S32 CurrentY,
- stFontAttribute Font,
- U8 BackGround,
- U16 curCh,
- U32 LineHeight,
- U32 Bordered,
- U16 pre2Ch,
- U16 preCh)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* GDI_ENTER_CRITICAL_SECTION(ShowStackedChar) */
- U8 *CharData;
- U32 NumChar;
- U16 nHgt;
- U16 nWidth;
- #ifdef __MMI_HINDI_ALG__
- U16 nDWidth;
- #endif
- S32 interLeaving = gThaiFontInterSpace;
- S32 iX = CurrentX;
- S32 iY = CurrentY;
- gdi_color border_color = 0, text_color;
- U8 font_attr = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gnCurrentFontAttrib & FONTATTRIB_ITALIC)
- {
- font_attr |= FONTATTRIB_ITALIC;
- }
- else if (gnCurrentFontAttrib & FONTATTRIB_OBLIQUE)
- {
- font_attr |= FONTATTRIB_OBLIQUE;
- }
- if (Font.underline)
- {
- font_attr |= FONTATTRIB_UNDERLINE;
- }
- {
- if (Bordered)
- {
- border_color = gdi_act_color_from_rgb(0xff, UI_text_border_color.r, UI_text_border_color.g, UI_text_border_color.b);
- }
- text_color = gdi_act_color_from_rgb(0xff, UI_current_text_color.r, UI_current_text_color.g, UI_current_text_color.b);
- }
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- mmi_trace_screen_char(CurrentX, CurrentY, curCh, 0, Bordered);
- #endif
- if (FONT_TEST_CONTROL_CHAR(curCh))
- {
- curCh = 0x20;
- }
- #ifdef __MMI_HINDI_ALG__
- NumChar = GetFontdata(curCh, Font, &CharData, &nWidth, &nDWidth, &nHgt);
- #else
- NumChar = GetFontdata(curCh, Font, &CharData, &nWidth, &nHgt);
- #endif
- gdi_font_begin(text_color, font_attr);
- /* adjust iX and iY for Thai characters */
- if (curCh >= 0x0E01 && curCh <= 0x0E7F)
- {
- if (IsThaiBaseLineChar(curCh))
- {
- if (IsThaiLongTailChar(curCh))
- {
- iX += 1;
- }
- //if the current character is 0x0E33 and previous or previous 2 character is base line character, 0x0E33 shall be
- //moved ahead to let the circyle sign on the top of previous or previous2 character
- if (curCh == 0x0E33 && (IsThaiBaseLineChar(preCh) || IsThaiBaseLineChar(pre2Ch)))
- {
- iX -= 1;
- }
- }
- else if (IsThaiAboveLineChar(curCh))
- {
- /* Above line characters */
- iY -= 1; /* Reserver 1 pixtel vertical interleaving */
- if (IsThaiBaseLineChar(preCh))
- {
- /* Process the X coordinate when combining with other base line characters */
- iX -= ((S32) nWidth + interLeaving);
- if (IsThaiLongTailChar(preCh)) /* move ahead 3 pixels, */
- {
- iX -= 3;
- }
- else if (preCh == 0x0E0A || preCh == 0x0E0B)
- {
- iX -= 2;
- }
- else if (preCh == 0x0E2C) /* move ahead 6 pixels */
- {
- iX -= 6;
- }
- }
- }
- else if (IsThaiBottomLineChar(curCh))
- {
- /* Bottom line characters */
- iY += interLeaving;
- if (IsThaiBaseLineChar(preCh))
- {
- iX -= ((S32) nWidth + interLeaving);
- if (preCh == 0x0E2C)
- {
- iX -= 2; /* move ahead for 2 pixels */
- }
- }
- }
- else if (IsThaiToneMark(curCh))
- {
- /* Tone marks */
- iY -= 1;
- if (IsThaiBaseLineChar(preCh))
- {
- iX -= ((S32) nWidth + interLeaving);
- if (preCh == 0x0E33)
- {
- iY -= 3; /* move tone mark higher */
- if (IsThaiBaseLineChar(pre2Ch))
- {
- iX -= 7; /* Move tone mark ahead across the width of */
- }
- }
- //else if(nextCharUCS2 == 0x0E33)
- // iY -= 3;//move tone mark higher
- else if (IsThaiLongTailChar(preCh))
- {
- iX -= 3; /* move tone mark ahead for 3 pixel */
- }
- else if (preCh == 0x0E0A || preCh == 0x0E0B)
- {
- iX -= 2;
- }
- else if (preCh == 0x0E2C)
- {
- iX -= 6;
- }
- }
- else if (IsThaiAboveLineChar(preCh))
- {
- iY -= 3;
- iX -= ((S32) nWidth + interLeaving);
- if (IsThaiLongTailChar(pre2Ch))
- {
- iX -= 3;
- }
- else if (pre2Ch == 0x0E0A || pre2Ch == 0x0E0B)
- {
- iX -= 2;
- }
- else if (pre2Ch == 0x0E2C)
- {
- iX -= 6;
- }
- }
- else if (IsThaiBottomLineChar(preCh))
- {
- iX -= ((S32) nWidth + interLeaving);
- if (IsThaiLongTailChar(pre2Ch))
- {
- iX -= 3;
- }
- }
- else if (preCh == 0x0E47 || preCh == 0x0E4C)
- {
- /* move the tone mark to next character space */
- iX += ((S32) nWidth + interLeaving);
- }
- }
- //(1)Other cases: For Thai digits and base line sign, the only thing we have to do is moving cursor
- //(2)Show Characters
- ShowCharFuncDispatch(LineHeight, nWidth, nHgt, iX, iY, Font, BackGround, CharData, NumChar, Bordered);
- }
- else /* non-Thai char */
- {
- ShowCharFuncDispatch(LineHeight, nWidth, nHgt, iX, iY, Font, BackGround, CharData, NumChar, Bordered);
- }
- gdi_font_end();
- /* GDI_EXIT_CRITICAL_SECTION(ShowStackedChar) */
- }
- const L2RLangSSC l2RLangSSC[] =
- {
- /* PMT START GR_HE_CZ_FI_DA_HU 20051007 */
- SSC_ARABIC,
- SSC_PERSIAN,
- SSC_HEBREW
- /* PMT END GR_HE_CZ_FI_DA_HU 20051007 */
- };
- /*****************************************************************************
- * FUNCTION
- * IsL2RMMIStyle
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- BOOL IsL2RMMIStyle(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 index = 0;
- U8 temp_str1[30];
- U8 temp_str2[30];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AnsiiToUnicodeString((S8*) temp_str1, (S8*) gLanguageArray[gCurrLangIndex].aLangSSC);
- for (index = 0; index < (sizeof(l2RLangSSC) / sizeof(l2RLangSSC[0])); index++)
- {
- AnsiiToUnicodeString((S8*) temp_str2, (S8*) l2RLangSSC[index].sscString);
- /* pTemp = (U8 *) temp_str; */
- if (UCS2Strcmp((const S8*)temp_str1, (const S8*)temp_str2) == 0)
- {
- return MMI_TRUE;
- }
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * ShowDebugString
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * Font [IN]
- * String [?]
- * len [IN]
- * LineHeight [IN]
- * Bordered [IN]
- * RETURNS
- *
- *****************************************************************************/
- U32 ShowDebugString(S32 x, S32 y, stFontAttribute Font, U8 *String, S32 len, U32 LineHeight, U32 Bordered)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* GDI_ENTER_CRITICAL_SECTION(ShowDebugString) */
- U8 *CharData;
- U32 NumChar;
- U32 Counter = 0;
- S32 CurrentX;
- U16 nHgt;
- U16 nWidth;
- S32 nXOffset;
- S32 nYOffset;
- S32 yy;
- U16 unicode = 0;
- #ifdef __MMI_HINDI_ALG__
- U16 nDWidth = 0;
- #endif
- U8 font_attr = 0;
- gdi_color border_color = 0, text_color;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gnCurrentFontAttrib & FONTATTRIB_ITALIC)
- {
- font_attr |= FONTATTRIB_ITALIC;
- }
- else if (gnCurrentFontAttrib & FONTATTRIB_OBLIQUE)
- {
- font_attr |= FONTATTRIB_OBLIQUE;
- }
- if (Font.underline)
- {
- font_attr |= FONTATTRIB_UNDERLINE;
- }
- {
- if (Bordered)
- {
- border_color = gdi_act_color_from_rgb(0xff, UI_text_border_color.r, UI_text_border_color.g, UI_text_border_color.b);
- }
- text_color = gdi_act_color_from_rgb(0xff, UI_current_text_color.r, UI_current_text_color.g, UI_current_text_color.b);
- }
- gdi_font_begin(text_color, font_attr);
- CurrentX = x;
- while (len != 0)
- {
- if ((String[0] == ' ') && (String[1] == ' '))
- {
- break;
- }
- len--;
- unicode = String[0];
- unicode |= (String[1] << 8);
- if (FONT_TEST_CONTROL_CHAR(unicode))
- {
- unicode = 0x20;
- }
- #ifdef __MMI_HINDI_ALG__
- NumChar = GetFontdata(unicode, Font, &CharData, &nWidth, &nDWidth, &nHgt);
- #else
- NumChar = GetFontdata(unicode, Font, &CharData, &nWidth, &nHgt);
- #endif
- Counter++;
- if (LineHeight > 0)
- {
- yy = y + LineHeight - nHgt;
- }
- else
- {
- yy = y;
- }
- nXOffset = CurrentX + nWidth;
- nYOffset = yy + nHgt;
- if (Bordered)
- {
- gdi_show_char_bordered(CurrentX, yy, text_color, border_color, CharData, NumChar, nWidth, nHgt, font_attr);
- }
- else if (!
- (gnCurrentFontAttrib & FONTATTRIB_BOLD &&
- gpCurrentFont->pFontType[gnCurrentFont][gbFontType] & FONTATTRIB_BOLD) ||
- !(gpCurrentFont->pFontType[gnCurrentFont][gbFontType] & FONTATTRIB_NORMAL))
- {
- gdi_show_char(CurrentX, yy, text_color, CharData, NumChar, nWidth, nHgt, font_attr);
- }
- else
- {
- gdi_show_char(CurrentX + 1, yy, text_color, CharData, NumChar, nWidth, nHgt, font_attr);
- gdi_show_char(CurrentX, yy, text_color, CharData, NumChar, nWidth, nHgt, font_attr);
- }
- CurrentX += nWidth;
- nHgt = (U8) LineHeight;
- String += 2;
- }
- gdi_font_end();
- return CurrentX;
- /* GDI_RETURN (CurrentX); */
- /* GDI_EXIT_CRITICAL_SECTION(ShowDebugString) */
- }
- /*-----------------------------------------------------------------------*/
- /*--------------------------- *** End *** -------------------------------*/
- /*-----------------------------------------------------------------------*/