From: Brian W. <bri...@gm...> - 2009-10-29 01:00:11
|
> Your patch assumes that an UTF8 character initiates a new word. That is > wrong for the most European language, if not for all. So there must be > another solution. Maybe a hybrid of word and character wrap? I.e. try to > wrap a word (separated by a white space) first, if this is not possible, do > a character wrap. I don't know if this is a good solution. But it would work > at least for European languages and Chinese more or less. I know my patch is far from perfect. It is merely good for my own purpose. Does the current (svn) implementation of the word-wrapping works for European languages? > > Regards Peter >> >> Here is the simple patch: >> Index: canvas/evas_object_textblock.c >> =================================================================== >> --- canvas/evas_object_textblock.c (revision 43223) >> +++ canvas/evas_object_textblock.c (working copy) >> @@ -1607,6 +1607,16 @@ >> _layout_word_start(char *str, int start) >> { >> int p, tp, chr = 0; >> + >> + // >> + // coolbrian: break if the word is not within the ASCII range >> + // @note This is good for breaking up Chinese words, which are >> made of Chinese characters. >> + // Chinese characters do not look strange if they are not >> grouped to form a 'phrase'. >> + // Also, Chinese 'phrases' are of too many patterns and >> probably need a dictionary to look up. >> + // That would be too much. >> + // >> + if (((unsigned char)str[start]) >= 0x80) >> + return start; >> >> p = start; >> chr = evas_common_font_utf8_get_next((unsigned char *)(str), &p); >> >> >> > > -- brian ------------------ Cool-Karaoke - The smallest recording studio, in your palm, open-sourced http://cool-idea.com.tw/ iMaGiNaTiOn iS mOrE iMpOrTaNt tHaN kNoWlEdGe |