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

MTK

开发平台:

C/C++

  1.     FALSE,  /* 59777 */
  2.     FALSE,  /* 59778 */
  3.     FALSE,  /* 59779 */
  4.     FALSE,  /* 59780 */
  5.     FALSE,  /* 59781 */
  6.     FALSE,  /* 59782 */
  7.     FALSE,  /* 59783 */
  8.     FALSE,  /* 59784 */
  9.     FALSE,  /* 59785 */
  10.     TRUE,   /* 59786 */
  11.     TRUE,   /* 59787 */
  12.     TRUE,   /* 59788 */
  13.     TRUE,   /* 59789 */
  14.     TRUE,   /* 59790 */
  15.     TRUE,   /* 59791 */
  16.     TRUE,   /* 59792 */
  17.     FALSE,  /* 59793 */
  18.     FALSE,  /* 59794 */
  19.     FALSE,  /* 59795 */
  20.     FALSE,  /* 59796 */
  21.     FALSE,  /* 59797 */
  22.     FALSE,  /* 59798 */
  23.     FALSE,  /* 59799 */
  24.     FALSE,  /* 59800 */
  25.     FALSE,  /* 59801 */
  26.     FALSE,  /* 59802 */
  27.     FALSE,  /* 59803 */
  28.     FALSE,  /* 59804 */
  29.     FALSE,  /* 59805 */
  30.     FALSE,  /* 59806 */
  31.     FALSE,  /* 59807 */
  32.     FALSE,  /* 59808 */
  33.     FALSE,  /* 59809 */
  34.     FALSE,  /* 59810 */
  35.     FALSE,  /* 59811 */
  36.     FALSE,  /* 59812 */
  37.     FALSE,  /* 59813 */
  38.     FALSE,  /* 59814 */
  39.     FALSE,  /* 59815 */
  40.     FALSE,  /* 59816 */
  41.     FALSE,  /* 59817 */
  42.     FALSE,  /* 59818 */
  43.     FALSE,  /* 59819 */
  44.     FALSE,  /* 59820 */
  45.     FALSE,  /* 59821 */
  46.     FALSE,  /* 59822 */
  47.     FALSE,  /* 59823 */
  48.     FALSE,  /* 59824 */
  49.     FALSE,  /* 59825 */
  50.     FALSE,  /* 59826 */
  51.     FALSE,  /* 59827 */
  52.     /* PMT RAKESH START 20061006 */
  53.     FALSE,  /* 59828 */
  54.     FALSE,  /* 59829 */
  55.     FALSE,  /* 59830 */
  56.     FALSE,  /* 59831 */
  57.     FALSE,  /* 59832 */
  58.     FALSE,  /* 59833 */
  59.     FALSE,  /* 59834 */
  60.     FALSE,  /* 59835 */
  61.     FALSE,  /* 59836 */
  62.     FALSE,  /* 59837 */
  63.     FALSE,  /* 59838 */
  64.     FALSE,  /* 59839 */
  65.     FALSE,  /* 59840 */
  66.     FALSE,  /* 59841 */
  67.     /* PMT RAKESH END 20061006 */
  68. };
  69. /* conjunct ligatures */
  70. #if 0
  71. /* under construction !*/
  72. /* under construction !*/
  73. /* under construction !*/
  74. /* under construction !*/
  75. #endif /* 0 */ 
  76. //U8 IdentifyCharacter( U16 ch )
  77.   //{
  78.    //  return hindi_character_array[UNI2HINDI(ch)];             
  79.      /* if( HF_CON_RANGE(ch) )
  80.         return CON;
  81.         else if( HF_INDVOW_RANGE(ch) )
  82.         return INDVOW;
  83.         else if( HF_DEPVOW_RANGE(ch) )
  84.         return DEPVOW;
  85.         else if( HF_SIGN_RANGE(ch) )
  86.         return SIGN;   
  87.         else if( HF_NUMERAL_RANGE(ch) )
  88.         return DIG;
  89.         
  90.         else return 0; */
  91. /* } */
  92. /*
  93.  * MMI_BOOL hf_whether_ligature_range(U16 ligature )
  94.  * {
  95.  * switch(ligature)
  96.  * {
  97.  * case L_KSHA:
  98.  * case L_GYA:
  99.  * case L_TTTA:
  100.  * case L_TRA:
  101.  * case L_SHRA:
  102.  * case L_KRA:
  103.  * case L_JRA:
  104.  * case L_ZRA:
  105.  * case L_FRA:
  106.  * case L_NFRA:
  107.  * case L_PRA:
  108.  * case L_SRA:
  109.  * case L_RU:
  110.  * case L_RUU:
  111.  * case H_KA:
  112.  * case H_KHA:
  113.  * case H_GA:
  114.  * case H_GHA:
  115.  * case H_CHA:
  116.  * case H_JA:
  117.  * case H_JHA:
  118.  * case H_NYA:
  119.  * case H_ANNA:
  120.  * case H_TA:
  121.  * case H_THA:
  122.  * case H_DHA:
  123.  * case H_NA:
  124.  * case H_NNNA:
  125.  * case H_PA:
  126.  * case H_PHA:
  127.  * case H_BA:
  128.  * case H_BHA:
  129.  * case H_MA:
  130.  * case H_YA:
  131.  * case H_LA:
  132.  * case H_LLA:
  133.  * case H_LLLA:
  134.  * case H_VA:
  135.  * case H_SHA:
  136.  * case H_SSA:
  137.  * case H_SA:
  138.  * case L_KKA:
  139.  * case L_KTA:
  140.  * case L_DYA:
  141.  * case L_DVA:
  142.  * case L_DDYA:
  143.  * case L_TTTTA:
  144.  * case L_TTHA:
  145.  * case L_NNNA:
  146.  * case L_HYA:
  147.  * case H_KHSA:
  148.  * case H_TTA:
  149.  * case H_TRA:
  150.  * case H_SHRA:
  151.  * case L_HRA:
  152.  * case H_EYLASH:
  153.  * case SUP_RA:
  154.  * case SUB_RA:
  155.  * return TRUE;
  156.  * default:
  157.  * return FALSE;
  158.  * }
  159.  * }
  160.  */
  161. /*****************************************************************************
  162.  * FUNCTION
  163.  *  hf_whether_conjunct
  164.  * DESCRIPTION
  165.  *  
  166.  * PARAMETERS
  167.  *  conjunct        [IN]        
  168.  * RETURNS
  169.  *  
  170.  *****************************************************************************/
  171. MMI_BOOL hf_whether_conjunct(U16 conjunct)
  172. {
  173.     /*----------------------------------------------------------------*/
  174.     /* Local Variables                                                */
  175.     /*----------------------------------------------------------------*/
  176.     /*----------------------------------------------------------------*/
  177.     /* Code Body                                                      */
  178.     /*----------------------------------------------------------------*/
  179.     /* if( conjunct == L_KSHA  || conjunct == L_TRA || conjunct == L_SHRA || conjunct == L_TTTA)//cases of L_GYA,L_TTTA to be added */
  180.     switch (conjunct)
  181.     {
  182.         case L_KSHA:
  183.         case L_TRA:
  184.         case L_SHRA:
  185.         case L_TTTA:
  186.         {
  187.             return TRUE;
  188.             break;
  189.         }
  190.         default:
  191.             return FALSE;
  192.     }
  193.     //      return TRUE;
  194.     //      else return FALSE;
  195. }
  196. /*****************************************************************************
  197.  * FUNCTION
  198.  *  hf_hindi_rules
  199.  * DESCRIPTION
  200.  *  
  201.  * PARAMETERS
  202.  *  glyphoutput     [IN]        
  203.  *  cluster         [IN]        
  204.  *  nentry          [IN]        
  205.  * RETURNS
  206.  *  
  207.  *****************************************************************************/
  208. S32 hf_hindi_rules(PU16 glyphoutput, PU16 cluster, S32 nentry)
  209. {
  210.     /*----------------------------------------------------------------*/
  211.     /* Local Variables                                                */
  212.     /*----------------------------------------------------------------*/
  213.     S32 ch_index;
  214.     MAIN_TABLE ind_table;
  215.     const GLYPH_INFO_TABLE *char_table;
  216.     S32 size;
  217.     S32 noutglyph = 0;      /* no. of entries in output cluster to be given to renderer */
  218.     S32 max_size;
  219.     S32 matched = FALSE;
  220.     S32 input = nentry;
  221.     S32 tomatch = nentry;   /* nentries--no. of elements in the cluster */
  222.     /*----------------------------------------------------------------*/
  223.     /* Code Body                                                      */
  224.     /*----------------------------------------------------------------*/
  225.     if (HF_HINDI_RANGE(*cluster))
  226.     {
  227.         /* START TARUN 20050108 */
  228.         if (nentry == 1)
  229.         {
  230.             glyphoutput[nentry - 1] = *cluster;
  231.             glyphoutput[nentry] = (U16) NULL;
  232.             return nentry;
  233.         }
  234.         /* END TARUN 20050108 */
  235.         while (nentry)
  236.         {
  237.             ch_index = UNI2HINDI(*cluster);         /* find the index of character in main table */
  238.             ind_table = hfDvngTbl[ch_index - 1];    /* gets the individual charactr's table in main table */
  239.             char_table = ind_table.glyphinfo;       /* holds the add. of individual character */
  240.             size = ind_table.nsize;
  241.             max_size = ind_table.maxInputGlyphSize;
  242.             matched = FALSE;
  243.             while (size)
  244.             {
  245.                 size--;
  246.                 if (tomatch != char_table[size].nInputLen)  /* && max_size > nentry ) */
  247.                 {
  248.                     continue;
  249.                 }
  250.                 /* PMT RAKESH START 20061006 */
  251.                 if ((char_table[size].rule_language) &&
  252.                     (char_table[size].rule_language != hf_rules_current_set_language))
  253.                 {
  254.                     continue;   
  255.                 }
  256.                 /* PMT RAKESH END 20061006 */
  257.                 else if (memcmp(char_table[size].Input_glyph, cluster, char_table[size].nInputLen * 2) == 0)
  258.                 {
  259.                     //#if 0
  260.                     //                                      if( *cluster == C_RA && input>=3 && (IdentifyCharacter(*(cluster-1)) == CON || IdentifyCharacter(*(cluster-1)) == DEPVOW) && *(cluster-1)!=DV_I )//change 01/12/04
  261.                     //                                      {
  262.                     //                                              memcpy( glyphoutput,char_table[size].Output_glyph,char_table[size].nOutputLen*2 );
  263.                     //                                              glyphoutput[char_table[size].nOutputLen] = NULL;
  264.                     //                                      }
  265.                     //                                      else if( *cluster == C_RA && (*(cluster+1) == S_HALANT ))
  266.                     //                                      {
  267.                     //                                              memcpy( glyphoutput,char_table[size].Input_glyph,char_table[size].nInputLen*2 );
  268.                     //                                              glyphoutput[char_table[size].nInputLen] = NULL;
  269.                     //                                              glyphoutput++;
  270.                     //                                      }
  271.                     //                                      else if( (*(cluster+1) == S_HALANT) && (*(cluster+2)== NULL) )
  272.                     //                                      {
  273.                     //                                              memcpy( glyphoutput,char_table[size].Input_glyph,char_table[size].nInputLen*2 );
  274.                     //                                              glyphoutput[char_table[size].nInputLen] = NULL;
  275.                     //                                      }
  276.                     //                                      else
  277.                     //                                      {
  278.                     //                                              memcpy( glyphoutput,char_table[size].Output_glyph,char_table[size].nOutputLen*2 );
  279.                     //                                              glyphoutput[char_table[size].nOutputLen] = NULL;
  280.                     //                                      }
  281.                     //#endif//0
  282.                     //#if 1
  283.                     switch (*cluster)
  284.                     {
  285.                         case C_RA:
  286.                         {
  287.                             if (input >= 3 && (IdentifyCharacter(*(cluster - 1)) == CON || IdentifyCharacter(*(cluster - 1)) == DEPVOW) && *(cluster - 1) != DV_I)      /* change 01/12/04 */
  288.                             {
  289.                                 memcpy(glyphoutput, char_table[size].Output_glyph, char_table[size].nOutputLen * 2);
  290.                                 glyphoutput[char_table[size].nOutputLen] = (U16) NULL;
  291.                                 break;
  292.                             }
  293.                             else if ((*(cluster + 1) == S_HALANT))
  294.                             {
  295.                                 memcpy(glyphoutput, char_table[size].Input_glyph, char_table[size].nInputLen * 2);
  296.                                 glyphoutput[char_table[size].nInputLen] = (U16) NULL;
  297.                                 glyphoutput++;
  298.                                 break;
  299.                             }
  300.                             memcpy(glyphoutput, char_table[size].Output_glyph, char_table[size].nOutputLen * 2);
  301.                             glyphoutput[char_table[size].nOutputLen] = (U16) NULL;
  302.                             break;
  303.                         }
  304.                         default:
  305.                         {
  306.                             if ((*(cluster + 1) == S_HALANT) && (*(cluster + 2) == (U16) NULL))
  307.                             {
  308.                                 memcpy(glyphoutput, char_table[size].Input_glyph, char_table[size].nInputLen * 2);
  309.                                 glyphoutput[char_table[size].nInputLen] = (U16) NULL;
  310.                             }
  311.                             else
  312.                             {
  313.                                 memcpy(glyphoutput, char_table[size].Output_glyph, char_table[size].nOutputLen * 2);
  314.                                 glyphoutput[char_table[size].nOutputLen] = (U16) NULL;
  315.                             }
  316.                             break;
  317.                         }
  318.                     }
  319.                     // #endif//1
  320.                     nentry -= char_table[size].nInputLen;
  321.                     glyphoutput += char_table[size].nOutputLen;
  322.                     cluster += char_table[size].nInputLen;
  323.                     noutglyph += char_table[size].nOutputLen;
  324.                     matched = TRUE;
  325.                     if (hf_whether_conjunct(*(glyphoutput - 1)) && *cluster == S_HALANT &&
  326.                         IdentifyCharacter(*(cluster + 1)) == CON)
  327.                     {
  328.                         S32 conjunct = *(glyphoutput - 1);
  329.                         switch (conjunct)
  330.                         {
  331.                             case L_KSHA:
  332.                                 *(glyphoutput - 1) = H_KHSA;
  333.                                 break;
  334.                             case L_TRA:
  335.                                 *(glyphoutput - 1) = H_TRA;
  336.                                 break;
  337.                             case L_SHRA:
  338.                                 *(glyphoutput - 1) = H_SHRA;
  339.                                 break;
  340.                             case L_TTTA:
  341.                                 *(glyphoutput - 1) = H_TTA;
  342.                                 break;
  343.                             default:
  344.                                 break;
  345.                         }
  346.                         //if( *(glyphoutput-1) == L_KSHA)
  347.                         //*(glyphoutput-1)=H_KHSA;
  348.                         //else if( *(glyphoutput-1) == L_TRA)
  349.                         //*(glyphoutput-1)=H_TRA;
  350.                         //else if( *(glyphoutput-1) == L_SHRA)
  351.                         //*(glyphoutput-1)=H_SHRA;
  352.                         ////cases of L_GYA to be added
  353.                         //else if( *(glyphoutput-1) == L_TTTA)
  354.                         //*(glyphoutput-1)=H_TTA;
  355.                         *glyphoutput = (U16) NULL;
  356.                         nentry -= 1;
  357.                         cluster += 1;
  358.                         noutglyph += 1;
  359.                         matched = TRUE;
  360.                         break;
  361.                     }
  362.                     /* vj 01/12/04 */
  363.                     break;
  364.                 }
  365.             }
  366.             if (matched != TRUE)
  367.             {
  368.                 --tomatch;
  369.             }
  370.             else
  371.             {
  372.                 tomatch = nentry;
  373.             }
  374.         }
  375.         return noutglyph;
  376.     }
  377.     else
  378.     {
  379.         glyphoutput[nentry - 1] = *cluster;
  380.         glyphoutput[nentry] = (U16) NULL;
  381.         return nentry;
  382.     }
  383. }
  384. //void init_cluster_start_p(PU16 buffer)
  385. //{
  386. //      if(buffer!=NULL)
  387. //      cluster_start_p = buffer;
  388. //}
  389. //void init_cluster_end_p(PU16 buffer)
  390. //{
  391. //      if(buffer!=NULL)
  392. //      cluster_end_p = buffer;
  393. //}
  394. #if 0
  395. /* under construction !*/
  396. /* under construction !*/
  397. /* under construction !*/
  398. /* under construction !*/
  399. /* under construction !*/
  400. /* under construction !*/
  401. /* under construction !*/
  402. /* under construction !*/
  403. /* under construction !*/
  404. /* under construction !*/
  405. /* under construction !*/
  406. /* under construction !*/
  407. /* under construction !*/
  408. /* under construction !*/
  409. /* under construction !*/
  410. #endif /* 0 */ 
  411. /*****************************************************************************
  412.  * FUNCTION
  413.  *  hf_get_cluster
  414.  * DESCRIPTION
  415.  *  
  416.  * PARAMETERS
  417.  *  cluster     [IN]        
  418.  * RETURNS
  419.  *  
  420.  *****************************************************************************/
  421. S32 hf_get_cluster(PU16 cluster)
  422. {
  423.     /*----------------------------------------------------------------*/
  424.     /* Local Variables                                                */
  425.     /*----------------------------------------------------------------*/
  426.     S32 nFill = 0;                      /* no. of elements filled in the cluster */
  427.     S32 j = 0;                          /* loop counter */
  428.     S32 i;
  429.     U16 temp;
  430.     S32 ch;                             /* whether CON,INDVOW,DEPVOW,SIGN,NUM */
  431.     PU16 start_cluster = cluster;
  432.     PU8 start_char = cluster_start_p;   /* points to the starting character of the input string */
  433.     /*----------------------------------------------------------------*/
  434.     /* Code Body                                                      */
  435.     /*----------------------------------------------------------------*/
  436.     if (!HINDI_CONVERT_U8_U16(start_char))
  437.     {
  438.         return 0;
  439.     }
  440.     if (!HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(start_char)))
  441.     {
  442.         HINDI_FILL_CLUSTER();
  443.         start_cluster[nFill] = (U16) NULL;
  444.         cluster_start_p += (nFill * 2);
  445.         /* cluster_start_p=cluster_start_p+(nFill*2); */
  446.         return nFill;
  447.     }
  448.     ch = IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char));
  449.     nFill = 0;
  450.     switch (ch)
  451.     {
  452.             /* if( ch == CON ) */
  453.         case CON:
  454.         {
  455.             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  456.             //nFill++;start_char++;
  457.             HINDI_FILL_CLUSTER();
  458.             /* if( (cursor_pointer_end_current_cluster == start_char) || hf_end_cluster(start_cluster,start_char,nFill) )
  459.                {
  460.                return nFill;
  461.                } */
  462.             HF_END_CLUSTER(start_cluster, start_char, nFill);
  463.             MMI_ASSERT(!(nFill > G_MAX));
  464.             if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
  465.             {
  466.                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  467.                 //nFill++;start_char++;
  468.                 HINDI_FILL_CLUSTER();
  469.                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  470.                    return nFill; */
  471.                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  472.                 MMI_ASSERT(!(nFill > G_MAX));
  473.                 if (HINDI_CONVERT_U8_U16(start_char) == C_RA)
  474.                 {
  475.                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  476.                     //nFill++;start_char++;
  477.                     HINDI_FILL_CLUSTER();
  478.                     if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
  479.                     {
  480.                         nFill = hf_get_consonant_cluster(&start_cluster, &start_char, nFill);
  481.                     }
  482.                     MMI_ASSERT(!(nFill > G_MAX));
  483.                     if ((nFill % 2) && start_cluster[0] == C_RA)
  484.                     {
  485.                         if (HINDI_CONVERT_U8_U16(start_char) != DV_I &&
  486.                             IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW)
  487.                         {
  488.                             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  489.                             //nFill++;start_char++;
  490.                             HINDI_FILL_CLUSTER();
  491.                         }
  492.                         for (i = 0; i <= 1; i++)
  493.                         {
  494.                             temp_array[0] = start_cluster[0];
  495.                             for (j = 0; j < nFill - 1; j++)
  496.                             {
  497.                                 start_cluster[j] = start_cluster[j + 1];
  498.                             }
  499.                             start_cluster[j] = temp_array[0];
  500.                         }
  501.                         /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  502.                            return nFill; */
  503.                         HF_END_CLUSTER(start_cluster, start_char, nFill);
  504.                         if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  505.                         {
  506.                             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  507.                             //nFill++;start_char++;
  508.                             HINDI_FILL_CLUSTER();
  509.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  510.                                return nFill; */
  511.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  512.                         }
  513.                     }
  514.                     else if (start_cluster[0] == C_RA)
  515.                     {
  516.                         temp = start_cluster[nFill - 1];
  517.                         for (i = 0; i <= 1; i++)
  518.                         {
  519.                             temp_array[0] = start_cluster[0];
  520.                             for (j = 0; j < nFill - 2; j++)
  521.                             {
  522.                                 start_cluster[j] = start_cluster[j + 1];
  523.                             }
  524.                             start_cluster[j] = temp_array[0];
  525.                         }
  526.                         start_cluster[nFill - 1] = temp;
  527.                     }
  528.                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  529.                        return nFill; */
  530.                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  531.                     MMI_ASSERT(!(nFill > G_MAX));
  532.                     if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
  533.                     {
  534.                         //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  535.                         //nFill++;start_char++;
  536.                         HINDI_FILL_CLUSTER();
  537.                         temp = start_cluster[nFill - 1];
  538.                         for (j = nFill - 1; j >= 0; j--)
  539.                         {
  540.                             start_cluster[j + 1] = start_cluster[j];
  541.                         }
  542.                         start_cluster[j + 1] = temp;
  543.                         /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  544.                            return nFill; */
  545.                         HF_END_CLUSTER(start_cluster, start_char, nFill);
  546.                         MMI_ASSERT(!(nFill > G_MAX));
  547.                         if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU)
  548.                         {
  549.                             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  550.                             //nFill++;start_char++;
  551.                             HINDI_FILL_CLUSTER();
  552.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  553.                                return nFill; */
  554.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  555.                             MMI_ASSERT(!(nFill > G_MAX));
  556.                         }
  557.                     }
  558.                     /* vijay 061204 */
  559.                     else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW ||
  560.                              IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  561.                     {
  562.                         //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  563.                         //nFill++;start_char++;
  564.                         HINDI_FILL_CLUSTER();
  565.                         /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  566.                            return nFill; */
  567.                         HF_END_CLUSTER(start_cluster, start_char, nFill);
  568.                         MMI_ASSERT(!(nFill > G_MAX));
  569.                         if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  570.                         {
  571.                             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  572.                             //nFill++;start_char++;
  573.                             HINDI_FILL_CLUSTER();
  574.                             MMI_ASSERT(!(nFill > G_MAX));
  575.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  576.                                return nFill; */
  577.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  578.                         }
  579.                     }
  580.                     /* vijay 061204 issue of U matra solved */
  581.                 }
  582.                 else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == CON)
  583.                 {
  584.                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  585.                     //nFill++;start_char++;
  586.                     HINDI_FILL_CLUSTER();
  587.                     MMI_ASSERT(!(nFill > G_MAX));
  588.                 #if 0
  589. /* under construction !*/
  590. /* under construction !*/
  591. /* under construction !*/
  592. /* under construction !*/
  593. /* under construction !*/
  594. /* under construction !*/
  595. /* under construction !*/
  596. /* under construction !*/
  597. /* under construction !*/
  598. /* under construction !*/
  599. /* under construction !*/
  600. /* under construction !*/
  601. /* under construction !*/
  602. /* under construction !*/
  603. /* under construction !*/
  604. /* under construction !*/
  605. /* under construction !*/
  606. /* under construction !*/
  607. /* under construction !*/
  608. /* under construction !*/
  609. /* under construction !*/
  610. /* under construction !*/
  611. /* under construction !*/
  612. /* under construction !*/
  613. /* under construction !*/
  614. /* under construction !*/
  615. /* under construction !*/
  616. /* under construction !*/
  617. /* under construction !*/
  618. /* under construction !*/
  619. /* under construction !*/
  620. /* under construction !*/
  621. /* under construction !*/
  622. /* under construction !*/
  623. /* under construction !*/
  624. /* under construction !*/
  625. /* under construction !*/
  626. /* under construction !*/
  627. /* under construction !*/
  628. /* under construction !*/
  629. /* under construction !*/
  630. /* under construction !*/
  631. /* under construction !*/
  632. /* under construction !*/
  633. /* under construction !*/
  634. /* under construction !*/
  635. /* under construction !*/
  636. /* under construction !*/
  637. /* under construction !*/
  638. /* under construction !*/
  639. /* under construction !*/
  640. /* under construction !*/
  641. /* under construction !*/
  642. /* under construction !*/
  643. /* under construction !*/
  644. /* under construction !*/
  645. /* under construction !*/
  646. /* under construction !*/
  647. /* under construction !*/
  648.                 #endif /* 0 */ 
  649.                     {
  650.                         if (start_cluster[0] == C_RA && HINDI_CONVERT_U8_U16(start_char) == DV_I)
  651.                         {
  652.                             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  653.                             //nFill++;start_char++;
  654.                             HINDI_FILL_CLUSTER();
  655.                             MMI_ASSERT(!(nFill > G_MAX));
  656.                             /* reordering logic */
  657.                             /* chhoti E */
  658.                             temp = start_cluster[nFill - 1];
  659.                             for (j = nFill - 1; j >= 0; j--)
  660.                             {
  661.                                 start_cluster[j + 1] = start_cluster[j];
  662.                             }
  663.                             start_cluster[j + 1] = temp;
  664.                             //end chhoti E
  665.                             //reordering logic                                         
  666.                             /* temp_array[0] = start_cluster[3];
  667.                                temp_array[1] = start_cluster[2];
  668.                                temp_array[2] = start_cluster[0];
  669.                                temp_array[3] = start_cluster[1];
  670.                                for(j=0; j<=3; j++)
  671.                                start_cluster[j] = temp_array[j]; */
  672.                             /* end reordering */
  673.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  674.                                return nFill; */
  675.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  676.                             MMI_ASSERT(!(nFill > G_MAX));
  677.                             /* start vijay changes done for the SIGN to be included in cluster */
  678.                             if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  679.                             {
  680.                                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  681.                                 //nFill++;start_char++;
  682.                                 HINDI_FILL_CLUSTER();
  683.                                 //start reordering logic Chhoti E
  684.                                 //START VIJAY PMT 20050728..COMMENTED AS NO REORDERING IS REQUIRED HERE
  685.                                 /* temp = start_cluster[nFill-2]; 
  686.                                    start_cluster[nFill-2]=start_cluster[nFill-1];
  687.                                    start_cluster[nFill-1] = temp; */
  688.                                 //END VIJAY PMT 20050728
  689.                                 //end          
  690.                                 MMI_ASSERT(!(nFill > G_MAX));
  691.                                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  692.                                    return nFill; */
  693.                                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  694.                             }
  695.                             /* vijay end */
  696.                         }
  697.                         else if (((start_cluster[0] == C_RA) &&
  698.                                   IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW))
  699.                         {
  700.                             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  701.                             //nFill++;start_char++;
  702.                             HINDI_FILL_CLUSTER();
  703.                             MMI_ASSERT(!(nFill > G_MAX));
  704.                             /* reordering logic */
  705.                             temp_array[0] = start_cluster[2];
  706.                             temp_array[1] = start_cluster[3];
  707.                             temp_array[2] = start_cluster[0];
  708.                             temp_array[3] = start_cluster[1];
  709.                             for (j = 0; j <= 3; j++)
  710.                             {
  711.                                 start_cluster[j] = temp_array[j];
  712.                             }
  713.                             /* end reordering logic */
  714.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  715.                                return nFill; */
  716.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  717.                             MMI_ASSERT(!(nFill > G_MAX));
  718.                             if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  719.                             {
  720.                                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  721.                                 //nFill++;start_char++;
  722.                                 HINDI_FILL_CLUSTER();
  723.                                 MMI_ASSERT(!(nFill > G_MAX));
  724.                                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  725.                                    return nFill; */
  726.                                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  727.                             }
  728.                         }
  729.                         else if (start_cluster[0] == C_RA)
  730.                         {
  731.                             if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
  732.                             {
  733.                                 nFill = hf_get_consonant_cluster(&start_cluster, &start_char, nFill);
  734.                             }
  735.                             MMI_ASSERT(!(nFill > G_MAX));
  736.                             if ((nFill % 2) && start_cluster[0] == C_RA)
  737.                             {
  738.                                 for (i = 0; i <= 1; i++)
  739.                                 {
  740.                                     temp_array[0] = start_cluster[0];
  741.                                     for (j = 0; j < nFill - 1; j++)
  742.                                     {
  743.                                         start_cluster[j] = start_cluster[j + 1];
  744.                                     }
  745.                                     start_cluster[j] = temp_array[0];
  746.                                 }
  747.                             }
  748.                             else
  749.                             {
  750.                                 temp = start_cluster[nFill - 1];
  751.                                 for (i = 0; i <= 1; i++)
  752.                                 {
  753.                                     temp_array[0] = start_cluster[0];
  754.                                     for (j = 0; j < nFill - 2; j++)
  755.                                     {
  756.                                         start_cluster[j] = start_cluster[j + 1];
  757.                                     }
  758.                                     start_cluster[j] = temp_array[0];
  759.                                 }
  760.                                 start_cluster[nFill - 1] = temp;
  761.                             }
  762.                             if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
  763.                             {
  764.                                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  765.                                 //nFill++;start_char++;
  766.                                 HINDI_FILL_CLUSTER();
  767.                                 MMI_ASSERT(!(nFill > G_MAX));
  768.                                 /* reordering logic */
  769.                                 temp = start_cluster[nFill - 1];
  770.                                 for (j = nFill - 1; j >= 0; j--)
  771.                                 {
  772.                                     start_cluster[j + 1] = start_cluster[j];
  773.                                 }
  774.                                 start_cluster[j + 1] = temp;
  775.                                 /* end */
  776.                                 MMI_ASSERT(!(nFill > G_MAX));
  777.                                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  778.                                    return nFill; */
  779.                                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  780.                                 if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU)
  781.                                 {
  782.                                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  783.                                     //nFill++;start_char++;
  784.                                     HINDI_FILL_CLUSTER();
  785.                                     MMI_ASSERT(!(nFill > G_MAX));
  786.                                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  787.                                        return nFill; */
  788.                                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  789.                                 }
  790.                             }
  791.                             else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW ||
  792.                                      IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  793.                             {
  794.                                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  795.                                 //nFill++;start_char++;
  796.                                 HINDI_FILL_CLUSTER();
  797.                                 MMI_ASSERT(!(nFill > G_MAX));
  798.                                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  799.                                    return nFill; */
  800.                                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  801.                                 if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  802.                                 {
  803.                                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  804.                                     //nFill++;start_char++;
  805.                                     HINDI_FILL_CLUSTER();
  806.                                     MMI_ASSERT(!(nFill > G_MAX));
  807.                                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  808.                                        return nFill; */
  809.                                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  810.                                 }
  811.                             }
  812.                         }
  813.                         else
  814.                         {
  815.                             if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
  816.                             {
  817.                                 nFill = hf_get_consonant_cluster(&start_cluster, &start_char, nFill);
  818.                             }
  819.                             MMI_ASSERT(!(nFill > G_MAX));
  820.                             /* vj30/11/04 */
  821.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  822.                                return nFill; */
  823.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  824.                             /* vj30/11/04 */
  825.                             if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
  826.                             {
  827.                                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char)
  828.                                 //nFill++;start_char++;
  829.                                 HINDI_FILL_CLUSTER();
  830.                                 MMI_ASSERT(!(nFill > G_MAX));
  831.                                 /* reordering logic */
  832.                                 temp = start_cluster[nFill - 1];
  833.                                 for (j = nFill - 1; j >= 0; j--)
  834.                                 {
  835.                                     start_cluster[j + 1] = start_cluster[j];
  836.                                 }
  837.                                 start_cluster[j + 1] = temp;
  838.                                 /* end */
  839.                                 MMI_ASSERT(!(nFill > G_MAX));
  840.                                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  841.                                    return nFill; */
  842.                                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  843.                                 if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU)
  844.                                 {
  845.                                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  846.                                     //nFill++;start_char++;
  847.                                     HINDI_FILL_CLUSTER();
  848.                                     MMI_ASSERT(!(nFill > G_MAX));
  849.                                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  850.                                        return nFill; */
  851.                                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  852.                                 }
  853.                             }
  854.                             else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW ||
  855.                                      IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  856.                             {
  857.                                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  858.                                 //nFill++;start_char++;
  859.                                 HINDI_FILL_CLUSTER();
  860.                                 MMI_ASSERT(!(nFill > G_MAX));
  861.                                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  862.                                    return nFill; */
  863.                                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  864.                                 if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  865.                                 {
  866.                                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  867.                                     //nFill++;start_char++;
  868.                                     HINDI_FILL_CLUSTER();
  869.                                     MMI_ASSERT(!(nFill > G_MAX));
  870.                                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  871.                                        return nFill; */
  872.                                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  873.                                 }
  874.                             }
  875.                         }
  876.                     }   /* if not ligature */
  877.                 }       /* if not RA */
  878.             }           /* end of if HALANT */
  879.             else
  880.             {
  881.                 if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
  882.                 {
  883.                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  884.                     //nFill++;start_char++;
  885.                     HINDI_FILL_CLUSTER();
  886.                     MMI_ASSERT(!(nFill > G_MAX));
  887.                     /* reordering logic */
  888.                     temp = start_cluster[0];
  889.                     start_cluster[0] = start_cluster[nFill - 1];
  890.                     start_cluster[nFill - 1] = temp;
  891.                     /* end */
  892.                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  893.                        return nFill; */
  894.                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  895.                     if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU || HINDI_CONVERT_U8_U16(start_char) == S_VISARGA)
  896.                     {
  897.                         //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  898.                         //nFill++;start_char++;
  899.                         HINDI_FILL_CLUSTER();
  900.                         MMI_ASSERT(!(nFill > G_MAX));
  901.                         /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  902.                            return nFill; */
  903.                         HF_END_CLUSTER(start_cluster, start_char, nFill);
  904.                     }
  905.                 }
  906.                 else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW)
  907.                 {
  908.                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  909.                     //nFill++;start_char++;
  910.                     HINDI_FILL_CLUSTER();
  911.                     MMI_ASSERT(!(nFill > G_MAX));
  912.                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  913.                        return nFill; */
  914.                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  915.                     if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  916.                     {
  917.                         //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  918.                         //nFill++;start_char++;
  919.                         HINDI_FILL_CLUSTER();
  920.                         MMI_ASSERT(!(nFill > G_MAX));
  921.                         /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  922.                            return nFill; */
  923.                         HF_END_CLUSTER(start_cluster, start_char, nFill);
  924.                     }
  925.                 }
  926.                 else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  927.                 {
  928.                     //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  929.                     //nFill++;start_char++;
  930.                     HINDI_FILL_CLUSTER();
  931.                     MMI_ASSERT(!(nFill > G_MAX));
  932.                     /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  933.                        return nFill; */
  934.                     HF_END_CLUSTER(start_cluster, start_char, nFill);
  935.                     if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW)
  936.                     {
  937.                         if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
  938.                         {
  939.                             //start_cluster[nFill] = *start_char;
  940.                             //nFill++;start_char++;
  941.                             HINDI_FILL_CLUSTER();
  942.                             /* reordering logic */
  943.                             temp = start_cluster[nFill - 1];
  944.                             for (j = nFill - 1; j >= 0; j--)
  945.                             {
  946.                                 start_cluster[j + 1] = start_cluster[j];
  947.                             }
  948.                             start_cluster[j + 1] = temp;
  949.                             /* end */
  950.                             MMI_ASSERT(!(nFill > G_MAX));
  951.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  952.                                return nFill; */
  953.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  954.                         }
  955.                         else
  956.                         {
  957.                             //start_cluster[nFill] = *start_char;
  958.                             //nFill++;start_char++;
  959.                             HINDI_FILL_CLUSTER();
  960.                             MMI_ASSERT(!(nFill > G_MAX));
  961.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  962.                                return nFill; */
  963.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  964.                         }
  965.                         if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
  966.                         {
  967.                             //start_cluster[nFill] = *start_char;
  968.                             //nFill++;start_char++;
  969.                             HINDI_FILL_CLUSTER();
  970.                             MMI_ASSERT(!(nFill > G_MAX));
  971.                             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  972.                                return nFill; */
  973.                             HF_END_CLUSTER(start_cluster, start_char, nFill);
  974.                         }
  975.                     }
  976.                 }
  977.             }   /* if not halant */
  978.             start_cluster[nFill] = (U16) NULL;
  979.             cluster_start_p += (nFill * 2);
  980.             return nFill;
  981.             break;
  982.         }       /* end of if first character is consonant */
  983.             /* else if( ch == INDVOW ) */
  984.         case INDVOW:
  985.         {
  986.             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  987.             //nFill++;start_char++;
  988.             HINDI_FILL_CLUSTER();
  989.             MMI_ASSERT(!(nFill > G_MAX));
  990.             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  991.                return nFill; */
  992.             HF_END_CLUSTER(start_cluster, start_char, nFill);
  993.             /* START PMTFARHAD 20050224 */
  994.             if (HINDI_CONVERT_U8_U16(start_char) == S_CHANDRA_BINDU || HINDI_CONVERT_U8_U16(start_char) == S_BINDU ||
  995.                 HINDI_CONVERT_U8_U16(start_char) == S_VISARGA)
  996.                 /* END PMTFARHAD 20050224 */
  997.             {
  998.                 //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  999.                 //nFill++;start_char++;
  1000.                 HINDI_FILL_CLUSTER();
  1001.                 MMI_ASSERT(!(nFill > G_MAX));
  1002.                 /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  1003.                    return nFill; */
  1004.                 HF_END_CLUSTER(start_cluster, start_char, nFill);
  1005.             }
  1006.             start_cluster[nFill] = (U16) NULL;
  1007.             cluster_start_p += (nFill * 2);
  1008.             return nFill;
  1009.             break;
  1010.         }
  1011.             /* else if ( ch == DEPVOW ) */
  1012.         case DEPVOW:
  1013.         {
  1014.             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  1015.             //nFill++;start_char++;
  1016.             HINDI_FILL_CLUSTER();
  1017.             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  1018.                return nFill;
  1019.                else
  1020.                if(nFill > G_MAX) return nFill; */
  1021.             start_cluster[nFill] = (U16) NULL;
  1022.             cluster_start_p += (nFill * 2);
  1023.             return nFill;
  1024.             break;
  1025.         }
  1026.             /* else if ( ch == SIGN ) */
  1027.         case SIGN:
  1028.         {
  1029.             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  1030.             //nFill++;start_char++;
  1031.             HINDI_FILL_CLUSTER();
  1032.             /* if( hf_end_cluster(start_cluster,start_char,nFill) )
  1033.                return nFill;
  1034.                else
  1035.                if(nFill > G_MAX) return nFill; */
  1036.             start_cluster[nFill] = (U16) NULL;
  1037.             cluster_start_p += (nFill * 2);
  1038.             return nFill;
  1039.             break;
  1040.         }
  1041.             /* any character other than Hindi */
  1042.             /* else */
  1043.         default:
  1044.         {
  1045.             //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
  1046.             //nFill++;start_char++;
  1047.             HINDI_FILL_CLUSTER();
  1048.             start_cluster[nFill] = (U16) NULL;
  1049.             cluster_start_p += (nFill * 2);
  1050.             return nFill;
  1051.             break;
  1052.         }
  1053.     }
  1054.     return 0;
  1055. }   /* end of function get_cluster */
  1056. /* 17th nov start */
  1057. /*****************************************************************************
  1058.  * FUNCTION
  1059.  *  hf_get_consonant_cluster
  1060.  * DESCRIPTION
  1061.  *  
  1062.  * PARAMETERS
  1063.  *  start_cluster       [?]         
  1064.  *  start_char          [?]         
  1065.  *  nentry              [IN]        
  1066.  * RETURNS
  1067.  *  
  1068.  *****************************************************************************/
  1069. S32 hf_get_consonant_cluster(PU16 *start_cluster, PU8 *start_char, S32 nentry)
  1070. {
  1071.     /*----------------------------------------------------------------*/
  1072.     /* Local Variables                                                */
  1073.     /*----------------------------------------------------------------*/
  1074.     /*----------------------------------------------------------------*/
  1075.     /* Code Body                                                      */
  1076.     /*----------------------------------------------------------------*/
  1077.     /* if( **start_char == S_HALANT )
  1078.        { */
  1079.     (*start_cluster)[nentry] = HINDI_CONVERT_U8_U16(*start_char);
  1080.     nentry++;
  1081.     (*start_char) += 2;
  1082.     if (nentry == G_MAX - 2)
  1083.     {
  1084.         return nentry;
  1085.     }
  1086.     if (*start_char == cluster_end_p)
  1087.     {
  1088.         return nentry;
  1089.     }
  1090.     if (IdentifyCharacter(HINDI_CONVERT_U8_U16(*start_char)) == CON)
  1091.     {
  1092.         (*start_cluster)[nentry] = HINDI_CONVERT_U8_U16(*start_char);
  1093.         nentry++;
  1094.         (*start_char) += 2;
  1095.         MMI_ASSERT(!(nentry > G_MAX));
  1096.         if (*start_char == cluster_end_p)
  1097.         {
  1098.             return nentry;
  1099.         }
  1100.         if (nentry > G_MAX)
  1101.         {
  1102.             return nentry;
  1103.         }
  1104.         if (HINDI_CONVERT_U8_U16(*start_char) == S_HALANT)
  1105.         {
  1106.             nentry = hf_get_consonant_cluster(start_cluster, start_char, nentry);
  1107.         }
  1108.     }
  1109.     else
  1110.     {
  1111.         return nentry;
  1112.     }
  1113.     /* }
  1114.        else
  1115.        return nentry; */
  1116.     return nentry;
  1117. }
  1118. /* 17th nov end */
  1119. #if 0
  1120. /* under construction !*/
  1121. /* under construction !*/
  1122. /* under construction !*/
  1123. /* under construction !*/
  1124. /* under construction !*/
  1125. /* under construction !*/
  1126. /* under construction !*/
  1127. /* under construction !*/
  1128. /* under construction !*/
  1129. /* under construction !*/
  1130. /* under construction !*/
  1131. /* under construction !*/
  1132. /* under construction !*/
  1133. /* under construction !*/
  1134. /* under construction !*/
  1135. /* under construction !*/
  1136. /* under construction !*/
  1137. /* under construction !*/
  1138. /* under construction !*/
  1139. /* under construction !*/
  1140. /* under construction !*/
  1141. /* under construction !*/
  1142. /* under construction !*/
  1143. #endif /* 0 */ 
  1144. /*****************************************************************************
  1145.  * FUNCTION
  1146.  *  hf_get_next_cluster_p
  1147.  * DESCRIPTION
  1148.  *  
  1149.  * PARAMETERS
  1150.  *  text_p          [IN]        
  1151.  *  cursor_p        [IN]        
  1152.  * RETURNS
  1153.  *  
  1154.  *****************************************************************************/
  1155. PU8 hf_get_next_cluster_p(PU8 text_p, PU8 cursor_p)
  1156. {
  1157.     /*----------------------------------------------------------------*/
  1158.     /* Local Variables                                                */
  1159.     /*----------------------------------------------------------------*/
  1160.     PU8 current_cursor_p = text_p;
  1161.     PU8 prev_cursor_p = text_p;
  1162.     U16 cluster_buffer[G_MAX];  /* just to fill the cluster for the purpose of getting its length */
  1163.     S32 len = 0;
  1164.     PU8 cursor_pointer = cursor_p;
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Code Body                                                      */
  1167.     /*----------------------------------------------------------------*/
  1168.     cursor_pointer += 2;
  1169.     if (HINDI_CONVERT_U8_U16(cursor_p) == (U16) NULL)
  1170.     {
  1171.         return cursor_p;
  1172.     }
  1173.     else if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
  1174.     {
  1175.         init_cluster_start_p(text_p);
  1176.         init_cluster_end_p(cursor_p);
  1177.     #if 0   /* No use as this condition never gets true */
  1178. /* under construction !*/
  1179. /* under construction !*/
  1180. /* under construction !*/
  1181. /* under construction !*/
  1182. /* under construction !*/
  1183. /* under construction !*/
  1184. /* under construction !*/
  1185. /* under construction !*/
  1186.     #endif /* 0 */ /* TARUN 20050108 */
  1187.         len = hf_get_cluster(cluster_buffer);
  1188.         current_cursor_p += (len * 2);
  1189.         return current_cursor_p;
  1190.     }
  1191.     else
  1192.     {
  1193.         return cursor_pointer;
  1194.     }
  1195. }
  1196. /*****************************************************************************
  1197.  * FUNCTION
  1198.  *  hf_get_prev_cluster_p
  1199.  * DESCRIPTION
  1200.  *  
  1201.  * PARAMETERS
  1202.  *  text_p          [IN]        
  1203.  *  cursor_p        [IN]        
  1204.  * RETURNS
  1205.  *  
  1206.  *****************************************************************************/
  1207. PU8 hf_get_prev_cluster_p(PU8 text_p, PU8 cursor_p)
  1208. {
  1209.     /*----------------------------------------------------------------*/
  1210.     /* Local Variables                                                */
  1211.     /*----------------------------------------------------------------*/
  1212.     PU8 current_cursor_p = text_p;
  1213.     PU8 prev_cursor_p = text_p;
  1214.     S32 len = 0;
  1215.     U16 cluster_buffer[G_MAX];
  1216.     PU8 cursor_pointer = cursor_p;
  1217.     /*----------------------------------------------------------------*/
  1218.     /* Code Body                                                      */
  1219.     /*----------------------------------------------------------------*/
  1220.     cursor_pointer -= 2;
  1221.     if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
  1222.     {
  1223.         init_cluster_start_p(text_p);
  1224.         init_cluster_end_p(cursor_p);
  1225.         while (current_cursor_p != cursor_p)
  1226.         {
  1227.             len = hf_get_cluster(cluster_buffer);
  1228.             prev_cursor_p = current_cursor_p;
  1229.             current_cursor_p += (len * 2);
  1230.             if (len == 0)
  1231.             {
  1232.                 break;
  1233.             }
  1234.         }
  1235.         return prev_cursor_p;
  1236.     }
  1237.     else
  1238.     {
  1239.         return cursor_pointer;
  1240.     }
  1241. }
  1242. /*****************************************************************************
  1243.  * FUNCTION
  1244.  *  hf_size_of_current_cluster
  1245.  * DESCRIPTION
  1246.  *  
  1247.  * PARAMETERS
  1248.  *  text_p          [IN]        
  1249.  *  cursor_p        [IN]        
  1250.  *  cursor          [IN]        
  1251.  * RETURNS
  1252.  *  
  1253.  *****************************************************************************/
  1254. S32 hf_size_of_current_cluster(PU8 text_p, PU8 cursor_p, U16 cursor)
  1255. {
  1256.     /*----------------------------------------------------------------*/
  1257.     /* Local Variables                                                */
  1258.     /*----------------------------------------------------------------*/
  1259.     PU8 muv_cursor_p = text_p;
  1260.     S32 len = 0;
  1261.     S32 pixel_size = 0;
  1262.     U16 cluster_buffer[G_MAX];
  1263.     U16 glyphoutput[G_MAX];
  1264.     PU8 cursor_pointer = cursor_p;
  1265.     /*----------------------------------------------------------------*/
  1266.     /* Code Body                                                      */
  1267.     /*----------------------------------------------------------------*/
  1268.     if (text_p == cursor_p)
  1269.     {
  1270.         return 0;
  1271.     }
  1272.     cursor_pointer -= 2;
  1273.     if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
  1274.     {
  1275.         init_cluster_start_p(text_p);
  1276.         init_cluster_end_p(cursor_p);
  1277.         while (muv_cursor_p != cursor_p)
  1278.         {
  1279.             len = hf_get_cluster(cluster_buffer);
  1280.             muv_cursor_p += (len * 2);
  1281.             if (len == 0)
  1282.             {
  1283.                 break;
  1284.             }
  1285.         }
  1286.         hf_hindi_rules(glyphoutput, cluster_buffer, len);
  1287.         if (cursor)
  1288.         {
  1289.             pixel_size = hf_get_string_width_height(glyphoutput);
  1290.         }
  1291.         else
  1292.         {
  1293.             pixel_size = hf_get_string_Dwidth_height(glyphoutput);
  1294.         }
  1295.         return pixel_size;
  1296.     }
  1297.     else
  1298.     {
  1299.         pixel_size = gui_get_character_width(HINDI_CONVERT_U8_U16(cursor_pointer));
  1300.         cursor_pointer_end_current_cluster = NULL;
  1301.         return pixel_size;
  1302.     }
  1303. }
  1304. #if 0
  1305. /* under construction !*/
  1306. /* under construction !*/
  1307. /* under construction !*/
  1308. /* under construction !*/
  1309. /* under construction !*/
  1310. /* under construction !*/
  1311. /* under construction !*/
  1312. /* under construction !*/
  1313. /* under construction !*/
  1314. /* under construction !*/
  1315. /* under construction !*/
  1316. /* under construction !*/
  1317. /* under construction !*/
  1318. /* under construction !*/
  1319. /* under construction !*/
  1320. /* under construction !*/
  1321. /* under construction !*/
  1322. /* under construction !*/
  1323. /* under construction !*/
  1324. /* under construction !*/
  1325. /* under construction !*/
  1326. /* under construction !*/
  1327. /* under construction !*/
  1328. /* under construction !*/
  1329. /* under construction !*/
  1330. /* under construction !*/
  1331. /* under construction !*/
  1332. /* under construction !*/
  1333. /* under construction !*/
  1334. /* under construction !*/
  1335. /* under construction !*/
  1336. /* under construction !*/
  1337. /* under construction !*/
  1338. /* under construction !*/
  1339. /* under construction !*/
  1340. /* under construction !*/
  1341. /* under construction !*/
  1342. /* under construction !*/
  1343. /* under construction !*/
  1344. /* under construction !*/
  1345. /* under construction !*/
  1346. /* under construction !*/
  1347. /* under construction !*/
  1348. /* under construction !*/
  1349. /* under construction !*/
  1350. /* under construction !*/
  1351. /* under construction !*/
  1352. /* under construction !*/
  1353. /* under construction !*/
  1354. /* under construction !*/
  1355. /* under construction !*/
  1356. /* under construction !*/
  1357. /* under construction !*/
  1358. /* under construction !*/
  1359. /* under construction !*/
  1360. /* under construction !*/
  1361. /* under construction !*/
  1362. /* under construction !*/
  1363. /* under construction !*/
  1364. /* under construction !*/
  1365. /* under construction !*/
  1366. /* under construction !*/
  1367. /* under construction !*/
  1368. #endif /* 0 */ 
  1369. /*****************************************************************************
  1370.  * FUNCTION
  1371.  *  hf_get_current_cluster
  1372.  * DESCRIPTION
  1373.  *  
  1374.  * PARAMETERS
  1375.  *  text_p              [IN]        
  1376.  *  cursor_p            [IN]        
  1377.  *  output_buffer       [IN]        
  1378.  * RETURNS
  1379.  *  
  1380.  *****************************************************************************/
  1381. S32 hf_get_current_cluster(PU8 text_p, PU8 cursor_p, PU16 output_buffer)
  1382. {
  1383.     /*----------------------------------------------------------------*/
  1384.     /* Local Variables                                                */
  1385.     /*----------------------------------------------------------------*/
  1386.     PU8 cursor_pointer = cursor_p;
  1387.     PU8 muv_cursor_p = text_p;
  1388.     S32 len = 0;
  1389.     U16 glyphoutput[G_MAX];
  1390.     /*----------------------------------------------------------------*/
  1391.     /* Code Body                                                      */
  1392.     /*----------------------------------------------------------------*/
  1393.     cursor_pointer_end_current_cluster = cursor_pointer;
  1394.     cursor_pointer -= 2;
  1395.     if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
  1396.     {
  1397.         init_cluster_start_p(text_p);
  1398.         init_cluster_end_p(cursor_p);
  1399.         while (muv_cursor_p != cursor_p)
  1400.         {
  1401.             len = hf_get_cluster(output_buffer);
  1402.             muv_cursor_p += (len * 2);
  1403.             if (len == 0)
  1404.             {
  1405.                 break;
  1406.             }
  1407.         }
  1408.         memset(glyphoutput, '', len);
  1409.         hf_hindi_rules(glyphoutput, output_buffer, len);
  1410.         /* vj 30/11/04 */
  1411.         memcpy(output_buffer, glyphoutput, UCS2Strlen((const S8*)glyphoutput) * 2);
  1412.         output_buffer[UCS2Strlen((const S8*)glyphoutput)] = (U16) NULL;
  1413.         /* vj 30/11/04 */
  1414.         cursor_pointer_end_current_cluster = NULL;
  1415.         return TRUE;
  1416.     }
  1417.     else
  1418.     {
  1419.         init_cluster_start_p(cursor_pointer);
  1420.         hf_get_cluster(output_buffer);
  1421.         hf_hindi_rules(glyphoutput, output_buffer, 1);
  1422.         /* vj 30/11/04 */
  1423.         memcpy(output_buffer, glyphoutput, 2);
  1424.         output_buffer[UCS2Strlen((const S8*)glyphoutput)] = (U16) NULL;
  1425.         /* vj 30/11/04 */
  1426.         cursor_pointer_end_current_cluster = NULL;
  1427.         return TRUE;
  1428.     }
  1429. }
  1430. /* Start Farhad 30-04-2004 */
  1431. //void reset_hindi_params(void)
  1432. //{
  1433. //      prev_char_text_x = 0;
  1434. //      prev_char_dwidth = 0;
  1435. //      prev_char_width = 0;
  1436. //      new_line = 1;
  1437. //}
  1438. //START TARUN PMT 20050128
  1439. extern BOOL r2lMMIFlag;
  1440. /* END TARUN PMT 20050128 */
  1441. /*****************************************************************************
  1442.  * FUNCTION
  1443.  *  get_text_x
  1444.  * DESCRIPTION
  1445.  *  
  1446.  * PARAMETERS
  1447.  *  ptext_x                 [?]         
  1448.  *  current_character       [IN]        
  1449.  *  text_y                  [IN]        
  1450.  *  d_width                 [IN]        
  1451.  *  width                   [IN]        
  1452.  * RETURNS
  1453.  *  void
  1454.  *****************************************************************************/
  1455. void get_text_x(S32 *ptext_x, U16 current_character, S32 text_y, U16 d_width, U16 width)
  1456. {
  1457.     /*----------------------------------------------------------------*/
  1458.     /* Local Variables                                                */
  1459.     /*----------------------------------------------------------------*/
  1460.     /* START TARUN PMT 20050128 */
  1461.     U8 is_hindi = 1;
  1462.     /*----------------------------------------------------------------*/
  1463.     /* Code Body                                                      */
  1464.     /*----------------------------------------------------------------*/
  1465.     /* START FARHAD PIXTELMTK  20050217 */
  1466.     if (current_character >= 0x0E01 && current_character <= 0x0E7F)
  1467.     {
  1468.         prev_char_text_x = *ptext_x;
  1469.         prev_char_dwidth = width;
  1470.         prev_char_width = width;
  1471.         /* START PMTFARHAD 20050224 */
  1472.         if (IsThaiAboveLineChar(current_character))
  1473.         {
  1474.             prev_char_dwidth = 0;
  1475.             prev_char_width = 0;
  1476.         }
  1477.         prev_character = current_character;
  1478.         /* END PMTFARHAD 20050224 */
  1479.         return;
  1480.     }
  1481.     /* END FARHAD PIXTELMTK  20050217 */
  1482.     if (!(UI_HINDI_CHARACTER_UCS2_RANGE(current_character)))
  1483.     {
  1484.         d_width = width;
  1485.         prev_char_dwidth = prev_char_width;
  1486.         is_hindi = 0;
  1487.         if (r2lMMIFlag)
  1488.         {
  1489.             return;
  1490.         }
  1491.     }
  1492.     /* END TARUN PMT 20050128 */
  1493.     if (new_line)
  1494.     {
  1495.         new_line = 0;
  1496.         if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
  1497.         {
  1498.             *ptext_x = *ptext_x - hf_padding;
  1499.         }
  1500.         prev_char_text_x = *ptext_x;
  1501.         /* Get_CharWidthHeight_New( current_character,&prev_char_dwidth); */
  1502.         prev_char_dwidth = d_width;
  1503.         prev_char_width = width;
  1504.         prev_character = current_character;
  1505.         return;
  1506.     }
  1507.     /* PMT START MAUI_00223197 */
  1508.     if ((current_character != S_VISARGA) && UI_HINDI_SIGN_RANGE(current_character))
  1509.         /* PMT END MAUI_00223197 */
  1510.     {
  1511.         *ptext_x = prev_char_text_x;
  1512.         prev_char_dwidth = prev_char_dwidth;
  1513.         prev_char_width = prev_char_width;
  1514.     }
  1515.     else
  1516.     {
  1517.         if (is_hindi)
  1518.         {
  1519.             if (!(UI_HINDI_CHARACTER_UCS2_RANGE(prev_character)))
  1520.             {
  1521.                 prev_char_text_x -= hf_padding;
  1522.             }
  1523.             /* if(current_character==59774|| current_character==59775)
  1524.                {
  1525.                *ptext_x = prev_char_dwidth + prev_char_text_x;
  1526.                return;
  1527.                } */
  1528.         }
  1529.         *ptext_x = prev_char_dwidth + prev_char_text_x;
  1530.         prev_char_text_x = *ptext_x;
  1531.         /* Get_CharWidthHeight_New( current_character,&prev_char_dwidth); */
  1532.         prev_char_dwidth = d_width;
  1533.         prev_char_width = width;
  1534.     }
  1535.     prev_character = current_character;
  1536.     return;
  1537. }
  1538. /* END */
  1539. /*****************************************************************************
  1540.  * FUNCTION
  1541.  *  get_multitap_text_x
  1542.  * DESCRIPTION
  1543.  *  
  1544.  * PARAMETERS
  1545.  *  ptext_x                 [?]         
  1546.  *  current_character       [IN]        
  1547.  *  Char_Range              [IN]        
  1548.  *  check_char              [IN]        
  1549.  * RETURNS
  1550.  *  void
  1551.  *****************************************************************************/
  1552. void get_multitap_text_x(S32 *ptext_x, U16 current_character, S32 Char_Range, S32 check_char)
  1553. {
  1554.     /*----------------------------------------------------------------*/
  1555.     /* Local Variables                                                */
  1556.     /*----------------------------------------------------------------*/
  1557.     static S32 prev_char_mtext_x = 0;
  1558.     static S32 prev_char_mdwidth = 0;
  1559.     S32 character_height;
  1560.     S32 text_x;
  1561.     S32 mtext_gap = 5;
  1562.     /*----------------------------------------------------------------*/
  1563.     /* Code Body                                                      */
  1564.     /*----------------------------------------------------------------*/
  1565.     /* MMI_ASSERT(!(*ptext_x > 128)); */
  1566.     text_x = *ptext_x;
  1567.     if (!(check_char))
  1568.     {
  1569.         switch (Char_Range)
  1570.         {
  1571.             case 1:
  1572.             {
  1573.                 *ptext_x = 59;
  1574.                 break;
  1575.             }
  1576.             case 2:
  1577.             {
  1578.                 *ptext_x = 54;
  1579.                 break;
  1580.             }
  1581.             case 3:
  1582.             {
  1583.                 *ptext_x = 49;
  1584.                 break;
  1585.             }
  1586.             case 4:
  1587.             {
  1588.                 *ptext_x = 44;
  1589.                 break;
  1590.             }
  1591.             case 5:
  1592.             {
  1593.                 *ptext_x = 39;
  1594.                 break;
  1595.             }
  1596.             case 6:
  1597.             {
  1598.                 *ptext_x = 35;
  1599.                 break;
  1600.             }
  1601.             case 7:
  1602.             {
  1603.                 *ptext_x = 30;
  1604.                 break;
  1605.             }
  1606.             case 8:
  1607.             {
  1608.                 *ptext_x = 25;
  1609.                 break;
  1610.             }
  1611.             case 9:
  1612.             {
  1613.                 *ptext_x = 20;
  1614.                 break;
  1615.             }
  1616.             case 10:
  1617.             {
  1618.                 *ptext_x = 15;
  1619.                 break;
  1620.             }
  1621.             case 11:
  1622.             {
  1623.                 *ptext_x = 10;
  1624.                 break;
  1625.             }
  1626.             case 12:
  1627.                 /* START VIJAY PMT 20050725 */
  1628.             case 13:
  1629.             case 14:
  1630.                 /* END VIJAY PMT 20050725 */
  1631.             {
  1632.                 /* START VIJAY PMT 20050720.....initial value  = 5 */
  1633.                 *ptext_x = 7;
  1634.                 /* END VIJAY PMT 20050725 */
  1635.                 break;
  1636.             }
  1637.             default:
  1638.             {
  1639.                 *ptext_x = 3;
  1640.                 break;
  1641.             }
  1642.         }
  1643.         /*
  1644.          * if(Char_Range == 1)
  1645.          * *ptext_x = 59;
  1646.          * else if(Char_Range == 2)
  1647.          * *ptext_x = 54;
  1648.          * else if(Char_Range == 3)
  1649.          * *ptext_x = 49;
  1650.          * else if(Char_Range == 4)
  1651.          * *ptext_x = 44;
  1652.          * else if(Char_Range == 5)
  1653.          * *ptext_x = 39;
  1654.          * else if(Char_Range == 6)
  1655.          * *ptext_x = 35;
  1656.          * else if(Char_Range == 7)
  1657.          * *ptext_x = 30;
  1658.          * else if(Char_Range == 8)
  1659.          * *ptext_x = 25;
  1660.          * else if(Char_Range == 9)
  1661.          * *ptext_x = 20;
  1662.          * else if(Char_Range == 10)
  1663.          * *ptext_x = 15;
  1664.          * else if(Char_Range == 11)
  1665.          * *ptext_x = 10;
  1666.          * else if(Char_Range == 12)
  1667.          * *ptext_x = 5;
  1668.          * else
  1669.          * *ptext_x = 0;
  1670.          */
  1671.         prev_char_mtext_x = *ptext_x;
  1672.         Get_CharWidthHeight(current_character, &prev_char_mdwidth, &character_height);
  1673.         return;
  1674.     }
  1675.     /* if(HF_DEPVOW_RANGE(current_character)|| HF_SIGN_RANGE(current_character)) */
  1676.     if (IdentifyCharacter(current_character) == DEPVOW || IdentifyCharacter(current_character) == SIGN)
  1677.     {
  1678.         text_x = prev_char_mdwidth + prev_char_mtext_x + mtext_gap;
  1679.     }
  1680.     else
  1681.     {
  1682.         text_x = prev_char_mdwidth + prev_char_mtext_x;
  1683.     }
  1684.     Get_CharWidthHeight(current_character, &prev_char_mdwidth, &character_height);
  1685.     prev_char_mtext_x = text_x;
  1686.     if (current_character == DV_II)
  1687.     {
  1688.         *ptext_x = text_x + mtext_gap;
  1689.     }
  1690.     else
  1691.     {
  1692.         *ptext_x = text_x;
  1693.     }
  1694. }
  1695. /* start farhad 5-11-04  api to get the string width and height it uses width and dwidth both. */
  1696. /*****************************************************************************
  1697.  * FUNCTION
  1698.  *  hf_get_string_width_height
  1699.  * DESCRIPTION
  1700.  *  
  1701.  * PARAMETERS
  1702.  *  text        [IN]        
  1703.  * RETURNS
  1704.  *  
  1705.  *****************************************************************************/
  1706. S32 hf_get_string_width_height(UI_string_type text)
  1707. {
  1708.     /*----------------------------------------------------------------*/
  1709.     /* Local Variables                                                */
  1710.     /*----------------------------------------------------------------*/
  1711.     S32 w, h;
  1712.     /*----------------------------------------------------------------*/
  1713.     /* Code Body                                                      */
  1714.     /*----------------------------------------------------------------*/
  1715.     /* START VIJAY PMT 20050728 */
  1716.     hf_disable_hindi_rules_parsing();
  1717.     gui_measure_string(text, &w, &h);
  1718.     hf_enable_hindi_rules_parsing();
  1719.     /* END VIJAY PMT 20050728 */
  1720.     return (w);
  1721. }
  1722. /* api that use dwidth only */
  1723. /*****************************************************************************
  1724.  * FUNCTION
  1725.  *  hf_get_string_Dwidth_height
  1726.  * DESCRIPTION
  1727.  *  
  1728.  * PARAMETERS
  1729.  *  text        [IN]        
  1730.  * RETURNS
  1731.  *  
  1732.  *****************************************************************************/
  1733. S32 hf_get_string_Dwidth_height(UI_string_type text)
  1734. {
  1735.     /*----------------------------------------------------------------*/
  1736.     /* Local Variables                                                */
  1737.     /*----------------------------------------------------------------*/
  1738.     S32 w, h;
  1739.     /*----------------------------------------------------------------*/
  1740.     /* Code Body                                                      */
  1741.     /*----------------------------------------------------------------*/
  1742.     /* START VIJAY PMT 20050728 */
  1743.     hf_disable_hindi_rules_parsing();
  1744.     gui_measure_string(text, &w, &h);
  1745.     hf_enable_hindi_rules_parsing();
  1746.     /* END VIJAY PMT 20050728 */
  1747.     return (w);
  1748. }
  1749. /* end 5-11-04 */
  1750. /* Start vijay */
  1751. #if 0
  1752. /* under construction !*/
  1753. /* under construction !*/
  1754. /* under construction !*/
  1755. /* under construction !*/
  1756. /* under construction !*/
  1757. /* under construction !*/
  1758. /* under construction !*/
  1759. /* under construction !*/
  1760. /* under construction !*/
  1761. /* under construction !*/
  1762. /* under construction !*/
  1763. #endif /* 0 */ 
  1764. /* End */
  1765. /* start farhad 08122004 */
  1766. //void reset_hindi_bordered_params(void)
  1767. //{
  1768. //      prev_char_btext_x = 0;
  1769. //      prev_char_bdwidth = 0;
  1770. //      new_bline = 1;
  1771. //}
  1772. /*****************************************************************************
  1773.  * FUNCTION
  1774.  *  get_bordered_text_x
  1775.  * DESCRIPTION
  1776.  *  
  1777.  * PARAMETERS
  1778.  *  ptext_x                 [?]         
  1779.  *  current_character       [IN]        
  1780.  *  text_y                  [IN]        
  1781.  * RETURNS
  1782.  *  void
  1783.  *****************************************************************************/
  1784. void get_bordered_text_x(S32 *ptext_x, U16 current_character, S32 text_y)
  1785. {
  1786.     /*----------------------------------------------------------------*/
  1787.     /* Local Variables                                                */
  1788.     /*----------------------------------------------------------------*/
  1789.     S32 character_height = 0;
  1790.     /*----------------------------------------------------------------*/
  1791.     /* Code Body                                                      */
  1792.     /*----------------------------------------------------------------*/
  1793.     /* MMI_ASSERT(!(*ptext_x > 128)); */
  1794.     if (new_bline)
  1795.     {
  1796.         new_bline = 0;
  1797.         prev_char_btext_x = *ptext_x;
  1798.         Get_CharWidthHeight(current_character, &prev_char_bdwidth, &character_height);
  1799.         return;
  1800.     }
  1801.     /* PMT START MAUI_00223197 */
  1802.     if ((current_character != S_VISARGA) && UI_HINDI_SIGN_RANGE(current_character))
  1803.         /* PMT END MAUI_00223197 */
  1804.     {
  1805.         *ptext_x = prev_char_btext_x;
  1806.         prev_char_bdwidth = prev_char_bdwidth;
  1807.     }
  1808.     else
  1809.     {
  1810.         *ptext_x = prev_char_bdwidth + prev_char_btext_x;
  1811.         prev_char_btext_x = *ptext_x;
  1812.         Get_CharWidthHeight(current_character, &prev_char_bdwidth, &character_height);
  1813.     }
  1814.     return;
  1815. }
  1816. //void reset_use_multitap(void)
  1817. //{
  1818. //      use_multitap=0;
  1819. //}
  1820. //
  1821. //void set_use_multitap(void)
  1822. //{
  1823. //      use_multitap=1;
  1824. //}
  1825. //
  1826. //S32 whether_use_multitap(void)
  1827. //{
  1828. //      return use_multitap;
  1829. //}
  1830. //S32 hf_disable_hindi_rules_parsing(void)
  1831. //{
  1832. //      parse_hindi=0;
  1833. //}
  1834. //
  1835. //S32 hf_enable_hindi_rules_parsing(void)
  1836. //{
  1837. //      parse_hindi=1;
  1838. //}
  1839. //
  1840. //S32 hf_is_hindi_rules_parsing(void)
  1841. //{
  1842. //      return parse_hindi;
  1843. //}
  1844. //void hf_disable_hindi_reset_hindi_params(void)
  1845. //{
  1846. //      reset_hindi_pms=0;
  1847. //}
  1848. //
  1849. //hf_enable_hindi_reset_hindi_params(void)
  1850. //{
  1851. //      reset_hindi_pms=1;
  1852. //}
  1853. //
  1854. //hf_is_reset_hindi_params(void)
  1855. //{
  1856. //      return reset_hindi_pms;
  1857. //}
  1858. //End farhad 08122004
  1859. //START FARHAD PMT 20050211
  1860. /*****************************************************************************
  1861.  * FUNCTION
  1862.  *  get_hindi_rules_for_whole_string
  1863.  * DESCRIPTION
  1864.  *  
  1865.  * PARAMETERS
  1866.  *  String      [IN]        
  1867.  * RETURNS
  1868.  *  void
  1869.  *****************************************************************************/
  1870. void get_hindi_rules_for_whole_string(PU8 String)
  1871. {
  1872.     /*----------------------------------------------------------------*/
  1873.     /* Local Variables                                                */
  1874.     /*----------------------------------------------------------------*/
  1875.     U8 StringArray[2048];
  1876.     U16 cluster_fill[G_MAX];
  1877.     U16 glyph_output[G_MAX];
  1878.     S32 Len;
  1879.     S32 cluster_length;
  1880.     U16 hindi_present = 0;
  1881.     U8 *temp_string = String;
  1882.     U16 unicode = 0;
  1883.     U16 Fill = 0;
  1884.     U16 clFill = 0;
  1885.     /*----------------------------------------------------------------*/
  1886.     /* Code Body                                                      */
  1887.     /*----------------------------------------------------------------*/
  1888.     while ((temp_string[clFill] != '' || temp_string[clFill + 1] != '') && !hindi_present)
  1889.     {
  1890.         unicode = temp_string[clFill];
  1891.         unicode |= (temp_string[clFill + 1] << 8);
  1892.         if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
  1893.         {
  1894.             hindi_present = 1;
  1895.         }
  1896.         clFill += 2;
  1897.     }
  1898.     if (hindi_present)
  1899.     {
  1900.         init_cluster_start_p(String);
  1901.         init_cluster_end_p(String);
  1902.         while (temp_string[0] != '' || temp_string[1] != '')
  1903.         {
  1904.             clFill = 0;
  1905.             unicode = temp_string[0];
  1906.             unicode |= (temp_string[1] << 8);
  1907.             cluster_length = hf_get_cluster( /* (PU16) */ cluster_fill);
  1908.             if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
  1909.             {
  1910.                 Len = hf_hindi_rules( /* (PU16) */ glyph_output, /* (PU16) */ cluster_fill, cluster_length);
  1911.                 temp_string += cluster_length * 2;
  1912.                 while (glyph_output[clFill] != '' /* || glyph_output[clFill+1]!='' */ )
  1913.                 {
  1914.                     StringArray[Fill++] = (U8) (glyph_output[clFill] & 0x00ff);
  1915.                     StringArray[Fill++] = (U8) (glyph_output[clFill++] >> 8) & 0x00ff;
  1916.                 }
  1917.             }
  1918.             else
  1919.             {
  1920.                 StringArray[Fill++] = temp_string[0];
  1921.                 StringArray[Fill++] = temp_string[1];
  1922.                 temp_string += 2;
  1923.             }
  1924.         }
  1925.         StringArray[Fill++] = NULL;
  1926.         StringArray[Fill++] = NULL;
  1927.         memcpy(String, StringArray, Fill);
  1928.         /* String[Fill]=NULL; */
  1929.     }
  1930. }
  1931. /* END FARHAD PMT 20050211 */
  1932. /* PMT RAKESH START 20061006 */
  1933. /*****************************************************************************
  1934.  * FUNCTION
  1935.  *  set_current_language_for_hindi_rules
  1936.  * DESCRIPTION
  1937.  *  
  1938.  * PARAMETERS
  1939.  *  void
  1940.  * RETURNS
  1941.  *  void
  1942.  *****************************************************************************/
  1943. void set_current_language_for_hindi_rules(void)
  1944. {
  1945.     /*----------------------------------------------------------------*/
  1946.     /* Local Variables                                                */
  1947.     /*----------------------------------------------------------------*/
  1948.     U16 index = 0;
  1949.     U8 temp_str1[30];
  1950.     U8 temp_str2[30];
  1951.     /*----------------------------------------------------------------*/
  1952.     /* Code Body                                                      */
  1953.     /*----------------------------------------------------------------*/
  1954.     AnsiiToUnicodeString((S8*) temp_str1, (S8*) gLanguageArray[gCurrLangIndex].aLangSSC);
  1955.     for (index = 0; index < (sizeof(HRLangSSC) / sizeof(HRLangSSC[0])); index++)
  1956.     {
  1957.         AnsiiToUnicodeString((S8*) temp_str2, (S8*) HRLangSSC[index].ssc_string);
  1958.         if (UCS2Strcmp((const S8*)temp_str1, (const S8*)temp_str2) == 0)
  1959.         {
  1960.             hf_rules_current_set_language = HRLangSSC[index].language_enum;
  1961.             hf_rules_prefered_set_language = hf_rules_current_set_language;
  1962.             return;
  1963.         }
  1964.     }
  1965.     hf_rules_current_set_language = HRLangSSC[0].language_enum;
  1966.     hf_rules_prefered_set_language = hf_rules_current_set_language;
  1967. }
  1968. #include "wgui_categories.h"
  1969. #include "wgui_categories_inputs.h"
  1970. /*****************************************************************************
  1971.  * FUNCTION
  1972.  *  overwrite_current_language_for_hindi_rules_based_on_input_method
  1973.  * DESCRIPTION
  1974.  *  
  1975.  * PARAMETERS
  1976.  *  void
  1977.  * RETURNS
  1978.  *  void
  1979.  *****************************************************************************/
  1980. void overwrite_current_language_for_hindi_rules_based_on_input_method(void)
  1981. {
  1982.     /*----------------------------------------------------------------*/
  1983.     /* Local Variables                                                */
  1984.     /*----------------------------------------------------------------*/
  1985.     /*----------------------------------------------------------------*/
  1986.     /* Code Body                                                      */
  1987.     /*----------------------------------------------------------------*/
  1988.     if (MMI_current_input_mode == INPUT_MODE_MULTITAP_MARATHI)
  1989.     {
  1990.         hf_rules_current_set_language = MMI_MARATHI_LANG;
  1991.     }
  1992.     else if (MMI_current_input_mode == INPUT_MODE_MULTITAP_HINDI)
  1993.     {
  1994.         hf_rules_current_set_language = MMI_HINDI_LANG;
  1995.     }
  1996. }
  1997. /*****************************************************************************
  1998.  * FUNCTION
  1999.  *  restore_current_language_for_hindi_rules
  2000.  * DESCRIPTION
  2001.  *  
  2002.  * PARAMETERS
  2003.  *  void
  2004.  * RETURNS
  2005.  *  void
  2006.  *****************************************************************************/
  2007. void restore_current_language_for_hindi_rules(void)
  2008. {
  2009.     /*----------------------------------------------------------------*/
  2010.     /* Local Variables                                                */
  2011.     /*----------------------------------------------------------------*/
  2012.     /*----------------------------------------------------------------*/
  2013.     /* Code Body                                                      */
  2014.     /*----------------------------------------------------------------*/
  2015.     hf_rules_current_set_language = hf_rules_prefered_set_language;
  2016. }
  2017. /* PMT RAKESH END 20061006 */
  2018. #endif /* __MMI_HINDI_ALG__ */