PixcomFontEngine.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:162k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * pixcomfontengine.c
- *
- * Project:
- * --------
- * Maui_Software
- *
- * Description:
- * ------------
- * font engine related function calls
- *
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : PixcomFontengine.c
- PURPOSE : Font Engine
- REMARKS : available font information
- type 1 -> size's 9 to 15.
- type's 2 to 5 -> size's 8 to 15.
- AUTHOR : Anku Jain and Arun Gupta
- DATE : May 25, 2002
- **************************************************************/
- #define FONTENGINE_IRAM_PLACEMENT 0
- #define BORDERED_TEXT_NO_BOUNDARY 1 /* MTK justin */
- #include "stdc.h"
- #include <stdio.h>
- #include <signal.h>
- #include "PixtelDataTypes.h"
- #include "FontRes.h"
- #include "FontDCL.h"
- #include "FontData.h"
- #include "gui_data_types.h"
- #include "DebugInitDef.h"
- #include "MMI_features.h"
- /* MTK Add steven 2006.03.15 */
- #ifdef __MMI_MAINLCD_240X320__
- #include "MTKPropFont20.h"
- #if defined(__MMI_ZI__)
- #if defined(__MMI_ZI_V7__)
- #include "ZiV7ExtraCharacter20.h"
- #else
- #include "ZiExtraCharacter20.h"
- #endif
- #endif /* defined(__MMI_ZI__) */
- #else /* __MMI_MAINLCD_240X320__ */
- #include "MTKPropFont.h"
- #if defined(__MMI_ZI__)
- #if defined(__MMI_ZI_V7__)
- #include "ZiV7ExtraCharacter14.h"
- #else
- #include "ZiExtraCharacter.h"
- #endif
- #endif /* defined(__MMI_ZI__) */
- #endif /* __MMI_MAINLCD_240X320__ */
- /* MTK End */
- #include "gui.h"
- #include "PixcomFontEngine.h"
- #ifdef __MMI_HINDI_ALG__
- #include "gui.h"
- #include "hf_rules.h"
- #endif /* __MMI_HINDI_ALG__ */
- #ifdef __MMI_LANG_VIETNAMESE__
- #include "gui_lang_viet.h"
- #endif
- #include "ATHandlerProt.h"
- #include "gdi_include.h"
- #include "SSCStringHandle.h"
- #include "BIDIDEF.h"
- #include "BIDIProt.h"
- #include "UCS2Prot.h"
- #ifdef __MMI_ZI_V7__
- #include "ezicmn.h"
- #endif
- #if defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__)
- #include "zi8ARshape.h"
- #endif /* defined(__MMI_ZI_ARABIC__) || defined(__MMI_ZI_PERSIAN__) */
- U8 gnCurrentFontAttrib = FONTATTRIB_NORMAL;
- U8 gbFontType = 0;
- U32 gThaiFontInterSpace = 0; /* The new Thai font already has the inter space */
- U32 gThaiLineHeight = 17;
- void SetFontValues(U32 nFont, U8 arrCount);
- /* extern sLanguageDetails gLanguageArray[MAX_LANGUAGES]; */
- extern sLanguageDetails *gLanguageArray;
- extern void gdi_font_begin(gdi_color fg_color, U8 font_attr);
- extern void gdi_font_end(void);
- /* MTK steven for removing compile warnings */
- extern U8(*pfnEncodingSchemeToUnicode) (PU16 pUnicode, PU8 arrOut);
- extern void gdi_show_char_bordered(
- S32 x,
- S32 y,
- gdi_color text_color,
- gdi_color border_color,
- U8 *font_data,
- U32 font_data_size,
- U16 char_width,
- U16 char_height,
- U8 font_attr);
- extern void gdi_show_char(
- S32 x,
- S32 y,
- gdi_color color,
- U8 *font_data,
- U32 font_data_size,
- U16 char_width,
- U16 char_height,
- U8 font_attr);
- extern BOOL r2lMMIFlag;
- #ifdef __MMI_BIDI_ALG__
- extern U8 MMI_bidi_input_type;
- U16 show_pwcWord[MAX_SHOW_STRING_TEXT_LENGTH];
- U8 show_visual_str[MAX_SHOW_STRING_TEXT_LENGTH * BIDI_ENCODING_LENGTH];
- #endif /* __MMI_BIDI_ALG__ */
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- extern MMI_BOOL mmi_trace_screen_string(S32 x, S32 y, U8 *str, S32 len, S32 Bordered);
- extern MMI_BOOL mmi_trace_screen_char(S32 x, S32 y, U16 unicode, S32 len, S32 Bordered);
- #endif
- /* For Font Cache */
- CharHashTable charHashTableLatin[LATIN_CHAR_HT_SIZE];
- CharHashTable charHashTableOthers[OTHERS_CHAR_HT_SIZE];
- /* MTK Add steven 2006.01.06 */
- #ifdef __MMI_MAINLCD_240X320__
- const RangeData gMTKProprietaryFont_RangeData[41]={
- {2,2},
- {108,108},
- {133,134},
- {331,331},
- {593,593},
- {596,596},
- {601,603},
- {609,609},
- {618,618},
- {643,643},
- {650,650},
- {652,652},
- {658,658},
- {711,711},
- {714,716},
- {719,719},
- {729,729},
- {7747,7747},
- {7751,7751},
- {8213,8213},
- {8216,8217},
- {8220,8221},
- {8230,8231},
- {8364,8364},
- {8482,8482},
- {12289,12290},
- {12298,12303},
- {61440,61442},
- {61444,61445},
- {61447,61447},
- {62464,62467},
- {62469,62505},
- {62720,62725},
- {65104,65104},
- {65106,65106},
- {65108,65111},
- {65113,65114},
- {65124,65124},
- {65281,65374},
- {65377,65380},
- {65515,65515},
- };
- const RangeDetails gMTKProprietaryFont_RangeInfo={
- 41,
- gMTKProprietaryFont_RangeData
- };
- sCustFontData gMTKProprietaryFont =
- {
- 20, 20, 0, 50, 500,
- #ifdef __MMI_HINDI_ALG__
- (U8 *) NULL,
- #endif
- (U8 *) MTKProprietaryFont20_Width, (U32 *) MTKProprietaryFont20_Offset, (U8 *) MTKProprietaryFont20_Data,
- (U32 *) MTKProprietaryFont20_RangeOffset,
- {
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},},
- &gMTKProprietaryFont_RangeInfo
- };
- #if defined(__MMI_ZI__)
- #if defined(__MMI_ZI_V7__)
- const RangeData gZiExtraCharacter_RangeData[162] =
- {
- {61184, 61192},
- {61200, 61201},
- {61203, 61203},
- {61206, 61206},
- {61209, 61209},
- {61214, 61214},
- {61217, 61228},
- {61230, 61231},
- {61233, 61238},
- {61243, 61247},
- {61249, 61254},
- {61256, 61256},
- {61259, 61260},
- {61264, 61264},
- {61268, 61270},
- {61274, 61274},
- {61276, 61280},
- {61282, 61282},
- {61287, 61287},
- {61289, 61291},
- {61293, 61293},
- {61295, 61300},
- {61302, 61319},
- {61321, 61322},
- {61324, 61330},
- {61332, 61333},
- {61335, 61337},
- {61339, 61339},
- {61342, 61342},
- {61346, 61347},
- {61349, 61352},
- {61354, 61354},
- {61357, 61358},
- {61360, 61360},
- {61364, 61365},
- {61367, 61367},
- {61369, 61371},
- {61373, 61373},
- {61375, 61376},
- {61378, 61378},
- {61382, 61384},
- {61386, 61386},
- {61389, 61389},
- {61392, 61393},
- {61396, 61396},
- {61399, 61399},
- {61401, 61403},
- {61406, 61407},
- {61411, 61411},
- {61413, 61416},
- {61418, 61418},
- {61421, 61421},
- {61424, 61424},
- {61427, 61427},
- {61431, 61431},
- {61435, 61435},
- {61437, 61442},
- {61445, 61445},
- {61447, 61448},
- {61450, 61450},
- {61452, 61452},
- {61455, 61461},
- {61464, 61464},
- {61466, 61468},
- {61470, 61470},
- {61472, 61474},
- {61477, 61477},
- {61479, 61485},
- {61487, 61487},
- {61491, 61491},
- {61493, 61493},
- {61496, 61498},
- {61501, 61502},
- {61504, 61504},
- {61508, 61509},
- {61511, 61517},
- {61523, 61523},
- {61525, 61525},
- {61530, 61530},
- {61532, 61535},
- {61538, 61538},
- {61540, 61540},
- {61542, 61542},
- {61544, 61545},
- {61547, 61551},
- {61553, 61558},
- {61561, 61561},
- {61563, 61564},
- {61566, 61566},
- {61568, 61568},
- {61570, 61571},
- {61574, 61575},
- {61578, 61582},
- {61586, 61587},
- {61589, 61591},
- {61594, 61595},
- {61597, 61598},
- {61600, 61600},
- {61605, 61606},
- {61609, 61611},
- {61624, 61626},
- {61633, 61633},
- {61635, 61635},
- {61637, 61637},
- {61642, 61642},
- {61656, 61656},
- {61663, 61663},
- {61685, 61685},
- {61688, 61688},
- {61691, 61692},
- {61695, 61695},
- {61703, 61704},
- {61708, 61709},
- {61713, 61713},
- {61715, 61715},
- {61718, 61718},
- {61732, 61732},
- {61743, 61743},
- {61750, 61750},
- {61752, 61752},
- {61754, 61755},
- {61760, 61760},
- {61762, 61762},
- {61764, 61765},
- {61769, 61772},
- {61775, 61775},
- {61787, 61787},
- {61791, 61791},
- {61793, 61793},
- {61795, 61796},
- {61801, 61801},
- {61811, 61811},
- {61815, 61816},
- {61823, 61823},
- {61825, 61825},
- {61836, 61837},
- {61844, 61844},
- {61850, 61850},
- {61872, 61872},
- {61878, 61878},
- {61915, 61915},
- {61924, 61924},
- {61926, 61927},
- {61930, 61930},
- {61938, 61938},
- {61969, 61969},
- {61979, 61979},
- {61989, 61989},
- {61995, 61995},
- {62041, 62041},
- {62043, 62043},
- {62046, 62047},
- {62051, 62051},
- {62067, 62067},
- {62080, 62080},
- {62084, 62084},
- {62090, 62090},
- {62095, 62095},
- {62098, 62098},
- {62213, 62249},
- {62257, 62261},
- {62305, 62330},
- };
- const RangeDetails gZiExtraCharacter_RangeInfo =
- {
- 162,
- gZiExtraCharacter_RangeData
- };
- sCustFontData gZiExtraCharacter =
- {
- 20, 20, 0, 50, 500,
- #ifdef __MMI_HINDI_ALG__
- (U8 *) NULL,
- #endif
- (U8 *) ZiV7ExtraCharacter20_Width, (U32 *) ZiV7ExtraCharacter20_Offset, (U8 *) ZiV7ExtraCharacter20_Data,
- (U32 *) ZiV7ExtraCharacter20_RangeOffset,
- {
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},},
- &gZiExtraCharacter_RangeInfo
- };
- #else /* defined(__MMI_ZI_V7__) */
- const RangeData gZiExtraCharacter_RangeData[5] =
- {
- {61440, 61448},
- {61456, 62398},
- {62469, 62505},
- {62513, 62517},
- {62561, 62586},
- };
- const RangeDetails gZiExtraCharacter_RangeInfo =
- {
- 5,
- gZiExtraCharacter_RangeData
- };
- sCustFontData gZiExtraCharacter =
- {
- 20, 20, 0, 50, 500,
- #ifdef __MMI_HINDI_ALG__
- (U8 *) NULL,
- #endif
- (U8 *) ZiExtraCharacter20_Width, (U32 *) ZiExtraCharacter20_Offset, (U8 *) ZiExtraCharacter20_Data,
- (U32 *) ZiExtraCharacter20_RangeOffset,
- {
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},},
- &gZiExtraCharacter_RangeInfo
- };
- #endif /* defined(__MMI_ZI_V7__) */
- #endif /* defined(__MMI_ZI__) */
- #else /* __MMI_MAINLCD_240X320__ */ /* not defined __MMI_MAINLCD_240X320__ */
- const RangeData gMTKProprietaryFont_RangeData[42]={
- {2,2},
- {133,134},
- {230,230},
- {240,240},
- {331,331},
- {593,593},
- {596,596},
- {601,603},
- {609,609},
- {618,618},
- {643,643},
- {650,650},
- {652,652},
- {658,658},
- {711,711},
- {714,716},
- {719,719},
- {729,729},
- {7735,7735},
- {7747,7747},
- {7751,7751},
- {8213,8213},
- {8216,8217},
- {8220,8221},
- {8230,8231},
- {8364,8364},
- {8482,8482},
- {12289,12290},
- {12298,12303},
- {61440,61442},
- {61444,61445},
- {61447,61447},
- {62464,62467},
- {62720,62725},
- {65104,65104},
- {65106,65106},
- {65108,65111},
- {65113,65114},
- {65124,65125},
- {65281,65374},
- {65377,65380},
- {65515,65515},
- };
- const RangeDetails gMTKProprietaryFont_RangeInfo={
- 42,
- gMTKProprietaryFont_RangeData
- };
- sCustFontData gMTKProprietaryFont =
- {
- 14, 14, 0, 25, 500,
- #ifdef __MMI_HINDI_ALG__
- (U8 *) NULL,
- #endif
- (U8 *) MTKProprietaryFont_Width, (U32 *) MTKProprietaryFont_Offset, (U8 *) MTKProprietaryFont_Data,
- (U32 *) MTKProprietaryFont_RangeOffset,
- {
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},},
- &gMTKProprietaryFont_RangeInfo
- };
- #if defined(__MMI_ZI__)
- #if defined(__MMI_ZI_V7__)
- const RangeData gZiExtraCharacter_RangeData[162] =
- {
- {61184, 61192},
- {61200, 61201},
- {61203, 61203},
- {61206, 61206},
- {61209, 61209},
- {61214, 61214},
- {61217, 61228},
- {61230, 61231},
- {61233, 61238},
- {61243, 61247},
- {61249, 61254},
- {61256, 61256},
- {61259, 61260},
- {61264, 61264},
- {61268, 61270},
- {61274, 61274},
- {61276, 61280},
- {61282, 61282},
- {61287, 61287},
- {61289, 61291},
- {61293, 61293},
- {61295, 61300},
- {61302, 61319},
- {61321, 61322},
- {61324, 61330},
- {61332, 61333},
- {61335, 61337},
- {61339, 61339},
- {61342, 61342},
- {61346, 61347},
- {61349, 61352},
- {61354, 61354},
- {61357, 61358},
- {61360, 61360},
- {61364, 61365},
- {61367, 61367},
- {61369, 61371},
- {61373, 61373},
- {61375, 61376},
- {61378, 61378},
- {61382, 61384},
- {61386, 61386},
- {61389, 61389},
- {61392, 61393},
- {61396, 61396},
- {61399, 61399},
- {61401, 61403},
- {61406, 61407},
- {61411, 61411},
- {61413, 61416},
- {61418, 61418},
- {61421, 61421},
- {61424, 61424},
- {61427, 61427},
- {61431, 61431},
- {61435, 61435},
- {61437, 61442},
- {61445, 61445},
- {61447, 61448},
- {61450, 61450},
- {61452, 61452},
- {61455, 61461},
- {61464, 61464},
- {61466, 61468},
- {61470, 61470},
- {61472, 61474},
- {61477, 61477},
- {61479, 61485},
- {61487, 61487},
- {61491, 61491},
- {61493, 61493},
- {61496, 61498},
- {61501, 61502},
- {61504, 61504},
- {61508, 61509},
- {61511, 61517},
- {61523, 61523},
- {61525, 61525},
- {61530, 61530},
- {61532, 61535},
- {61538, 61538},
- {61540, 61540},
- {61542, 61542},
- {61544, 61545},
- {61547, 61551},
- {61553, 61558},
- {61561, 61561},
- {61563, 61564},
- {61566, 61566},
- {61568, 61568},
- {61570, 61571},
- {61574, 61575},
- {61578, 61582},
- {61586, 61587},
- {61589, 61591},
- {61594, 61595},
- {61597, 61598},
- {61600, 61600},
- {61605, 61606},
- {61609, 61611},
- {61624, 61626},
- {61633, 61633},
- {61635, 61635},
- {61637, 61637},
- {61642, 61642},
- {61656, 61656},
- {61663, 61663},
- {61685, 61685},
- {61688, 61688},
- {61691, 61692},
- {61695, 61695},
- {61703, 61704},
- {61708, 61709},
- {61713, 61713},
- {61715, 61715},
- {61718, 61718},
- {61732, 61732},
- {61743, 61743},
- {61750, 61750},
- {61752, 61752},
- {61754, 61755},
- {61760, 61760},
- {61762, 61762},
- {61764, 61765},
- {61769, 61772},
- {61775, 61775},
- {61787, 61787},
- {61791, 61791},
- {61793, 61793},
- {61795, 61796},
- {61801, 61801},
- {61811, 61811},
- {61815, 61816},
- {61823, 61823},
- {61825, 61825},
- {61836, 61837},
- {61844, 61844},
- {61850, 61850},
- {61872, 61872},
- {61878, 61878},
- {61915, 61915},
- {61924, 61924},
- {61926, 61927},
- {61930, 61930},
- {61938, 61938},
- {61969, 61969},
- {61979, 61979},
- {61989, 61989},
- {61995, 61995},
- {62041, 62041},
- {62043, 62043},
- {62046, 62047},
- {62051, 62051},
- {62067, 62067},
- {62080, 62080},
- {62084, 62084},
- {62090, 62090},
- {62095, 62095},
- {62098, 62098},
- {62213, 62249},
- {62257, 62261},
- {62305, 62330},
- };
- const RangeDetails gZiExtraCharacter_RangeInfo =
- {
- 162,
- gZiExtraCharacter_RangeData
- };
- sCustFontData gZiExtraCharacter =
- {
- 14, 14, 0, 25, 500,
- #ifdef __MMI_HINDI_ALG__
- (U8 *) NULL,
- #endif
- (U8 *) ZiV7ExtraCharacter14_Width, (U32 *) ZiV7ExtraCharacter14_Offset, (U8 *) ZiV7ExtraCharacter14_Data,
- (U32 *) ZiV7ExtraCharacter14_RangeOffset,
- {
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},},
- &gZiExtraCharacter_RangeInfo
- };
- #else /* defined(__MMI_ZI_V7__) */
- const RangeData gZiExtraCharacter_RangeData[5] =
- {
- {322, 322},
- {341, 341},
- {352, 352},
- {61440, 61448},
- {61456, 62398},
- };
- const RangeDetails gZiExtraCharacter_RangeInfo =
- {
- 5,
- gZiExtraCharacter_RangeData
- };
- sCustFontData gZiExtraCharacter =
- {
- 14, 14, 0, 25, 500,
- #ifdef __MMI_HINDI_ALG__
- (U8 *) NULL,
- #endif
- (U8 *) ZiExtraCharacter_Width, (U32 *) ZiExtraCharacter_Offset, (U8 *) ZiExtraCharacter_Data,
- (U32 *) ZiExtraCharacter_RangeOffset,
- {
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},
- {FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH,
- FONTATTRIB_NORMAL | FONTATTRIB_BOLD | FONTATTRIB_ITALIC | FONTATTRIB_OBLIQUE | FONTATTRIB_UNDERLINE |
- FONTATTRIB_STRIKETHROUGH},},
- &gZiExtraCharacter_RangeInfo
- };
- #endif /* defined(__MMI_ZI_V7__) */
- #endif /* defined(__MMI_ZI__) */
- #endif /* __MMI_MAINLCD_240X320__ */
- /* MTK End */
- U32 gnCurrentFont;
- sCustFontData *gpCurrentFont = NULL;
- extern U16 gMaxDeployedLangs;
- extern U16 gCurrLangIndex;
- #ifdef __UCS2_ENCODING
- U8 UCS2EncodingToUnicode(PU16 pUnicode, PU8 arr);
- #endif
- /**************************************************************/
- extern void text_drawpixel2(S32 x, S32 y);
- extern color UI_current_text_color;
- extern color UI_text_border_color;
- /* extern color UI_text_color; */
- extern void (*_ui_text_putpixel) (S32 x, S32 y, color c);
- extern void (*_ui_text_putpixel_unconditional) (S32 x, S32 y, color c);
- extern void UI_set_current_text_color(color c);
- /*****************************************************************************
- * FUNCTION
- * Get_Current_Lang_CountryCode
- * DESCRIPTION
- * To get current language's country code
- *
- * This is used to get current language's country code
- * PARAMETERS
- * void
- * RETURNS
- * U8 *
- *****************************************************************************/
- U8 *Get_Current_Lang_CountryCode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (U8*) gLanguageArray[gCurrLangIndex].aLangCountryCode;
- }
- /*****************************************************************************
- * FUNCTION
- * SetFont
- * DESCRIPTION
- * To set the fonts.
- *
- * This is used to set all different type of font with different sizes.
- * PARAMETERS
- * Font [IN]
- * arrCount [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 SetFont(stFontAttribute Font, U8 arrCount)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gnCurrentFont = Font.size;
- gbFontType = Font.smallCaps;
- gnCurrentFontAttrib = 0;
- if (gbFontType != 0)
- {
- gbFontType = 0;
- }
- if (Font.bold)
- {
- gnCurrentFontAttrib |= FONTATTRIB_BOLD;
- }
- if (Font.italic)
- {
- gnCurrentFontAttrib |= FONTATTRIB_ITALIC;
- }
- if (Font.oblique)
- {
- gnCurrentFontAttrib |= FONTATTRIB_OBLIQUE;
- }
- if (Font.underline)
- {
- gnCurrentFontAttrib |= FONTATTRIB_UNDERLINE;
- }
- if (!gnCurrentFontAttrib)
- {
- gnCurrentFontAttrib |= FONTATTRIB_NORMAL;
- }
- SetFontValues(gnCurrentFont, arrCount);
- return 0;
- }
- /*****************************************************************************
- * FUNCTION
- * SetFontValues
- * DESCRIPTION
- *
- * PARAMETERS
- * nFont [IN]
- * arrCount [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetFontValues(U32 nFont, U8 arrCount)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((gLanguageArray[arrCount].fontfamilyList[gLanguageArray[arrCount].nCurrentFamily]->nTotalFonts) > nFont)
- {
- gpCurrentFont =
- gLanguageArray[arrCount].fontfamilyList[gLanguageArray[arrCount].nCurrentFamily]->fontData[nFont];
- }
- else
- {
- gpCurrentFont = gLanguageArray[arrCount].fontfamilyList[gLanguageArray[arrCount].nCurrentFamily]->fontData[0];
- }
- }
- #if(FONTENGINE_IRAM_PLACEMENT)
- #ifdef __MTK_TARGET__
- #pragma arm section code
- #endif
- #endif /* (FONTENGINE_IRAM_PLACEMENT) */
- #if defined(__MMI_ZI__)
- /*****************************************************************************
- * FUNCTION
- * SearchInZiExtraFont
- * DESCRIPTION
- * To search a character in the Zi Extra font
- *
- * This function applies binary search assuming that the RangeList
- * array is sorted ina scending order and no ranges overlap.
- * PARAMETERS
- * nCh [IN]
- * pnBase [OUT] Returns the base
- * RETURNS
- * S32 - The offset of the character in the Range table
- *****************************************************************************/
- S32 SearchInZiExtraFont(U32 nCh, U32 *pnBase)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 nFirst = 0;
- S16 nLast = gZiExtraCharacter.pRangeDetails->nNoOfRanges - 1;
- S16 nMid;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (nLast >= nFirst)
- {
- nMid = (nFirst + nLast) / 2;;
- if ((nCh >= gZiExtraCharacter_RangeData[nMid].nMin) && (nCh <= gZiExtraCharacter_RangeData[nMid].nMax))
- {
- *pnBase = gZiExtraCharacter_RangeData[nMid].nMin;
- return gZiExtraCharacter.pRange[nMid];
- }
- if (nCh > gZiExtraCharacter_RangeData[nMid].nMin)
- {
- nFirst = nMid + 1;
- }
- else
- {
- nLast = nMid - 1;
- }
- }
- return -1;
- }
- #endif /* defined(__MMI_ZI__) */
- /**************************************************************
- FUNCTION NAME : GetFontdata()
- PURPOSE : To get the font information.
- INPUT PARAMETERS : U32 Ch, stFontAttribute Font, U8 *CharData
- OUTPUT PARAMETERS : nil
- RETURNS : UNIT32
- REMARKS : This is used to get the font information
- **************************************************************/
- #ifdef __MMI_HINDI_ALG__
- static U32 GetFontdata(U32 Ch, stFontAttribute Font, U8 **ppCharData, U16 *pnWidth, U16 *pnDWidth, U16 *pnHeight)
- #else
- static U32 GetFontdata(U32 Ch, stFontAttribute Font, U8 **ppCharData, U16 *pnWidth, U16 *pnHeight)
- #endif
- {
- U8 count;
- S32 NumChar = 0;
- S32 index = -1;
- S32 nFontIndex = -1;
- U32 nIndexInList;
- U32 nBase;
- U32 nHashKey = 0;
- CharHashTable *charHashTable;
- #ifdef __MMI_HINDI_ALG__
- sCustFontData *CurrentFont = gpCurrentFont;
- *pnDWidth = 0;
- #endif /* __MMI_HINDI_ALG__ */
- if (Ch & 0xFF00)
- {
- charHashTable = charHashTableOthers;
- nHashKey = Ch & OTHERS_CHAR_HT_MASK;
- }
- else
- {
- charHashTable = charHashTableLatin;
- nHashKey = Ch & LATIN_CHAR_HT_MASK;
- }
- if (charHashTable[nHashKey].unicode == Ch && charHashTable[nHashKey].gnCurrentFont == gnCurrentFont)
- {
- *ppCharData = charHashTable[nHashKey].CharData;
- *pnWidth = charHashTable[nHashKey].Width;
- *pnHeight = charHashTable[nHashKey].Height;
- #ifdef __MMI_HINDI_ALG__
- *pnDWidth = charHashTable[nHashKey].DWidth;
- #endif
- return charHashTable[nHashKey].NumChar;
- }
- charHashTable[nHashKey].unicode = Ch;
- GetLangIndex(&count, &nFontIndex, &index, Ch, &nBase);
- charHashTable[nHashKey].count = count;
- charHashTable[nHashKey].gnCurrentFont = gnCurrentFont;
- charHashTable[nHashKey].index = index;
- if (index > -1)
- {
- /* Comments : No error handling is being done if some characters come that is not
- currently supported then nothing can be displayed */
- SetFontValues(gnCurrentFont, count);
- charHashTable[nHashKey].Width = *pnWidth = gpCurrentFont->nWidth;
- charHashTable[nHashKey].Height = *pnHeight = gpCurrentFont->nHeight;
- if (gpCurrentFont->nEquiDistant)
- {
- charHashTable[nHashKey].NumChar = NumChar = gpCurrentFont->nCharBytes;
- nIndexInList = index + (NumChar * (Ch - nBase));
- charHashTable[nHashKey].CharData = *ppCharData = (gpCurrentFont->pDataArray + nIndexInList);
- }
- else
- {
- nIndexInList = index + (Ch - nBase);
- charHashTable[nHashKey].Width = *pnWidth = gpCurrentFont->pWidthArray[nIndexInList];
- charHashTable[nHashKey].NumChar = NumChar =
- (gpCurrentFont->pOffsetArray[nIndexInList + 1] - gpCurrentFont->pOffsetArray[nIndexInList]);
- charHashTable[nHashKey].CharData = *ppCharData =
- (gpCurrentFont->pDataArray + gpCurrentFont->pOffsetArray[nIndexInList]);
- }
- #ifdef __MMI_HINDI_ALG__
- if (gpCurrentFont->pDWidthArray)
- charHashTable[nHashKey].DWidth = *pnDWidth = gpCurrentFont->pDWidthArray[nIndexInList];
- gpCurrentFont = CurrentFont;
- #endif /* __MMI_HINDI_ALG__ */
- return NumChar;
- }
- else
- {
- /* MTK Add Steven 2005.06.03 */
- #if defined(__MMI_ZI__)
- index = SearchInZiExtraFont(Ch, &nBase);
- #else
- index = SearchInPropFont(Ch, &nBase);
- #endif
- if (index == -1)
- {
- #if defined(__MMI_ZI__)
- index = SearchInPropFont(Ch, &nBase);
- if (index == -1)
- {
- #endif /* defined(__MMI_ZI__) */
- Ch = 65515; /* 0x4E01;//0x000F; */
- index = SearchInPropFont(Ch, &nBase);
- if (index == -1)
- {
- #ifdef __MMI_HINDI_ALG__
- gpCurrentFont = CurrentFont;
- #endif
- return NumChar;
- }
- #if defined(__MMI_ZI__)
- }
- charHashTable[nHashKey].Height = *pnHeight = gMTKProprietaryFont.nHeight;
- nIndexInList = index + (Ch - nBase);
- charHashTable[nHashKey].Width = *pnWidth = gMTKProprietaryFont.pWidthArray[nIndexInList];
- charHashTable[nHashKey].NumChar = NumChar =
- (gMTKProprietaryFont.pOffsetArray[nIndexInList + 1] - gMTKProprietaryFont.pOffsetArray[nIndexInList]);
- charHashTable[nHashKey].CharData = *ppCharData =
- (gMTKProprietaryFont.pDataArray + gMTKProprietaryFont.pOffsetArray[nIndexInList]);
- goto label_out;
- #endif /* defined(__MMI_ZI__) */
- }
- #if defined(__MMI_ZI__)
- charHashTable[nHashKey].Height = *pnHeight = gZiExtraCharacter.nHeight;
- nIndexInList = index + (Ch - nBase);
- charHashTable[nHashKey].Width = *pnWidth = gZiExtraCharacter.pWidthArray[nIndexInList];
- charHashTable[nHashKey].NumChar = NumChar =
- (gZiExtraCharacter.pOffsetArray[nIndexInList + 1] - gZiExtraCharacter.pOffsetArray[nIndexInList]);
- charHashTable[nHashKey].CharData = *ppCharData =
- (gZiExtraCharacter.pDataArray + gZiExtraCharacter.pOffsetArray[nIndexInList]);
- label_out:;
- #else /* defined(__MMI_ZI__) */
- charHashTable[nHashKey].Height = *pnHeight = gMTKProprietaryFont.nHeight;
- nIndexInList = index + (Ch - nBase);
- charHashTable[nHashKey].Width = *pnWidth = gMTKProprietaryFont.pWidthArray[nIndexInList];
- charHashTable[nHashKey].NumChar = NumChar =
- (gMTKProprietaryFont.pOffsetArray[nIndexInList + 1] - gMTKProprietaryFont.pOffsetArray[nIndexInList]);
- charHashTable[nHashKey].CharData = *ppCharData =
- (gMTKProprietaryFont.pDataArray + gMTKProprietaryFont.pOffsetArray[nIndexInList]);
- #endif /* defined(__MMI_ZI__) */
- /* MTK End */
- }
- #ifdef __MMI_HINDI_ALG__
- gpCurrentFont = CurrentFont;
- #endif
- return NumChar;
- }
- /**************************************************************
- FUNCTION NAME : GetLangIndex()
- PURPOSE : To get the language index of the character.
- INPUT PARAMETERS : U32 nCh - Character to look for
- OUTPUT PARAMETERS : U8* pCount - The langugae Index
- S32* pnIndex - The offset of the character in the array
- U32* pnBase - Base of Character set
- RETURNS : void
- REMARKS : Gets the character information
- **************************************************************/
- void GetLangIndex(U8 * pCount, S32 * pnFontIndex, S32 * pnIndex, U32 nCh, U32 * pnBase)
- {
- /* first check the index in the current language. 90% of the cases strings will be from current language */
- U16 nFontCount;
- sFontFamily *pFontFamily;
- U16 nFontAttrib = gnCurrentFontAttrib;
- *pCount = 0;
- while (*pCount < gMaxDeployedLangs)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pFontFamily = gLanguageArray[*pCount].fontfamilyList[gLanguageArray[*pCount].nCurrentFamily];
- nFontCount = 0;
- if (gnCurrentFontAttrib & FONTATTRIB_BOLD && (U32) (pFontFamily->fontData[nFontCount]->pFontType[gnCurrentFont][gbFontType] & FONTATTRIB_BOLD)) /* this will test for bold font.. which ever font is bold will betaken */
- /* bold is super set. If font is displayed for bold and italic then the bold font will be made as italic */
- {
- nFontAttrib = FONTATTRIB_BOLD;
- }
- else
- {
- nFontAttrib &= ~FONTATTRIB_BOLD;
- if (!nFontAttrib)
- {
- nFontAttrib |= FONTATTRIB_NORMAL;
- }
- }
- while (nFontCount < pFontFamily->nTotalFonts)
- {
- if ((U32) (pFontFamily->fontData[nFontCount]->pFontType[gnCurrentFont][gbFontType] & nFontAttrib))
- {
- if (nCh >= pFontFamily->fontData[nFontCount]->pRangeDetails->pRangeData[0].nMin &&
- nCh <=
- pFontFamily->fontData[nFontCount]->pRangeDetails->pRangeData[pFontFamily->fontData[nFontCount]->
- pRangeDetails->nNoOfRanges - 1].nMax)
- {
- *pnIndex = SearchIndexinList(*pCount, nFontCount, nCh, pnBase);
- if (*pnIndex == -1)
- {
- ++nFontCount;
- }
- else
- {
- gpCurrentFont = pFontFamily->fontData[nFontCount];
- *pnFontIndex = nFontCount;
- return;
- }
- } /* if(nCh>=pFontFamily->fontData[nFontCount].pRangeData[0].nMin && */
- else
- {
- ++nFontCount;
- }
- }
- else
- {
- ++nFontCount;
- }
- } /* while(nFontCount < pFontFamily->nTotalFonts) */
- ++(*pCount);
- } /* while(*pCount < gMaxDeployedLangs) */
- if (*pnIndex == -1)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- }
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * SearchIndexinList
- * DESCRIPTION
- * To search index and base of the character in a language.
- *
- * This function applies binary search assuming that the RangeList
- * array is sorted ina scending order and no ranges overlap.
- * PARAMETERS
- * nListIndex [IN]
- * nFontCount [IN]
- * nCh [IN]
- * pnBase [OUT] Returns the base
- * RETURNS
- * S32 - The offset of the character in the Range table
- *****************************************************************************/
- S32 SearchIndexinList(U8 nListIndex, U16 nFontCount, U32 nCh, U32 *pnBase)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 nFirst = 0;
- S16 nLast =
- gLanguageArray[nListIndex].fontfamilyList[gLanguageArray[nListIndex].nCurrentFamily]->fontData[nFontCount]->
- pRangeDetails->nNoOfRanges - 1;
- const RangeData *pRangeData =
- gLanguageArray[nListIndex].fontfamilyList[gLanguageArray[nListIndex].nCurrentFamily]->fontData[nFontCount]->
- pRangeDetails->pRangeData;
- U32 *pRange =
- gLanguageArray[nListIndex].fontfamilyList[gLanguageArray[nListIndex].nCurrentFamily]->fontData[nFontCount]->
- pRange;
- S16 nMid;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (nLast >= nFirst)
- {
- nMid = (nFirst + nLast) / 2;;
- if ((nCh >= pRangeData[nMid].nMin) && (nCh <= pRangeData[nMid].nMax))
- {
- *pnBase = pRangeData[nMid].nMin;
- return pRange[nMid];
- }
- if (nCh > pRangeData[nMid].nMin)
- {
- nFirst = nMid + 1;
- }
- else
- {
- nLast = nMid - 1;
- }
- }
- return -1;
- }
- /*****************************************************************************
- * FUNCTION
- * SearchInPropFont
- * DESCRIPTION
- * To search a character in the properitory font
- *
- * This function applies binary search assuming that the RangeList
- * array is sorted ina scending order and no ranges overlap.
- * PARAMETERS
- * nCh [IN]
- * pnBase [OUT] Returns the base
- * RETURNS
- * S32 - The offset of the character in the Range table
- *****************************************************************************/
- S32 SearchInPropFont(U32 nCh, U32 *pnBase)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 nFirst = 0;
- S16 nLast = gMTKProprietaryFont.pRangeDetails->nNoOfRanges - 1;
- S16 nMid;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while (nLast >= nFirst)
- {
- nMid = (nFirst + nLast) / 2;;
- if ((nCh >= gMTKProprietaryFont_RangeData[nMid].nMin) && (nCh <= gMTKProprietaryFont_RangeData[nMid].nMax))
- {
- *pnBase = gMTKProprietaryFont_RangeData[nMid].nMin;
- return gMTKProprietaryFont.pRange[nMid];
- }
- if (nCh > gMTKProprietaryFont_RangeData[nMid].nMin)
- {
- nFirst = nMid + 1;
- }
- else
- {
- nLast = nMid - 1;
- }
- }
- return -1;
- }
- /*****************************************************************************
- * FUNCTION
- * ShowString
- * DESCRIPTION
- * To display a string in the screen
- *
- * This is used to display the string in the screen
- * PARAMETERS
- * x [IN]
- * y [IN]
- * Font [IN]
- * BackGround [IN]
- * String [?]
- * LineHeight [IN]
- * NumChar(?) [IN]
- * CharData(?) [IN]
- * Background(?) [IN]
- * RETURNS
- * UNIT32
- *****************************************************************************/
- /* START FARHAD PMT 20050211 */
- BOOL cancelWidth = 0;
- #ifndef __MMI_LANG_THAI__ /* Remove compile warnings */
- /* START TARUN PMT 20050128 */
- extern color UI_text_color;
- #ifdef __MMI_HINDI_ALG__
- /* END FARHAD PMT 20050211 */
- static U32 ShowString_internal(S32 x, S32 y, stFontAttribute Font, U8 BackGround, U8 *String, S32 len, U32 LineHeight,
- U32 Bordered)
- #else /* __MMI_HINDI_ALG__ */
- static U32 ShowString_internal(S32 x, S32 y, stFontAttribute Font, U8 *String, S32 len, U32 LineHeight, U32 Bordered)
- #endif /* __MMI_HINDI_ALG__ */
- {
- //W05.38 Remove GDI_ENTER_CRITICAL_SECTION outside GDI
- //GDI_ENTER_CRITICAL_SECTION(ShowString_internal)
- U8 *CharData;
- U32 NumChar;
- U32 Counter = 0;
- S32 CurrentX;
- U16 nHgt;
- U16 nWidth;
- #ifdef __MMI_HINDI_ALG__
- U16 nDWidth;
- #endif
- S32 nXOffset;
- S32 nYOffset;
- S32 yy;
- U16 unicode = 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__) */
- /* START TARUN PMT 20050128 */
- #ifdef __MMI_HINDI_ALG__
- static S32 single_time_bidi = 0; /* added farhad 20012004 */
- /* START FARHAD PMT 20050211 */
- static S32 hindi_rule_string = 1;
- /* END FARHAD PMT 20050211 */
- #endif /* __MMI_HINDI_ALG__ */
- /* END TARUN PMT 20050128 */
- U8 font_attr = 0;
- gdi_color border_color = 0, text_color;
- S32 clip_x1, clip_y1, clip_x2, clip_y2;
- #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__ */
- gdi_layer_get_clip(&clip_x1, &clip_y1, &clip_x2, &clip_y2);
- if (len == 0)
- return 1;
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- mmi_trace_screen_string(x, y, String, len, Bordered);
- #endif
- /* START TARUN PMT 20050128 */
- #ifdef __MMI_HINDI_ALG__
- if (!single_time_bidi && !cancelWidth) /* added farhad 20012004 */
- #endif
- { /* added farhad 20012005 */
- /* END TARUN PMT 20050128 */
- #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 */
- //START FARHAD PMT 20050211 : For hindi character sudden disappear
- //UI_current_text_color = UI_text_color;
- //END FARHAD PMT 20050211
- 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;
- #ifdef __MMI_HINDI_ALG__
- if (hf_is_reset_hindi_params())
- reset_hindi_params();
- if (Font.color == 0)
- Font.color = 15;
- //START FARHAD PMT 20050211
- //START TARUN 20041123 : For hindi character sudden disappear
- //UI_current_text_color = UI_text_color;
- //END TARUN 20041123
- if (hf_is_hindi_rules_parsing() && hindi_rule_string)
- /* END FARHAD PMT 20050211 */
- {
- 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;
- 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();
- /* START TARUN PMT 20050128 */
- single_time_bidi = 1; /* added farhad 20012004 */
- /* END TARUN PMT 20050128 */
- 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);
- ShowString_internal(x, y, Font, BackGround, (U8 *) glyph_output, len, LineHeight, Bordered);
- Get_StringWidthHeight((U8 *) glyph_output, &width, &height);
- /* START TARUN PMT 20050128 */
- if (r2lMMIFlag)
- x -= width;
- else
- x += width;
- /* END TARUN PMT 20050128 */
- }
- } while (cluster_length);
- hf_enable_hindi_rules_parsing();
- hf_enable_hindi_reset_hindi_params();
- /* START TARUN PMT 20050128 */
- single_time_bidi = 0; /* added farhad 20012004 */
- /* END TARUN PMT 20050128 */
- gdi_font_end();
- return 0;
- /* GDI_RETURN(0); */
- }
- /* START FARHAD PMT 20050211 */
- hindi_rule_string = 1;
- /* END FARHAD PMT 20050211 */
- #endif /* __MMI_HINDI_ALG__ */
- while (len != 0)
- {
- /* START FARHAD PMT 20050211 */
- U16 prev_unicode = 0;
- /* END FARHAD PMT 20050211 */
- if ((String[0] == ' ') && (String[1] == ' '))
- break;
- len--;
- /* START FARHAD PMT 20050211 */
- prev_unicode = unicode;
- /* END FARHAD PMT 20050211 */
- unicode = String[0];
- unicode |= (String[1] << 8);
- if (FONT_TEST_CONTROL_CHAR(unicode))
- unicode = 0x20;
- #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__) */
- #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;
- /* START TARUN PMT 20050128 */
- if (r2lMMIFlag
- #ifdef __MMI_HINDI_ALG__
- && (!cancelWidth)
- #endif
- )
- {
- #ifdef __MMI_HINDI_ALG__
- /* START FARHAD PMT 20050211 */
- if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
- {
- /* PMT START MAUI_00223197 */
- if ((prev_unicode != S_VISARGA) && UI_HINDI_SIGN_RANGE(prev_unicode))
- /* PMT END MAUI_00223197 */
- CurrentX -= 0;
- else if (UI_HINDI_SIGN_RANGE(unicode))
- CurrentX -= nWidth;
- else
- CurrentX -= nDWidth;
- }
- else
- #endif /* __MMI_HINDI_ALG__ */
- /* END FARHAD PMT 20050211 */
- CurrentX -= nWidth;
- }
- /* END TARUN PMT 20050128 */
- nXOffset = CurrentX + nWidth;
- nYOffset = yy + nHgt;
- /* START TARUN PMT 20050128 */
- #if defined(__MMI_HINDI_ALG__)
- if (cancelWidth || !r2lMMIFlag)
- get_text_x(&CurrentX, unicode, yy, nDWidth, nWidth);
- #endif /* defined(__MMI_HINDI_ALG__) */
- /* END TARUN PMT 20050128 */
- 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);
- }
- if (!r2lMMIFlag)
- CurrentX += nWidth;
- nHgt = (U8) LineHeight;
- String += 2;
- /* W05.50 Skip unnecessary action when the character is out of clip */
- if ((CurrentX > clip_x2) && !r2lMMIFlag)
- break;
- }
- gdi_font_end();
- /* GDI_RETURN (CurrentX); */
- /* GDI_EXIT_CRITICAL_SECTION(ShowString_internal) */
- return CurrentX;
- }
- #endif /* __MMI_LANG_THAI__ */
- U32 ShowString_n(U32 x_unsigned, U32 y_unsigned, stFontAttribute Font, U8 BackGround, U8 *String, int Len,
- U32 LineHeight)
- {
- #if defined(__MMI_LANG_THAI__)
- return ShowStackedString(x_unsigned, y_unsigned, Font, BackGround, String, LineHeight, 0, Len);
- #elif defined(__MMI_LANG_HINDI__)
- /* START TARUN PMT 20050128 */
- return ShowString_internal(x_unsigned, y_unsigned, Font, BackGround, String, Len, LineHeight, FALSE);
- /* END TARUN PMT 20050128 */
- #else
- return ShowString_internal(x_unsigned, y_unsigned, Font, String, Len, LineHeight, FALSE);
- #endif
- }
- U32 ShowString(S32 x, S32 y, stFontAttribute Font, U8 BackGround, U8 *String, U32 LineHeight)
- {
- #if defined(__MMI_LANG_THAI__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return ShowStackedString(x, y, Font, BackGround, String, LineHeight, 0, -1);
- #elif defined(__MMI_LANG_HINDI__)
- /* START TARUN PMT 20050128 */
- return ShowString_internal(x, y, Font, BackGround, String, -1, LineHeight, 0);
- /* END TARUN PMT 20050128 */
- #else
- return ShowString_internal(x, y, Font, String, -1, LineHeight, 0);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * ShowStringBordered
- * DESCRIPTION
- *
- * PARAMETERS
- * x [IN]
- * y [IN]
- * Font [IN]
- * BackGround [IN]
- * String [?]
- * LineHeight [IN]
- * RETURNS
- *
- *****************************************************************************/
- U32 ShowStringBordered(S32 x, S32 y, stFontAttribute Font, U8 BackGround, U8 *String, U32 LineHeight)
- {
- #if defined(__MMI_LANG_THAI__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return ShowStackedString(x, y, Font, BackGround, String, LineHeight, 1, -1);
- #elif defined(__MMI_LANG_HINDI__)
- /* START TARUN PMT 20050128 */
- return ShowString_internal(x, y, Font, BackGround, String, -1, LineHeight, 1);
- /* END TARUN PMT 20050128 */
- #else
- return ShowString_internal(x, y, Font, String, -1, LineHeight, 1);
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * ShowStringBordered_n
- * DESCRIPTION
- *
- * PARAMETERS
- * x_unsigned [IN]
- * y_unsigned [IN]
- * Font [IN]
- * BackGround [IN]
- * String [?]
- * Len [IN]
- * LineHeight [IN]
- * RETURNS
- *
- *****************************************************************************/
- U32 ShowStringBordered_n(
- U32 x_unsigned,
- U32 y_unsigned,
- stFontAttribute Font,
- U8 BackGround,
- U8 *String,
- int Len,
- U32 LineHeight)
- {
- #if defined(__MMI_LANG_THAI__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return ShowStackedString(x_unsigned, y_unsigned, Font, BackGround, String, LineHeight, 1, Len);
- #elif defined(__MMI_LANG_HINDI__)
- /* START TARUN PMT 20050128 */
- return ShowString_internal(x_unsigned, y_unsigned, Font, BackGround, String, Len, LineHeight, 1);
- /* END TARUN PMT 20050128 */
- #else
- return ShowString_internal(x_unsigned, y_unsigned, Font, String, Len, LineHeight, 1);
- #endif
- }
- /* MTK: Justin end */
- /*****************************************************************************
- * FUNCTION
- * Get_CharWidth
- * DESCRIPTION
- * To get char widths
- *
- * This is used to get char widths
- * PARAMETERS
- * Ch [IN]
- * pdWidth [?]
- * RETURNS
- * S32(?)
- *****************************************************************************/
- void Get_CharWidth(U32 Ch, S32 *pdWidth)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 count = 0;
- S32 index = -1;
- U32 nBase;
- S32 Height = 0;
- S32 nFontIndex = -1;
- sCustFontData *CurrentFont = gpCurrentFont;
- /* for font cache */
- U32 nHashKey = 0;
- CharHashTable *charHashTable;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (Ch & 0xFF00)
- {
- charHashTable = charHashTableOthers;
- nHashKey = Ch & OTHERS_CHAR_HT_MASK;
- }
- else
- {
- charHashTable = charHashTableLatin;
- nHashKey = Ch & LATIN_CHAR_HT_MASK;
- }
- if (charHashTable[nHashKey].unicode == Ch && charHashTable[nHashKey].gnCurrentFont == gnCurrentFont)
- {
- *pdWidth = charHashTable[nHashKey].Width;
- return;
- }
- /* for font cache */
- GetLangIndex(&count, &nFontIndex, &index, Ch, &nBase);
- if (index > -1)
- {
- if (count >= gMaxDeployedLangs)
- {
- *pdWidth = 0;
- gpCurrentFont = CurrentFont;
- return;
- }
- SetFontValues(gnCurrentFont, count);
- if (gpCurrentFont->nEquiDistant)
- {
- *pdWidth = gpCurrentFont->nWidth;
- }
- else
- {
- *pdWidth = gpCurrentFont->pWidthArray[index + (Ch - nBase)];
- }
- }
- else
- {
- Get_PropWidthHeight(Ch, pdWidth, &Height);
- }
- gpCurrentFont = CurrentFont;
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_CharNumInWidth
- * DESCRIPTION
- * To get char number in specified width
- *
- * This is used to get char number in specified width
- * PARAMETERS
- * String [IN]
- * width [IN]
- * checklinebreak [IN]
- * number(?) [OUT] Of characters
- * RETURNS
- * void
- *****************************************************************************/
- U32 Get_CharNumInWidth(U8 *String, U32 width, U8 checklinebreak)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 nwidth = 0, chwidth, chheight;
- U32 nchar = 0, line_break_char_counter = 0;
- U16 ch;
- U8 linebreakflag = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pfnEncodingSchemeToUnicode(&ch, String);
- if (ch == 0)
- {
- return 0;
- }
- do
- {
- pfnEncodingSchemeToUnicode(&ch, String);
- if (checklinebreak)
- {
- linebreakflag = FONT_TEST_WORD_WRAPPING_BREAK_CHARACTER(ch);
- }
- if (FONT_TEST_BIDI_CONTROL_CHAR(ch))
- {
- chwidth = 0;
- }
- else
- {
- Get_CharWidthHeight(ch, (S32*) & chwidth, (S32*) & chheight);
- chwidth += 1;
- }
- nwidth += chwidth;
- String += 2;
- nchar++;
- if (checklinebreak)
- {
- if (UI_STRING_END_OF_STRING_CHARACTER(ch))
- {
- line_break_char_counter = nchar;
- }
- if (linebreakflag)
- {
- line_break_char_counter = nchar;
- }
- /*
- * if (!FONT_TEST_ASCII_CHARACTER(ch))
- * {
- * line_break_char_counter = 0;
- * }
- */
- }
- } while (nwidth <= width && ch != 0 /* && ch != 0x0A && ch != 0x0D */ );
- if (checklinebreak)
- {
- if (line_break_char_counter == 0)
- {
- nchar--;
- }
- else
- {
- nchar = line_break_char_counter;
- }
- }
- else
- {
- nchar--;
- }
- return nchar;
- }
- /**************************************************************
- FUNCTION NAME : Get_CharWidthHeight()
- PURPOSE : To get char widths
- INPUT PARAMETERS : U32 Ch
- OUTPUT PARAMETERS : nil
- RETURNS : S32
- REMARKS : This is used to get char widths
- **************************************************************/
- #ifdef __MMI_HINDI_ALG__
- void Get_CharWidthHeight(U32 Ch, S32 *pdWidth, S32 *pHeight)
- #else
- void Get_CharWidthHeight(U32 Ch, S32 *pWidth, S32 *pHeight)
- #endif
- {
- U8 count = 0;
- S32 index = -1;
- U32 nBase;
- S32 nFontIndex = -1;
- sCustFontData *CurrentFont = gpCurrentFont;
- /* for font cache */
- U32 nHashKey = 0;
- CharHashTable *charHashTable;
- if (Ch & 0xFF00)
- {
- charHashTable = charHashTableOthers;
- nHashKey = Ch & OTHERS_CHAR_HT_MASK;
- }
- else
- {
- charHashTable = charHashTableLatin;
- nHashKey = Ch & LATIN_CHAR_HT_MASK;
- }
- if (charHashTable[nHashKey].unicode == Ch && charHashTable[nHashKey].gnCurrentFont == gnCurrentFont)
- {
- /* PMT START LANGUAGE 20060104 */
- #ifdef __MMI_HINDI_ALG__
- /* PMT START FIX HINDI ISSUES 20060604 */
- if (UI_HINDI_CHARACTER_UCS2_RANGE(Ch))
- {
- *pdWidth = charHashTable[nHashKey].DWidth;
- }
- else
- {
- *pdWidth = charHashTable[nHashKey].Width;
- }
- /* PMT END FIX HINDI ISSUES 20060604 */
- #else /* __MMI_HINDI_ALG__ */
- *pWidth = charHashTable[nHashKey].Width;
- #endif /* __MMI_HINDI_ALG__ */
- /* PMT END LANGUAGE 20060104 */
- *pHeight = charHashTable[nHashKey].Height;
- return;
- }
- /* for font cache */
- GetLangIndex(&count, &nFontIndex, &index, Ch, &nBase);
- if (index > -1)
- {
- #ifdef __MMI_HINDI_ALG__
- if (count >= gMaxDeployedLangs)
- {
- *pdWidth = 0;
- *pHeight = 0;
- gpCurrentFont = CurrentFont;
- return;
- }
- #endif /* __MMI_HINDI_ALG__ */
- SetFontValues(gnCurrentFont, count);
- *pHeight = gpCurrentFont->nHeight;
- #ifdef __MMI_HINDI_ALG__
- if (UI_HINDI_CHARACTER_UCS2_RANGE(Ch))
- {
- *pdWidth = gpCurrentFont->pDWidthArray[index + (Ch - nBase) /* +103 */ ];
- }
- else
- {
- if (gpCurrentFont->nEquiDistant)
- *pdWidth = gpCurrentFont->nWidth;
- else
- *pdWidth = gpCurrentFont->pWidthArray[index + (Ch - nBase)];
- }
- #else /* __MMI_HINDI_ALG__ */
- if (gpCurrentFont->nEquiDistant)
- *pWidth = gpCurrentFont->nWidth;
- else
- *pWidth = gpCurrentFont->pWidthArray[index + (Ch - nBase)];
- #endif /* __MMI_HINDI_ALG__ */
- }
- else
- {
- #ifdef __MMI_HINDI_ALG__
- Get_PropWidthHeight(Ch, pdWidth, pHeight);
- #else
- Get_PropWidthHeight(Ch, pWidth, pHeight);
- #endif
- }
- gpCurrentFont = CurrentFont;
- return;
- }
- /**************************************************************
- FUNCTION NAME : Get_CharBoundingBox()
- PURPOSE : To get the bounding box of "drawn area" of a character
- INPUT PARAMETERS : U32 Ch
- OUTPUT PARAMETERS : pCharWidth - width of character
- pCharHeight - height of character
- pBoxXoffset - X offset of the bounding box of drawn area relative to the top-left corner
- pBoxYoffset - Y offset of the bounding box of drawn area relative to the top-left corner
- pBoxWidth - width of the bounding box of drawn area
- pBoxHeight - height of the bounding box of drawn area
- RETURNS : void
- REMARKS :
- 1. It does not handle Hindi properly.
- 2. The function is slow because it process internal font data.
- 3. This function can be used to align a character in a better way because the "drawn area" is aligned
- differently for different font database.
- **************************************************************/
- void Get_CharBoundingBox(U32 Ch, S32 * pCharWidth, S32 * pCharHeight, S32 * pBoxXoffset, S32 * pBoxYoffset,
- S32 * pBoxWidth, S32 * pBoxHeight)
- {
- U8 *font_data;
- U32 font_data_size;
- U16 char_height;
- U16 char_width;
- #ifdef __MMI_HINDI_ALG__
- U16 char_d_width = 0;
- #endif
- S32 fx1, fy1, fx2, fy2, x, y;
- #ifdef __MMI_HINDI_ALG__
- font_data_size =
- GetFontdata(Ch, *UI_font /* dummy parameter */ , &font_data, &char_width, &char_d_width, &char_height);
- #else /* __MMI_HINDI_ALG__ */
- font_data_size = GetFontdata(Ch, *UI_font /* dummy parameter */ , &font_data, &char_width, &char_height);
- #endif /* __MMI_HINDI_ALG__ */
- *pCharWidth = char_width;
- *pCharHeight = char_height;
- fx1 = char_width - 1; /* min X of drawn area */
- fx2 = 0; /* max X of drawn area */
- fy1 = char_height - 1; /* min Y of drawn area */
- fy2 = 0; /* max Y of drawn area */
- x = 0;
- y = 0;
- while (font_data_size--)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 pattern = *font_data++;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!pattern)
- {
- U32 nTemp;
- x += 8;
- nTemp = x / char_width;
- if (nTemp)
- {
- y += nTemp;
- char_height -= (U16) nTemp;
- if (!char_height)
- {
- break;
- }
- }
- x %= char_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) char_width)
- {
- y++;
- char_height--;
- x = 0;
- if (!char_height)
- {
- break;
- }
- }
- pattern >>= 1;
- }
- }
- }
- MMI_DBG_ASSERT(fx2 >= fx1 && fy2 >= fy1);
- *pBoxXoffset = fx1;
- *pBoxYoffset = fy1;
- *pBoxWidth = fx2 - fx1 + 1;
- *pBoxHeight = fy2 - fy1 + 1;
- }
- /*****************************************************************************
- * FUNCTION
- * Get_PropWidthHeight
- * DESCRIPTION
- * To get char widths
- *
- * This is used to get char widths
- * PARAMETERS
- * Ch [IN]
- * pWidth [?]
- * pHeight [?]
- * RETURNS
- * S32
- *****************************************************************************/
- S32 Get_PropWidthHeight(U32 Ch, S32 *pWidth, S32 *pHeight)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 nBase = 0;
- S32 index = -1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK Add Steven 2005.06.03 */
- #if defined(__MMI_ZI__)
- index = SearchInZiExtraFont(Ch, &nBase);
- #else
- index = SearchInPropFont(Ch, &nBase);
- #endif
- if (index == -1)