/* misc.c function for misc * Copyright (c) 2004 by SmartLu All Rights Reserved * Distributed under the terms of the GNU General Public License (GPL) * See the GNU Library General Public License for more details. */ #include "srecite.h" //special phonetic chacaters gunichar p_array[] = {596,593,601,652,629,240,643,658,331,230,603}; int isPhonetic(gunichar c) { int i; for(i=0;i<11;i++) { if(c==p_array[i]) return 1; } return 0; } static GtkWidget *dialog; gchar * unichar_to_utf8(gunichar *uni,gint len) { GString *string; gchar *utf8; gint i; string = g_string_sized_new(len * 4 + 1); for( i = 0 ; i < len-5 ; i ++) { // if(isPhonetic(uni[i]) ) // string = g_string_append_unichar(string,uni[i]); // else // string = g_string_append_c(string,uni[i]); // '#' is special char defined by me,to show TK_word is end if(uni[i] == '#') break; else string = g_string_append_unichar(string,uni[i]); } utf8 = string -> str; g_string_free(string,FALSE); return(utf8); } /* for wrd format file,convert to fit on kingsoft font */ void phonetic_convert(gchar word[]) { gunichar unitmp[256]; gchar * tmp; //strcpy(tmp,word); int i; for(i=0;i