gui_lang_viet.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:15k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * gui_lang_viet.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for displaying Vietnamese Language
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  *------------------------------------------------------------------------------
  60.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  61.  *============================================================================
  62.  ****************************************************************************/
  63. #ifndef _MMI_LANG_VIET_C
  64. #define _MMI_LANG_VIET_C
  65. /*  Include: MMI header file */
  66. #include "MMI_features.h"
  67. #ifdef __MMI_LANG_VIETNAMESE__
  68. #include "gui_lang_viet.h"
  69. /***************************************************************************** 
  70. * Define
  71. *****************************************************************************/
  72. /***************************************************************************** 
  73. * Typedef 
  74. *****************************************************************************/
  75. /***************************************************************************** 
  76. * Local Variable
  77. *****************************************************************************/
  78. /***************************************************************************** 
  79. * Local Function
  80. *****************************************************************************/
  81. /***************************************************************************** 
  82. * Global Variable
  83. *****************************************************************************/
  84. const U16 mmi_viet_vowel[] = {0x0041, 0x0045, 0x0049, 0x004F, 0x0055, 0x0059,
  85.     0x0061, 0x0065, 0x0069, 0x006F, 0x0075, 0x0079,
  86.     0x00C2, 0x00CA, 0x00D4, 0x00E2, 0x00EA, 0x00F4,
  87.     0x0102, 0x0103, 0x01A0, 0x01A1, 0x01AF, 0x01B0
  88. };
  89. const U16 mmi_viet_vowel_tone[5][24] = { {0x00C0, 0x00C8, 0x00CC, 0x00D2, 0x00D9, 0x1EF2,
  90.                                           0x00E0, 0x00E8, 0x00EC, 0x00F2, 0x00F9, 0x1EF3,
  91.                                           0x1EA6, 0x1EC0, 0x1ED2, 0x1EA7, 0x1EC1, 0x1ED3,
  92.                                           0x1EB0, 0x1EB1, 0x1EDC, 0x1EDD, 0x1EEA, 0x1EEB},
  93. {0x00C1, 0x00C9, 0x00CD, 0x00D3, 0x00DA, 0x00DD,
  94.  0x00E1, 0x00E9, 0x00ED, 0x00F3, 0x00FA, 0x00FD,
  95.  0x1EA4, 0x1EBE, 0x1ED0, 0x1EA5, 0x1EBF, 0x1ED1,
  96.  0x1EAE, 0x1EAF, 0x1EDA, 0x1EDB, 0x1EE8, 0x1EE9},
  97. {0x00C3, 0x1EBC, 0x0128, 0x00D5, 0x0168, 0x1EF8,
  98.  0x00E3, 0x1EBD, 0x0129, 0x00F5, 0x0169, 0x1EF9,
  99.  0x1EAA, 0x1EC4, 0x1ED6, 0x1EAB, 0x1EC5, 0x1ED7,
  100.  0x1EB4, 0x1EB5, 0x1EE0, 0x1EE1, 0x1EEE, 0x1EEF},
  101. {0x1EA2, 0x1EBA, 0x1EC8, 0x1ECE, 0x1EE6, 0x1EF6,
  102.  0x1EA3, 0x1EBB, 0x1EC9, 0x1ECF, 0x1EE7, 0x1EF7,
  103.  0x1EA8, 0x1EC2, 0x1ED4, 0x1EA9, 0x1EC3, 0x1ED5,
  104.  0x1EB2, 0x1EB3, 0x1EDE, 0x1EDF, 0x1EEC, 0x1EED},
  105. {0x1EA0, 0x1EB8, 0x1ECA, 0x1ECC, 0x1EE4, 0x1EF4,
  106.  0x1EA1, 0x1EB9, 0x1ECB, 0x1ECD, 0x1EE5, 0x1EF5,
  107.  0x1EAC, 0x1EC6, 0x1ED8, 0x1EAD, 0x1EC7, 0x1ED9,
  108.  0x1EB6, 0x1EB7, 0x1EE2, 0x1EE3, 0x1EF0, 0x1EF1}
  109. };
  110. /***************************************************************************** 
  111. * Global Function
  112. *****************************************************************************/
  113. /*****************************************************************************
  114.  * FUNCTION
  115.  *  mmi_viet_tone_mark
  116.  * DESCRIPTION
  117.  *  To get the type of the tone mark
  118.  *  
  119.  *  This is used to get the type of the tone mark.
  120.  * PARAMETERS
  121.  *  ch      [IN]        
  122.  * RETURNS
  123.  *  viet_tone
  124.  *****************************************************************************/
  125. viet_tone_mark mmi_viet_tone_mark(UI_character_type ch)
  126. {
  127.     /*----------------------------------------------------------------*/
  128.     /* Local Variables                                                */
  129.     /*----------------------------------------------------------------*/
  130.     /*----------------------------------------------------------------*/
  131.     /* Code Body                                                      */
  132.     /*----------------------------------------------------------------*/
  133.     if (ch >= 0x0300 && ch <= 0x0323)
  134.     {
  135.         if (0x0300 == ch)
  136.         {
  137.             return VIET_TONE_GRAVE_ACCENT;
  138.         }
  139.         else if (0x0301 == ch)
  140.         {
  141.             return VIET_TONE_ACCUTE_ACCENT;
  142.         }
  143.         else if (0x0303 == ch)
  144.         {
  145.             return VIET_TONE_TILDE;
  146.         }
  147.         else if (0x0309 == ch)
  148.         {
  149.             return VIET_TONE_HOOK_ABOVE;
  150.         }
  151.         else if (0x0323 == ch)
  152.         {
  153.             return VIET_TONE_DOT_BELOW;
  154.         }
  155.         else
  156.         {
  157.             return VIET_TONE_NONE;
  158.         }
  159.     }
  160.     else
  161.     {
  162.         return VIET_TONE_NONE;
  163.     }
  164. }
  165. /*****************************************************************************
  166.  * FUNCTION
  167.  *  mmi_viet_vowel_letter
  168.  * DESCRIPTION
  169.  *  To get the type of the vowel letter
  170.  *  
  171.  *  This is used to get the type of the vowel letter.
  172.  * PARAMETERS
  173.  *  ch      [IN]        
  174.  * RETURNS
  175.  *  viet_vowel_letter
  176.  *****************************************************************************/
  177. viet_vowel_letter mmi_viet_vowel_letter(UI_character_type ch)
  178. {
  179.     /*----------------------------------------------------------------*/
  180.     /* Local Variables                                                */
  181.     /*----------------------------------------------------------------*/
  182.     /*----------------------------------------------------------------*/
  183.     /* Code Body                                                      */
  184.     /*----------------------------------------------------------------*/
  185.     if (ch >= 0x0041 && ch <= 0x01B0)
  186.     {
  187.         if (0x0079 >= ch)
  188.         {
  189.             if (0x0059 >= ch)
  190.             {
  191.                 if (0x0049 >= ch)
  192.                 {
  193.                     if (0x0041 == ch)
  194.                     {
  195.                         return VIET_VOWEL_CAPITAL_A;
  196.                     }
  197.                     else if (0x0045 == ch)
  198.                     {
  199.                         return VIET_VOWEL_CAPITAL_E;
  200.                     }
  201.                     else if (0x0049 == ch)
  202.                     {
  203.                         return VIET_VOWEL_CAPITAL_I;
  204.                     }
  205.                     else
  206.                     {
  207.                         return VIET_VOWEL_NONE;
  208.                     }
  209.                 }
  210.                 else
  211.                 {
  212.                     if (0x004F == ch)
  213.                     {
  214.                         return VIET_VOWEL_CAPITAL_O;
  215.                     }
  216.                     else if (0x0055 == ch)
  217.                     {
  218.                         return VIET_VOWEL_CAPITAL_U;
  219.                     }
  220.                     else if (0x0059 == ch)
  221.                     {
  222.                         return VIET_VOWEL_CAPITAL_Y;
  223.                     }
  224.                     else
  225.                     {
  226.                         return VIET_VOWEL_NONE;
  227.                     }
  228.                 }
  229.             }
  230.             else
  231.             {
  232.                 if (0x0069 >= ch)
  233.                 {
  234.                     if (0x0061 == ch)
  235.                     {
  236.                         return VIET_VOWEL_SMALL_A;
  237.                     }
  238.                     else if (0x0065 == ch)
  239.                     {
  240.                         return VIET_VOWEL_SMALL_E;
  241.                     }
  242.                     else if (0x0069 == ch)
  243.                     {
  244.                         return VIET_VOWEL_SMALL_I;
  245.                     }
  246.                     else
  247.                     {
  248.                         return VIET_VOWEL_NONE;
  249.                     }
  250.                 }
  251.                 else
  252.                 {
  253.                     if (0x006F == ch)
  254.                     {
  255.                         return VIET_VOWEL_SMALL_O;
  256.                     }
  257.                     else if (0x0075 == ch)
  258.                     {
  259.                         return VIET_VOWEL_SMALL_U;
  260.                     }
  261.                     else if (0x0079 == ch)
  262.                     {
  263.                         return VIET_VOWEL_SMALL_Y;
  264.                     }
  265.                     else
  266.                     {
  267.                         return VIET_VOWEL_NONE;
  268.                     }
  269.                 }
  270.             }
  271.         }
  272.         else
  273.         {
  274.             if (0x00F4 >= ch)
  275.             {
  276.                 if (0x00D4 >= ch)
  277.                 {
  278.                     if (0x00C2 == ch)
  279.                     {
  280.                         return VIET_VOWEL_CAPITAL_A_CIRCUMFLEX;
  281.                     }
  282.                     else if (0x00CA == ch)
  283.                     {
  284.                         return VIET_VOWEL_CAPITAL_E_CIRCUMFLEX;
  285.                     }
  286.                     else if (0x00D4 == ch)
  287.                     {
  288.                         return VIET_VOWEL_CAPITAL_O_CIRCUMFLEX;
  289.                     }
  290.                     else
  291.                     {
  292.                         return VIET_VOWEL_NONE;
  293.                     }
  294.                 }
  295.                 else
  296.                 {
  297.                     if (0x00E2 == ch)
  298.                     {
  299.                         return VIET_VOWEL_SMALL_A_CIRCUMFLEX;
  300.                     }
  301.                     else if (0x00EA == ch)
  302.                     {
  303.                         return VIET_VOWEL_SMALL_E_CIRCUMFLEX;
  304.                     }
  305.                     else if (0x00F4 == ch)
  306.                     {
  307.                         return VIET_VOWEL_SMALL_O_CIRCUMFLEX;
  308.                     }
  309.                     else
  310.                     {
  311.                         return VIET_VOWEL_NONE;
  312.                     }
  313.                 }
  314.             }
  315.             else
  316.             {
  317.                 if (0x01A0 >= ch)
  318.                 {
  319.                     if (0x0102 == ch)
  320.                     {
  321.                         return VIET_VOWEL_CAPITAL_A_BREVE;
  322.                     }
  323.                     else if (0x0103 == ch)
  324.                     {
  325.                         return VIET_VOWEL_SMALL_A_BREVE;
  326.                     }
  327.                     else if (0x01A0 == ch)
  328.                     {
  329.                         return VIET_VOWEL_CAPITAL_O_HORN;
  330.                     }
  331.                     else
  332.                     {
  333.                         return VIET_VOWEL_NONE;
  334.                     }
  335.                 }
  336.                 else
  337.                 {
  338.                     if (0x01A1 == ch)
  339.                     {
  340.                         return VIET_VOWEL_SMALL_O_HORN;
  341.                     }
  342.                     else if (0x01AF == ch)
  343.                     {
  344.                         return VIET_VOWEL_CAPITAL_U_HORN;
  345.                     }
  346.                     else if (0x01B0 == ch)
  347.                     {
  348.                         return VIET_VOWEL_SMALL_U_HORN;
  349.                     }
  350.                     else
  351.                     {
  352.                         return VIET_VOWEL_NONE;
  353.                     }
  354.                 }
  355.             }
  356.         }
  357.     }
  358.     else
  359.     {
  360.         return VIET_VOWEL_NONE;
  361.     }
  362. }
  363. /*****************************************************************************
  364.  * FUNCTION
  365.  *  mmi_viet_combine_vowel_tone
  366.  * DESCRIPTION
  367.  *  To get the combination of the vowel and the tone mark
  368.  *  
  369.  *  This is used to get the combination of the vowel and the tone mark.
  370.  * PARAMETERS
  371.  *  vw      [IN]        Viet_tone vt
  372.  *  vt      [IN]        
  373.  * RETURNS
  374.  *  UI_character_type
  375.  *****************************************************************************/
  376. UI_character_type mmi_viet_combine_vowel_tone(viet_vowel_letter vw, viet_tone_mark vt)
  377. {
  378.     /*----------------------------------------------------------------*/
  379.     /* Local Variables                                                */
  380.     /*----------------------------------------------------------------*/
  381.     /*----------------------------------------------------------------*/
  382.     /* Code Body                                                      */
  383.     /*----------------------------------------------------------------*/
  384.     if (vw != VIET_VOWEL_NONE && vt != VIET_TONE_NONE)
  385.     {
  386.         return (UI_character_type) mmi_viet_vowel_tone[vt][vw];
  387.     }
  388.     else
  389.     {
  390.         return (UI_character_type) 0x0020;
  391.     }
  392. }
  393. #endif /* __MMI_LANG_VIETNAMESE__ */ 
  394. #endif /* _MMI_LANG_VIET_C */