hf_rule.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:159k
- FALSE, /* 59777 */
- FALSE, /* 59778 */
- FALSE, /* 59779 */
- FALSE, /* 59780 */
- FALSE, /* 59781 */
- FALSE, /* 59782 */
- FALSE, /* 59783 */
- FALSE, /* 59784 */
- FALSE, /* 59785 */
- TRUE, /* 59786 */
- TRUE, /* 59787 */
- TRUE, /* 59788 */
- TRUE, /* 59789 */
- TRUE, /* 59790 */
- TRUE, /* 59791 */
- TRUE, /* 59792 */
- FALSE, /* 59793 */
- FALSE, /* 59794 */
- FALSE, /* 59795 */
- FALSE, /* 59796 */
- FALSE, /* 59797 */
- FALSE, /* 59798 */
- FALSE, /* 59799 */
- FALSE, /* 59800 */
- FALSE, /* 59801 */
- FALSE, /* 59802 */
- FALSE, /* 59803 */
- FALSE, /* 59804 */
- FALSE, /* 59805 */
- FALSE, /* 59806 */
- FALSE, /* 59807 */
- FALSE, /* 59808 */
- FALSE, /* 59809 */
- FALSE, /* 59810 */
- FALSE, /* 59811 */
- FALSE, /* 59812 */
- FALSE, /* 59813 */
- FALSE, /* 59814 */
- FALSE, /* 59815 */
- FALSE, /* 59816 */
- FALSE, /* 59817 */
- FALSE, /* 59818 */
- FALSE, /* 59819 */
- FALSE, /* 59820 */
- FALSE, /* 59821 */
- FALSE, /* 59822 */
- FALSE, /* 59823 */
- FALSE, /* 59824 */
- FALSE, /* 59825 */
- FALSE, /* 59826 */
- FALSE, /* 59827 */
- /* PMT RAKESH START 20061006 */
- FALSE, /* 59828 */
- FALSE, /* 59829 */
- FALSE, /* 59830 */
- FALSE, /* 59831 */
- FALSE, /* 59832 */
- FALSE, /* 59833 */
- FALSE, /* 59834 */
- FALSE, /* 59835 */
- FALSE, /* 59836 */
- FALSE, /* 59837 */
- FALSE, /* 59838 */
- FALSE, /* 59839 */
- FALSE, /* 59840 */
- FALSE, /* 59841 */
- /* PMT RAKESH END 20061006 */
- };
- /* conjunct ligatures */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- //U8 IdentifyCharacter( U16 ch )
- //{
- // return hindi_character_array[UNI2HINDI(ch)];
- /* if( HF_CON_RANGE(ch) )
- return CON;
- else if( HF_INDVOW_RANGE(ch) )
- return INDVOW;
- else if( HF_DEPVOW_RANGE(ch) )
- return DEPVOW;
- else if( HF_SIGN_RANGE(ch) )
- return SIGN;
- else if( HF_NUMERAL_RANGE(ch) )
- return DIG;
-
- else return 0; */
- /* } */
- /*
- * MMI_BOOL hf_whether_ligature_range(U16 ligature )
- * {
- * switch(ligature)
- * {
- * case L_KSHA:
- * case L_GYA:
- * case L_TTTA:
- * case L_TRA:
- * case L_SHRA:
- * case L_KRA:
- * case L_JRA:
- * case L_ZRA:
- * case L_FRA:
- * case L_NFRA:
- * case L_PRA:
- * case L_SRA:
- * case L_RU:
- * case L_RUU:
- * case H_KA:
- * case H_KHA:
- * case H_GA:
- * case H_GHA:
- * case H_CHA:
- * case H_JA:
- * case H_JHA:
- * case H_NYA:
- * case H_ANNA:
- * case H_TA:
- * case H_THA:
- * case H_DHA:
- * case H_NA:
- * case H_NNNA:
- * case H_PA:
- * case H_PHA:
- * case H_BA:
- * case H_BHA:
- * case H_MA:
- * case H_YA:
- * case H_LA:
- * case H_LLA:
- * case H_LLLA:
- * case H_VA:
- * case H_SHA:
- * case H_SSA:
- * case H_SA:
- * case L_KKA:
- * case L_KTA:
- * case L_DYA:
- * case L_DVA:
- * case L_DDYA:
- * case L_TTTTA:
- * case L_TTHA:
- * case L_NNNA:
- * case L_HYA:
- * case H_KHSA:
- * case H_TTA:
- * case H_TRA:
- * case H_SHRA:
- * case L_HRA:
- * case H_EYLASH:
- * case SUP_RA:
- * case SUB_RA:
- * return TRUE;
- * default:
- * return FALSE;
- * }
- * }
- */
- /*****************************************************************************
- * FUNCTION
- * hf_whether_conjunct
- * DESCRIPTION
- *
- * PARAMETERS
- * conjunct [IN]
- * RETURNS
- *
- *****************************************************************************/
- MMI_BOOL hf_whether_conjunct(U16 conjunct)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if( conjunct == L_KSHA || conjunct == L_TRA || conjunct == L_SHRA || conjunct == L_TTTA)//cases of L_GYA,L_TTTA to be added */
- switch (conjunct)
- {
- case L_KSHA:
- case L_TRA:
- case L_SHRA:
- case L_TTTA:
- {
- return TRUE;
- break;
- }
- default:
- return FALSE;
- }
- // return TRUE;
- // else return FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * hf_hindi_rules
- * DESCRIPTION
- *
- * PARAMETERS
- * glyphoutput [IN]
- * cluster [IN]
- * nentry [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_hindi_rules(PU16 glyphoutput, PU16 cluster, S32 nentry)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 ch_index;
- MAIN_TABLE ind_table;
- const GLYPH_INFO_TABLE *char_table;
- S32 size;
- S32 noutglyph = 0; /* no. of entries in output cluster to be given to renderer */
- S32 max_size;
- S32 matched = FALSE;
- S32 input = nentry;
- S32 tomatch = nentry; /* nentries--no. of elements in the cluster */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (HF_HINDI_RANGE(*cluster))
- {
- /* START TARUN 20050108 */
- if (nentry == 1)
- {
- glyphoutput[nentry - 1] = *cluster;
- glyphoutput[nentry] = (U16) NULL;
- return nentry;
- }
- /* END TARUN 20050108 */
- while (nentry)
- {
- ch_index = UNI2HINDI(*cluster); /* find the index of character in main table */
- ind_table = hfDvngTbl[ch_index - 1]; /* gets the individual charactr's table in main table */
- char_table = ind_table.glyphinfo; /* holds the add. of individual character */
- size = ind_table.nsize;
- max_size = ind_table.maxInputGlyphSize;
- matched = FALSE;
- while (size)
- {
- size--;
- if (tomatch != char_table[size].nInputLen) /* && max_size > nentry ) */
- {
- continue;
- }
- /* PMT RAKESH START 20061006 */
- if ((char_table[size].rule_language) &&
- (char_table[size].rule_language != hf_rules_current_set_language))
- {
- continue;
- }
- /* PMT RAKESH END 20061006 */
- else if (memcmp(char_table[size].Input_glyph, cluster, char_table[size].nInputLen * 2) == 0)
- {
- //#if 0
- // if( *cluster == C_RA && input>=3 && (IdentifyCharacter(*(cluster-1)) == CON || IdentifyCharacter(*(cluster-1)) == DEPVOW) && *(cluster-1)!=DV_I )//change 01/12/04
- // {
- // memcpy( glyphoutput,char_table[size].Output_glyph,char_table[size].nOutputLen*2 );
- // glyphoutput[char_table[size].nOutputLen] = NULL;
- // }
- // else if( *cluster == C_RA && (*(cluster+1) == S_HALANT ))
- // {
- // memcpy( glyphoutput,char_table[size].Input_glyph,char_table[size].nInputLen*2 );
- // glyphoutput[char_table[size].nInputLen] = NULL;
- // glyphoutput++;
- // }
- // else if( (*(cluster+1) == S_HALANT) && (*(cluster+2)== NULL) )
- // {
- // memcpy( glyphoutput,char_table[size].Input_glyph,char_table[size].nInputLen*2 );
- // glyphoutput[char_table[size].nInputLen] = NULL;
- // }
- // else
- // {
- // memcpy( glyphoutput,char_table[size].Output_glyph,char_table[size].nOutputLen*2 );
- // glyphoutput[char_table[size].nOutputLen] = NULL;
- // }
- //#endif//0
- //#if 1
- switch (*cluster)
- {
- case C_RA:
- {
- if (input >= 3 && (IdentifyCharacter(*(cluster - 1)) == CON || IdentifyCharacter(*(cluster - 1)) == DEPVOW) && *(cluster - 1) != DV_I) /* change 01/12/04 */
- {
- memcpy(glyphoutput, char_table[size].Output_glyph, char_table[size].nOutputLen * 2);
- glyphoutput[char_table[size].nOutputLen] = (U16) NULL;
- break;
- }
- else if ((*(cluster + 1) == S_HALANT))
- {
- memcpy(glyphoutput, char_table[size].Input_glyph, char_table[size].nInputLen * 2);
- glyphoutput[char_table[size].nInputLen] = (U16) NULL;
- glyphoutput++;
- break;
- }
- memcpy(glyphoutput, char_table[size].Output_glyph, char_table[size].nOutputLen * 2);
- glyphoutput[char_table[size].nOutputLen] = (U16) NULL;
- break;
- }
- default:
- {
- if ((*(cluster + 1) == S_HALANT) && (*(cluster + 2) == (U16) NULL))
- {
- memcpy(glyphoutput, char_table[size].Input_glyph, char_table[size].nInputLen * 2);
- glyphoutput[char_table[size].nInputLen] = (U16) NULL;
- }
- else
- {
- memcpy(glyphoutput, char_table[size].Output_glyph, char_table[size].nOutputLen * 2);
- glyphoutput[char_table[size].nOutputLen] = (U16) NULL;
- }
- break;
- }
- }
- // #endif//1
- nentry -= char_table[size].nInputLen;
- glyphoutput += char_table[size].nOutputLen;
- cluster += char_table[size].nInputLen;
- noutglyph += char_table[size].nOutputLen;
- matched = TRUE;
- if (hf_whether_conjunct(*(glyphoutput - 1)) && *cluster == S_HALANT &&
- IdentifyCharacter(*(cluster + 1)) == CON)
- {
- S32 conjunct = *(glyphoutput - 1);
- switch (conjunct)
- {
- case L_KSHA:
- *(glyphoutput - 1) = H_KHSA;
- break;
- case L_TRA:
- *(glyphoutput - 1) = H_TRA;
- break;
- case L_SHRA:
- *(glyphoutput - 1) = H_SHRA;
- break;
- case L_TTTA:
- *(glyphoutput - 1) = H_TTA;
- break;
- default:
- break;
- }
- //if( *(glyphoutput-1) == L_KSHA)
- //*(glyphoutput-1)=H_KHSA;
- //else if( *(glyphoutput-1) == L_TRA)
- //*(glyphoutput-1)=H_TRA;
- //else if( *(glyphoutput-1) == L_SHRA)
- //*(glyphoutput-1)=H_SHRA;
- ////cases of L_GYA to be added
- //else if( *(glyphoutput-1) == L_TTTA)
- //*(glyphoutput-1)=H_TTA;
- *glyphoutput = (U16) NULL;
- nentry -= 1;
- cluster += 1;
- noutglyph += 1;
- matched = TRUE;
- break;
- }
- /* vj 01/12/04 */
- break;
- }
- }
- if (matched != TRUE)
- {
- --tomatch;
- }
- else
- {
- tomatch = nentry;
- }
- }
- return noutglyph;
- }
- else
- {
- glyphoutput[nentry - 1] = *cluster;
- glyphoutput[nentry] = (U16) NULL;
- return nentry;
- }
- }
- //void init_cluster_start_p(PU16 buffer)
- //{
- // if(buffer!=NULL)
- // cluster_start_p = buffer;
- //}
- //void init_cluster_end_p(PU16 buffer)
- //{
- // if(buffer!=NULL)
- // cluster_end_p = buffer;
- //}
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /*****************************************************************************
- * FUNCTION
- * hf_get_cluster
- * DESCRIPTION
- *
- * PARAMETERS
- * cluster [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_get_cluster(PU16 cluster)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 nFill = 0; /* no. of elements filled in the cluster */
- S32 j = 0; /* loop counter */
- S32 i;
- U16 temp;
- S32 ch; /* whether CON,INDVOW,DEPVOW,SIGN,NUM */
- PU16 start_cluster = cluster;
- PU8 start_char = cluster_start_p; /* points to the starting character of the input string */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!HINDI_CONVERT_U8_U16(start_char))
- {
- return 0;
- }
- if (!HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(start_char)))
- {
- HINDI_FILL_CLUSTER();
- start_cluster[nFill] = (U16) NULL;
- cluster_start_p += (nFill * 2);
- /* cluster_start_p=cluster_start_p+(nFill*2); */
- return nFill;
- }
- ch = IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char));
- nFill = 0;
- switch (ch)
- {
- /* if( ch == CON ) */
- case CON:
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( (cursor_pointer_end_current_cluster == start_char) || hf_end_cluster(start_cluster,start_char,nFill) )
- {
- return nFill;
- } */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- if (HINDI_CONVERT_U8_U16(start_char) == C_RA)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
- {
- nFill = hf_get_consonant_cluster(&start_cluster, &start_char, nFill);
- }
- MMI_ASSERT(!(nFill > G_MAX));
- if ((nFill % 2) && start_cluster[0] == C_RA)
- {
- if (HINDI_CONVERT_U8_U16(start_char) != DV_I &&
- IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- }
- for (i = 0; i <= 1; i++)
- {
- temp_array[0] = start_cluster[0];
- for (j = 0; j < nFill - 1; j++)
- {
- start_cluster[j] = start_cluster[j + 1];
- }
- start_cluster[j] = temp_array[0];
- }
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- else if (start_cluster[0] == C_RA)
- {
- temp = start_cluster[nFill - 1];
- for (i = 0; i <= 1; i++)
- {
- temp_array[0] = start_cluster[0];
- for (j = 0; j < nFill - 2; j++)
- {
- start_cluster[j] = start_cluster[j + 1];
- }
- start_cluster[j] = temp_array[0];
- }
- start_cluster[nFill - 1] = temp;
- }
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- temp = start_cluster[nFill - 1];
- for (j = nFill - 1; j >= 0; j--)
- {
- start_cluster[j + 1] = start_cluster[j];
- }
- start_cluster[j + 1] = temp;
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- }
- }
- /* vijay 061204 */
- else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW ||
- IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- /* vijay 061204 issue of U matra solved */
- }
- else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == CON)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- {
- if (start_cluster[0] == C_RA && HINDI_CONVERT_U8_U16(start_char) == DV_I)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* reordering logic */
- /* chhoti E */
- temp = start_cluster[nFill - 1];
- for (j = nFill - 1; j >= 0; j--)
- {
- start_cluster[j + 1] = start_cluster[j];
- }
- start_cluster[j + 1] = temp;
- //end chhoti E
- //reordering logic
- /* temp_array[0] = start_cluster[3];
- temp_array[1] = start_cluster[2];
- temp_array[2] = start_cluster[0];
- temp_array[3] = start_cluster[1];
- for(j=0; j<=3; j++)
- start_cluster[j] = temp_array[j]; */
- /* end reordering */
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- /* start vijay changes done for the SIGN to be included in cluster */
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- //start reordering logic Chhoti E
- //START VIJAY PMT 20050728..COMMENTED AS NO REORDERING IS REQUIRED HERE
- /* temp = start_cluster[nFill-2];
- start_cluster[nFill-2]=start_cluster[nFill-1];
- start_cluster[nFill-1] = temp; */
- //END VIJAY PMT 20050728
- //end
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- /* vijay end */
- }
- else if (((start_cluster[0] == C_RA) &&
- IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW))
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* reordering logic */
- temp_array[0] = start_cluster[2];
- temp_array[1] = start_cluster[3];
- temp_array[2] = start_cluster[0];
- temp_array[3] = start_cluster[1];
- for (j = 0; j <= 3; j++)
- {
- start_cluster[j] = temp_array[j];
- }
- /* end reordering logic */
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- MMI_ASSERT(!(nFill > G_MAX));
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- else if (start_cluster[0] == C_RA)
- {
- if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
- {
- nFill = hf_get_consonant_cluster(&start_cluster, &start_char, nFill);
- }
- MMI_ASSERT(!(nFill > G_MAX));
- if ((nFill % 2) && start_cluster[0] == C_RA)
- {
- for (i = 0; i <= 1; i++)
- {
- temp_array[0] = start_cluster[0];
- for (j = 0; j < nFill - 1; j++)
- {
- start_cluster[j] = start_cluster[j + 1];
- }
- start_cluster[j] = temp_array[0];
- }
- }
- else
- {
- temp = start_cluster[nFill - 1];
- for (i = 0; i <= 1; i++)
- {
- temp_array[0] = start_cluster[0];
- for (j = 0; j < nFill - 2; j++)
- {
- start_cluster[j] = start_cluster[j + 1];
- }
- start_cluster[j] = temp_array[0];
- }
- start_cluster[nFill - 1] = temp;
- }
- if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* reordering logic */
- temp = start_cluster[nFill - 1];
- for (j = nFill - 1; j >= 0; j--)
- {
- start_cluster[j + 1] = start_cluster[j];
- }
- start_cluster[j + 1] = temp;
- /* end */
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW ||
- IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- }
- else
- {
- if (HINDI_CONVERT_U8_U16(start_char) == S_HALANT)
- {
- nFill = hf_get_consonant_cluster(&start_cluster, &start_char, nFill);
- }
- MMI_ASSERT(!(nFill > G_MAX));
- /* vj30/11/04 */
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- /* vj30/11/04 */
- if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char)
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* reordering logic */
- temp = start_cluster[nFill - 1];
- for (j = nFill - 1; j >= 0; j--)
- {
- start_cluster[j + 1] = start_cluster[j];
- }
- start_cluster[j + 1] = temp;
- /* end */
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW ||
- IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- }
- } /* if not ligature */
- } /* if not RA */
- } /* end of if HALANT */
- else
- {
- if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* reordering logic */
- temp = start_cluster[0];
- start_cluster[0] = start_cluster[nFill - 1];
- start_cluster[nFill - 1] = temp;
- /* end */
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (HINDI_CONVERT_U8_U16(start_char) == S_BINDU || HINDI_CONVERT_U8_U16(start_char) == S_VISARGA)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- else if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == DEPVOW)
- {
- if (HINDI_CONVERT_U8_U16(start_char) == DV_I)
- {
- //start_cluster[nFill] = *start_char;
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* reordering logic */
- temp = start_cluster[nFill - 1];
- for (j = nFill - 1; j >= 0; j--)
- {
- start_cluster[j + 1] = start_cluster[j];
- }
- start_cluster[j + 1] = temp;
- /* end */
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- else
- {
- //start_cluster[nFill] = *start_char;
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(start_char)) == SIGN)
- {
- //start_cluster[nFill] = *start_char;
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- }
- }
- } /* if not halant */
- start_cluster[nFill] = (U16) NULL;
- cluster_start_p += (nFill * 2);
- return nFill;
- break;
- } /* end of if first character is consonant */
- /* else if( ch == INDVOW ) */
- case INDVOW:
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- /* START PMTFARHAD 20050224 */
- if (HINDI_CONVERT_U8_U16(start_char) == S_CHANDRA_BINDU || HINDI_CONVERT_U8_U16(start_char) == S_BINDU ||
- HINDI_CONVERT_U8_U16(start_char) == S_VISARGA)
- /* END PMTFARHAD 20050224 */
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- MMI_ASSERT(!(nFill > G_MAX));
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill; */
- HF_END_CLUSTER(start_cluster, start_char, nFill);
- }
- start_cluster[nFill] = (U16) NULL;
- cluster_start_p += (nFill * 2);
- return nFill;
- break;
- }
- /* else if ( ch == DEPVOW ) */
- case DEPVOW:
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill;
- else
- if(nFill > G_MAX) return nFill; */
- start_cluster[nFill] = (U16) NULL;
- cluster_start_p += (nFill * 2);
- return nFill;
- break;
- }
- /* else if ( ch == SIGN ) */
- case SIGN:
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- /* if( hf_end_cluster(start_cluster,start_char,nFill) )
- return nFill;
- else
- if(nFill > G_MAX) return nFill; */
- start_cluster[nFill] = (U16) NULL;
- cluster_start_p += (nFill * 2);
- return nFill;
- break;
- }
- /* any character other than Hindi */
- /* else */
- default:
- {
- //start_cluster[nFill] = HINDI_CONVERT_U8_U16(start_char);
- //nFill++;start_char++;
- HINDI_FILL_CLUSTER();
- start_cluster[nFill] = (U16) NULL;
- cluster_start_p += (nFill * 2);
- return nFill;
- break;
- }
- }
- return 0;
- } /* end of function get_cluster */
- /* 17th nov start */
- /*****************************************************************************
- * FUNCTION
- * hf_get_consonant_cluster
- * DESCRIPTION
- *
- * PARAMETERS
- * start_cluster [?]
- * start_char [?]
- * nentry [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_get_consonant_cluster(PU16 *start_cluster, PU8 *start_char, S32 nentry)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* if( **start_char == S_HALANT )
- { */
- (*start_cluster)[nentry] = HINDI_CONVERT_U8_U16(*start_char);
- nentry++;
- (*start_char) += 2;
- if (nentry == G_MAX - 2)
- {
- return nentry;
- }
- if (*start_char == cluster_end_p)
- {
- return nentry;
- }
- if (IdentifyCharacter(HINDI_CONVERT_U8_U16(*start_char)) == CON)
- {
- (*start_cluster)[nentry] = HINDI_CONVERT_U8_U16(*start_char);
- nentry++;
- (*start_char) += 2;
- MMI_ASSERT(!(nentry > G_MAX));
- if (*start_char == cluster_end_p)
- {
- return nentry;
- }
- if (nentry > G_MAX)
- {
- return nentry;
- }
- if (HINDI_CONVERT_U8_U16(*start_char) == S_HALANT)
- {
- nentry = hf_get_consonant_cluster(start_cluster, start_char, nentry);
- }
- }
- else
- {
- return nentry;
- }
- /* }
- else
- return nentry; */
- return nentry;
- }
- /* 17th nov end */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /*****************************************************************************
- * FUNCTION
- * hf_get_next_cluster_p
- * DESCRIPTION
- *
- * PARAMETERS
- * text_p [IN]
- * cursor_p [IN]
- * RETURNS
- *
- *****************************************************************************/
- PU8 hf_get_next_cluster_p(PU8 text_p, PU8 cursor_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- PU8 current_cursor_p = text_p;
- PU8 prev_cursor_p = text_p;
- U16 cluster_buffer[G_MAX]; /* just to fill the cluster for the purpose of getting its length */
- S32 len = 0;
- PU8 cursor_pointer = cursor_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- cursor_pointer += 2;
- if (HINDI_CONVERT_U8_U16(cursor_p) == (U16) NULL)
- {
- return cursor_p;
- }
- else if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
- {
- init_cluster_start_p(text_p);
- init_cluster_end_p(cursor_p);
- #if 0 /* No use as this condition never gets true */
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */ /* TARUN 20050108 */
- len = hf_get_cluster(cluster_buffer);
- current_cursor_p += (len * 2);
- return current_cursor_p;
- }
- else
- {
- return cursor_pointer;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * hf_get_prev_cluster_p
- * DESCRIPTION
- *
- * PARAMETERS
- * text_p [IN]
- * cursor_p [IN]
- * RETURNS
- *
- *****************************************************************************/
- PU8 hf_get_prev_cluster_p(PU8 text_p, PU8 cursor_p)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- PU8 current_cursor_p = text_p;
- PU8 prev_cursor_p = text_p;
- S32 len = 0;
- U16 cluster_buffer[G_MAX];
- PU8 cursor_pointer = cursor_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- cursor_pointer -= 2;
- if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
- {
- init_cluster_start_p(text_p);
- init_cluster_end_p(cursor_p);
- while (current_cursor_p != cursor_p)
- {
- len = hf_get_cluster(cluster_buffer);
- prev_cursor_p = current_cursor_p;
- current_cursor_p += (len * 2);
- if (len == 0)
- {
- break;
- }
- }
- return prev_cursor_p;
- }
- else
- {
- return cursor_pointer;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * hf_size_of_current_cluster
- * DESCRIPTION
- *
- * PARAMETERS
- * text_p [IN]
- * cursor_p [IN]
- * cursor [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_size_of_current_cluster(PU8 text_p, PU8 cursor_p, U16 cursor)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- PU8 muv_cursor_p = text_p;
- S32 len = 0;
- S32 pixel_size = 0;
- U16 cluster_buffer[G_MAX];
- U16 glyphoutput[G_MAX];
- PU8 cursor_pointer = cursor_p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (text_p == cursor_p)
- {
- return 0;
- }
- cursor_pointer -= 2;
- if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
- {
- init_cluster_start_p(text_p);
- init_cluster_end_p(cursor_p);
- while (muv_cursor_p != cursor_p)
- {
- len = hf_get_cluster(cluster_buffer);
- muv_cursor_p += (len * 2);
- if (len == 0)
- {
- break;
- }
- }
- hf_hindi_rules(glyphoutput, cluster_buffer, len);
- if (cursor)
- {
- pixel_size = hf_get_string_width_height(glyphoutput);
- }
- else
- {
- pixel_size = hf_get_string_Dwidth_height(glyphoutput);
- }
- return pixel_size;
- }
- else
- {
- pixel_size = gui_get_character_width(HINDI_CONVERT_U8_U16(cursor_pointer));
- cursor_pointer_end_current_cluster = NULL;
- return pixel_size;
- }
- }
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /*****************************************************************************
- * FUNCTION
- * hf_get_current_cluster
- * DESCRIPTION
- *
- * PARAMETERS
- * text_p [IN]
- * cursor_p [IN]
- * output_buffer [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_get_current_cluster(PU8 text_p, PU8 cursor_p, PU16 output_buffer)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- PU8 cursor_pointer = cursor_p;
- PU8 muv_cursor_p = text_p;
- S32 len = 0;
- U16 glyphoutput[G_MAX];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- cursor_pointer_end_current_cluster = cursor_pointer;
- cursor_pointer -= 2;
- if (HF_HINDI_RANGE(HINDI_CONVERT_U8_U16(cursor_pointer)))
- {
- init_cluster_start_p(text_p);
- init_cluster_end_p(cursor_p);
- while (muv_cursor_p != cursor_p)
- {
- len = hf_get_cluster(output_buffer);
- muv_cursor_p += (len * 2);
- if (len == 0)
- {
- break;
- }
- }
- memset(glyphoutput, ' ', len);
- hf_hindi_rules(glyphoutput, output_buffer, len);
- /* vj 30/11/04 */
- memcpy(output_buffer, glyphoutput, UCS2Strlen((const S8*)glyphoutput) * 2);
- output_buffer[UCS2Strlen((const S8*)glyphoutput)] = (U16) NULL;
- /* vj 30/11/04 */
- cursor_pointer_end_current_cluster = NULL;
- return TRUE;
- }
- else
- {
- init_cluster_start_p(cursor_pointer);
- hf_get_cluster(output_buffer);
- hf_hindi_rules(glyphoutput, output_buffer, 1);
- /* vj 30/11/04 */
- memcpy(output_buffer, glyphoutput, 2);
- output_buffer[UCS2Strlen((const S8*)glyphoutput)] = (U16) NULL;
- /* vj 30/11/04 */
- cursor_pointer_end_current_cluster = NULL;
- return TRUE;
- }
- }
- /* Start Farhad 30-04-2004 */
- //void reset_hindi_params(void)
- //{
- // prev_char_text_x = 0;
- // prev_char_dwidth = 0;
- // prev_char_width = 0;
- // new_line = 1;
- //}
- //START TARUN PMT 20050128
- extern BOOL r2lMMIFlag;
- /* END TARUN PMT 20050128 */
- /*****************************************************************************
- * FUNCTION
- * get_text_x
- * DESCRIPTION
- *
- * PARAMETERS
- * ptext_x [?]
- * current_character [IN]
- * text_y [IN]
- * d_width [IN]
- * width [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_text_x(S32 *ptext_x, U16 current_character, S32 text_y, U16 d_width, U16 width)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /* START TARUN PMT 20050128 */
- U8 is_hindi = 1;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* START FARHAD PIXTELMTK 20050217 */
- if (current_character >= 0x0E01 && current_character <= 0x0E7F)
- {
- prev_char_text_x = *ptext_x;
- prev_char_dwidth = width;
- prev_char_width = width;
- /* START PMTFARHAD 20050224 */
- if (IsThaiAboveLineChar(current_character))
- {
- prev_char_dwidth = 0;
- prev_char_width = 0;
- }
- prev_character = current_character;
- /* END PMTFARHAD 20050224 */
- return;
- }
- /* END FARHAD PIXTELMTK 20050217 */
- if (!(UI_HINDI_CHARACTER_UCS2_RANGE(current_character)))
- {
- d_width = width;
- prev_char_dwidth = prev_char_width;
- is_hindi = 0;
- if (r2lMMIFlag)
- {
- return;
- }
- }
- /* END TARUN PMT 20050128 */
- if (new_line)
- {
- new_line = 0;
- if (UI_HINDI_CHARACTER_UCS2_RANGE(current_character))
- {
- *ptext_x = *ptext_x - hf_padding;
- }
- prev_char_text_x = *ptext_x;
- /* Get_CharWidthHeight_New( current_character,&prev_char_dwidth); */
- prev_char_dwidth = d_width;
- prev_char_width = width;
- prev_character = current_character;
- return;
- }
- /* PMT START MAUI_00223197 */
- if ((current_character != S_VISARGA) && UI_HINDI_SIGN_RANGE(current_character))
- /* PMT END MAUI_00223197 */
- {
- *ptext_x = prev_char_text_x;
- prev_char_dwidth = prev_char_dwidth;
- prev_char_width = prev_char_width;
- }
- else
- {
- if (is_hindi)
- {
- if (!(UI_HINDI_CHARACTER_UCS2_RANGE(prev_character)))
- {
- prev_char_text_x -= hf_padding;
- }
- /* if(current_character==59774|| current_character==59775)
- {
- *ptext_x = prev_char_dwidth + prev_char_text_x;
- return;
- } */
- }
- *ptext_x = prev_char_dwidth + prev_char_text_x;
- prev_char_text_x = *ptext_x;
- /* Get_CharWidthHeight_New( current_character,&prev_char_dwidth); */
- prev_char_dwidth = d_width;
- prev_char_width = width;
- }
- prev_character = current_character;
- return;
- }
- /* END */
- /*****************************************************************************
- * FUNCTION
- * get_multitap_text_x
- * DESCRIPTION
- *
- * PARAMETERS
- * ptext_x [?]
- * current_character [IN]
- * Char_Range [IN]
- * check_char [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_multitap_text_x(S32 *ptext_x, U16 current_character, S32 Char_Range, S32 check_char)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- static S32 prev_char_mtext_x = 0;
- static S32 prev_char_mdwidth = 0;
- S32 character_height;
- S32 text_x;
- S32 mtext_gap = 5;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MMI_ASSERT(!(*ptext_x > 128)); */
- text_x = *ptext_x;
- if (!(check_char))
- {
- switch (Char_Range)
- {
- case 1:
- {
- *ptext_x = 59;
- break;
- }
- case 2:
- {
- *ptext_x = 54;
- break;
- }
- case 3:
- {
- *ptext_x = 49;
- break;
- }
- case 4:
- {
- *ptext_x = 44;
- break;
- }
- case 5:
- {
- *ptext_x = 39;
- break;
- }
- case 6:
- {
- *ptext_x = 35;
- break;
- }
- case 7:
- {
- *ptext_x = 30;
- break;
- }
- case 8:
- {
- *ptext_x = 25;
- break;
- }
- case 9:
- {
- *ptext_x = 20;
- break;
- }
- case 10:
- {
- *ptext_x = 15;
- break;
- }
- case 11:
- {
- *ptext_x = 10;
- break;
- }
- case 12:
- /* START VIJAY PMT 20050725 */
- case 13:
- case 14:
- /* END VIJAY PMT 20050725 */
- {
- /* START VIJAY PMT 20050720.....initial value = 5 */
- *ptext_x = 7;
- /* END VIJAY PMT 20050725 */
- break;
- }
- default:
- {
- *ptext_x = 3;
- break;
- }
- }
- /*
- * if(Char_Range == 1)
- * *ptext_x = 59;
- * else if(Char_Range == 2)
- * *ptext_x = 54;
- * else if(Char_Range == 3)
- * *ptext_x = 49;
- * else if(Char_Range == 4)
- * *ptext_x = 44;
- * else if(Char_Range == 5)
- * *ptext_x = 39;
- * else if(Char_Range == 6)
- * *ptext_x = 35;
- * else if(Char_Range == 7)
- * *ptext_x = 30;
- * else if(Char_Range == 8)
- * *ptext_x = 25;
- * else if(Char_Range == 9)
- * *ptext_x = 20;
- * else if(Char_Range == 10)
- * *ptext_x = 15;
- * else if(Char_Range == 11)
- * *ptext_x = 10;
- * else if(Char_Range == 12)
- * *ptext_x = 5;
- * else
- * *ptext_x = 0;
- */
- prev_char_mtext_x = *ptext_x;
- Get_CharWidthHeight(current_character, &prev_char_mdwidth, &character_height);
- return;
- }
- /* if(HF_DEPVOW_RANGE(current_character)|| HF_SIGN_RANGE(current_character)) */
- if (IdentifyCharacter(current_character) == DEPVOW || IdentifyCharacter(current_character) == SIGN)
- {
- text_x = prev_char_mdwidth + prev_char_mtext_x + mtext_gap;
- }
- else
- {
- text_x = prev_char_mdwidth + prev_char_mtext_x;
- }
- Get_CharWidthHeight(current_character, &prev_char_mdwidth, &character_height);
- prev_char_mtext_x = text_x;
- if (current_character == DV_II)
- {
- *ptext_x = text_x + mtext_gap;
- }
- else
- {
- *ptext_x = text_x;
- }
- }
- /* start farhad 5-11-04 api to get the string width and height it uses width and dwidth both. */
- /*****************************************************************************
- * FUNCTION
- * hf_get_string_width_height
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_get_string_width_height(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w, h;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* START VIJAY PMT 20050728 */
- hf_disable_hindi_rules_parsing();
- gui_measure_string(text, &w, &h);
- hf_enable_hindi_rules_parsing();
- /* END VIJAY PMT 20050728 */
- return (w);
- }
- /* api that use dwidth only */
- /*****************************************************************************
- * FUNCTION
- * hf_get_string_Dwidth_height
- * DESCRIPTION
- *
- * PARAMETERS
- * text [IN]
- * RETURNS
- *
- *****************************************************************************/
- S32 hf_get_string_Dwidth_height(UI_string_type text)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 w, h;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* START VIJAY PMT 20050728 */
- hf_disable_hindi_rules_parsing();
- gui_measure_string(text, &w, &h);
- hf_enable_hindi_rules_parsing();
- /* END VIJAY PMT 20050728 */
- return (w);
- }
- /* end 5-11-04 */
- /* Start vijay */
- #if 0
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- /* under construction !*/
- #endif /* 0 */
- /* End */
- /* start farhad 08122004 */
- //void reset_hindi_bordered_params(void)
- //{
- // prev_char_btext_x = 0;
- // prev_char_bdwidth = 0;
- // new_bline = 1;
- //}
- /*****************************************************************************
- * FUNCTION
- * get_bordered_text_x
- * DESCRIPTION
- *
- * PARAMETERS
- * ptext_x [?]
- * current_character [IN]
- * text_y [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_bordered_text_x(S32 *ptext_x, U16 current_character, S32 text_y)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 character_height = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MMI_ASSERT(!(*ptext_x > 128)); */
- if (new_bline)
- {
- new_bline = 0;
- prev_char_btext_x = *ptext_x;
- Get_CharWidthHeight(current_character, &prev_char_bdwidth, &character_height);
- return;
- }
- /* PMT START MAUI_00223197 */
- if ((current_character != S_VISARGA) && UI_HINDI_SIGN_RANGE(current_character))
- /* PMT END MAUI_00223197 */
- {
- *ptext_x = prev_char_btext_x;
- prev_char_bdwidth = prev_char_bdwidth;
- }
- else
- {
- *ptext_x = prev_char_bdwidth + prev_char_btext_x;
- prev_char_btext_x = *ptext_x;
- Get_CharWidthHeight(current_character, &prev_char_bdwidth, &character_height);
- }
- return;
- }
- //void reset_use_multitap(void)
- //{
- // use_multitap=0;
- //}
- //
- //void set_use_multitap(void)
- //{
- // use_multitap=1;
- //}
- //
- //S32 whether_use_multitap(void)
- //{
- // return use_multitap;
- //}
- //S32 hf_disable_hindi_rules_parsing(void)
- //{
- // parse_hindi=0;
- //}
- //
- //S32 hf_enable_hindi_rules_parsing(void)
- //{
- // parse_hindi=1;
- //}
- //
- //S32 hf_is_hindi_rules_parsing(void)
- //{
- // return parse_hindi;
- //}
- //void hf_disable_hindi_reset_hindi_params(void)
- //{
- // reset_hindi_pms=0;
- //}
- //
- //hf_enable_hindi_reset_hindi_params(void)
- //{
- // reset_hindi_pms=1;
- //}
- //
- //hf_is_reset_hindi_params(void)
- //{
- // return reset_hindi_pms;
- //}
- //End farhad 08122004
- //START FARHAD PMT 20050211
- /*****************************************************************************
- * FUNCTION
- * get_hindi_rules_for_whole_string
- * DESCRIPTION
- *
- * PARAMETERS
- * String [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void get_hindi_rules_for_whole_string(PU8 String)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 StringArray[2048];
- U16 cluster_fill[G_MAX];
- U16 glyph_output[G_MAX];
- S32 Len;
- S32 cluster_length;
- U16 hindi_present = 0;
- U8 *temp_string = String;
- U16 unicode = 0;
- U16 Fill = 0;
- U16 clFill = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- while ((temp_string[clFill] != ' ' || temp_string[clFill + 1] != ' ') && !hindi_present)
- {
- unicode = temp_string[clFill];
- unicode |= (temp_string[clFill + 1] << 8);
- if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
- {
- hindi_present = 1;
- }
- clFill += 2;
- }
- if (hindi_present)
- {
- init_cluster_start_p(String);
- init_cluster_end_p(String);
- while (temp_string[0] != ' ' || temp_string[1] != ' ')
- {
- clFill = 0;
- unicode = temp_string[0];
- unicode |= (temp_string[1] << 8);
- cluster_length = hf_get_cluster( /* (PU16) */ cluster_fill);
- if (UI_HINDI_CHARACTER_UCS2_RANGE(unicode))
- {
- Len = hf_hindi_rules( /* (PU16) */ glyph_output, /* (PU16) */ cluster_fill, cluster_length);
- temp_string += cluster_length * 2;
- while (glyph_output[clFill] != ' ' /* || glyph_output[clFill+1]!=' ' */ )
- {
- StringArray[Fill++] = (U8) (glyph_output[clFill] & 0x00ff);
- StringArray[Fill++] = (U8) (glyph_output[clFill++] >> 8) & 0x00ff;
- }
- }
- else
- {
- StringArray[Fill++] = temp_string[0];
- StringArray[Fill++] = temp_string[1];
- temp_string += 2;
- }
- }
- StringArray[Fill++] = NULL;
- StringArray[Fill++] = NULL;
- memcpy(String, StringArray, Fill);
- /* String[Fill]=NULL; */
- }
- }
- /* END FARHAD PMT 20050211 */
- /* PMT RAKESH START 20061006 */
- /*****************************************************************************
- * FUNCTION
- * set_current_language_for_hindi_rules
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void set_current_language_for_hindi_rules(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 index = 0;
- U8 temp_str1[30];
- U8 temp_str2[30];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- AnsiiToUnicodeString((S8*) temp_str1, (S8*) gLanguageArray[gCurrLangIndex].aLangSSC);
- for (index = 0; index < (sizeof(HRLangSSC) / sizeof(HRLangSSC[0])); index++)
- {
- AnsiiToUnicodeString((S8*) temp_str2, (S8*) HRLangSSC[index].ssc_string);
- if (UCS2Strcmp((const S8*)temp_str1, (const S8*)temp_str2) == 0)
- {
- hf_rules_current_set_language = HRLangSSC[index].language_enum;
- hf_rules_prefered_set_language = hf_rules_current_set_language;
- return;
- }
- }
- hf_rules_current_set_language = HRLangSSC[0].language_enum;
- hf_rules_prefered_set_language = hf_rules_current_set_language;
- }
- #include "wgui_categories.h"
- #include "wgui_categories_inputs.h"
- /*****************************************************************************
- * FUNCTION
- * overwrite_current_language_for_hindi_rules_based_on_input_method
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void overwrite_current_language_for_hindi_rules_based_on_input_method(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MMI_current_input_mode == INPUT_MODE_MULTITAP_MARATHI)
- {
- hf_rules_current_set_language = MMI_MARATHI_LANG;
- }
- else if (MMI_current_input_mode == INPUT_MODE_MULTITAP_HINDI)
- {
- hf_rules_current_set_language = MMI_HINDI_LANG;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * restore_current_language_for_hindi_rules
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void restore_current_language_for_hindi_rules(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- hf_rules_current_set_language = hf_rules_prefered_set_language;
- }
- /* PMT RAKESH END 20061006 */
- #endif /* __MMI_HINDI_ALG__ */