Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/common Modified Files: evas_font_main.c evas_font_query.c Log Message: more work on textblocks! :) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_main.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- evas_font_main.c 1 Feb 2005 15:34:37 -0000 1.16 +++ evas_font_main.c 9 Feb 2005 16:10:56 -0000 1.17 @@ -97,14 +97,15 @@ evas_common_font_utf8_get_next(unsigned char *buf, int *iindex) { /* Reads UTF8 bytes from @buf, starting at [EMAIL PROTECTED] and returns - * the code point of the next valid code point. @index is - * updated ready for the next call. + * the decoded code point at iindex offset, and advances iidnex + * to the next code point after this. * * Returns 0 to indicate an error (e.g. invalid UTF8) */ int index = *iindex, r, istart = *iindex; - unsigned char d = buf[index++], d2, d3, d4; + unsigned char d, d2, d3, d4; + d = buf[index++]; if (!d) return 0; if (d < 0x80) @@ -148,27 +149,7 @@ r <<= 6; r |= (d4 & 0x3f); } -#if 0 - index = istart - 1; - d = buf[index]; - if (!(d & 0x80)) - *iindex = index; - else - { - while (index > 0) - { - index--; - d = buf[index]; - if ((d & 0xc0) != 0x80) - { - *iindex = index; - return r; - } - } - } -#else *iindex = index; -#endif return r; } @@ -176,14 +157,15 @@ evas_common_font_utf8_get_prev(unsigned char *buf, int *iindex) { /* Reads UTF8 bytes from @buf, starting at [EMAIL PROTECTED] and returns - * the code point of the previous valid code point. @index is - * updated ready for the next call. + * the decoded code point at iindex offset, and advances iidnex + * to the next code point after this. * * Returns 0 to indicate an error (e.g. invalid UTF8) */ int index = *iindex, r, istart = *iindex; - unsigned char d = buf[index++], d2, d3, d4; - + unsigned char d, d2, d3, d4; + + d = buf[index++]; if (d < 0x80) { r = d; @@ -230,7 +212,6 @@ r <<= 6; r |= (d4 & 0x3f); } -#if 1 index = istart - 1; d = buf[index]; if (!(d & 0x80)) @@ -248,8 +229,35 @@ } } } -#else - *iindex = index; -#endif return r; } + +int +evas_common_font_utf8_get_last(unsigned char *buf, int buflen) +{ + /* jumps to the nul byte at the buffer end and decodes backwards and + * returns the offset index byte in the buffer where the last character + * in the buffer begins. + * + * Returns -1 to indicate an error + */ + int index; + unsigned char d; + + if (buflen < 1) return 0; + index = buflen - 1; + d = buf[index]; + if (!(d & 0x80)) + return index; + else + { + while (index > 0) + { + index--; + d = buf[index]; + if ((d & 0xc0) != 0x80) + return index; + } + } + return 0; +} =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_font_query.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- evas_font_query.c 20 May 2004 07:38:43 -0000 1.13 +++ evas_font_query.c 9 Feb 2005 16:10:56 -0000 1.14 @@ -167,7 +167,7 @@ chr_x = ((pen_x - kern) >> 8) + fg->glyph_out->left; chr_y = (pen_y >> 8) + fg->glyph_out->top; chr_w = fg->glyph_out->bitmap.width + (kern >> 8); - if (text[chr]) +/* if (text[chr]) */ { int advw; @@ -241,7 +241,7 @@ chr_x = ((pen_x - kern) >> 8) + fg->glyph_out->left; chr_y = (pen_y >> 8) + fg->glyph_out->top; chr_w = fg->glyph_out->bitmap.width + (kern >> 8); - if (text[chr]) +/* if (text[chr]) */ { int advw; ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs