evas_common_font_utf8_get_prev currently works correctly only on an ASCII symbols. For non-ASCII it just returns random garbage somehow constructed from a string.
Attached patch makes it work according to the comment at the start. -- http://fossarchy.blogspot.com/
pgpBbWgra1FbF.pgp
Description: PGP signature
Index: src/lib/engines/common/evas_font_main.c
===================================================================
--- src/lib/engines/common/evas_font_main.c (revision 41283)
+++ src/lib/engines/common/evas_font_main.c (working copy)
@@ -193,53 +193,20 @@
*
* Returns 0 to indicate there is no prev char
*/
- int index = *iindex, len, r;
- unsigned char d, d2, d3, d4;
+ int index = *iindex;
if (index <= 0)
return 0;
- d = buf[index--];
+ /* First obtain the codepoint at iindex */
+ int r = evas_common_font_utf8_get_next(buf, &index);
+
+ /* Next advance iindex to previous codepoint */
+ index = *iindex;
+ index--;
while ((index > 0) && ((buf[index] & 0xc0) == 0x80))
index--;
- len = *iindex - index;
- if (len == 1)
- r = d;
- else if (len == 2)
- {
- /* 2 bytes */
- d2 = buf[index + 1];
- r = d & 0x1f; /* copy lower 5 */
- r <<= 6;
- r |= (d2 & 0x3f); /* copy lower 6 */
- }
- else if (len == 3)
- {
- /* 3 bytes */
- d2 = buf[index + 1];
- d3 = buf[index + 2];
- r = d & 0x0f; /* copy lower 4 */
- r <<= 6;
- r |= (d2 & 0x3f);
- r <<= 6;
- r |= (d3 & 0x3f);
- }
- else
- {
- /* 4 bytes */
- d2 = buf[index + 1];
- d3 = buf[index + 2];
- d4 = buf[index + 3];
- r = d & 0x0f; /* copy lower 4 */
- r <<= 6;
- r |= (d2 & 0x3f);
- r <<= 6;
- r |= (d3 & 0x3f);
- r <<= 6;
- r |= (d4 & 0x3f);
- }
-
*iindex = index;
return r;
}
------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
