Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/lib/canvas
Modified Files:
evas_object_textblock.c
Log Message:
werd wrap is better. it remvoes the whitepsace OVER the wrap...
===================================================================
RCS file:
/cvsroot/enlightenment/e17/libs/evas/src/lib/canvas/evas_object_textblock.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -3 -r1.19 -r1.20
--- evas_object_textblock.c 1 Feb 2005 13:53:40 -0000 1.19
+++ evas_object_textblock.c 1 Feb 2005 15:34:36 -0000 1.20
@@ -540,7 +540,7 @@
{
int inset = 0, hadvance = 0, vadvance = 0;
int ascent = 0, descent = 0, tw = 0, th = 0;
- int chrpos = -1, x, y, cx, cy, cw, ch;
+ int chrpos = -1, nchrpos = -1, x, y, cx, cy, cw, ch;
void *font = NULL;
char *text;
int adj, lastnode;
@@ -606,25 +606,37 @@
/* text doesnt fit */
else
{
+ nchrpos = chrpos;
/* handle word wrap */
if (layout.word_wrap)
{
int ppos, pos, chr;
- pos = evas_string_char_prev_get(text, chrpos, &chr);
- if (!evas_object_textblock_char_is_white(chr))
+ pos = chrpos;
+ chr = evas_common_font_utf8_get_prev(text, &pos);
+ ppos = pos = chrpos;
+ while ((!evas_object_textblock_char_is_white(chr))
+ &&
+ (pos >= 0) &&
+ (chr > 0))
{
- ppos = pos = chrpos;
- while ((!evas_object_textblock_char_is_white(chr))
- &&
- (pos >= 0))
- {
- ppos = pos;
- pos = evas_string_char_prev_get(text, pos,
&chr);
- }
- if (ppos < 0) ppos = 0;
- chrpos = ppos;
+ ppos = pos;
+ chr = evas_common_font_utf8_get_prev(text, &pos);
}
+ chr = evas_common_font_utf8_get_next(text, &ppos);
+ if (ppos < 0) ppos = 0;
+ chrpos = ppos;
+ while ((evas_object_textblock_char_is_white(chr))
+ &&
+ (pos >= 0) &&
+ (chr > 0))
+ {
+ ppos = pos;
+ chr = evas_common_font_utf8_get_prev(text, &pos);
+ }
+ chr = evas_common_font_utf8_get_next(text, &ppos);
+ if (ppos < 0) ppos = 0;
+ nchrpos = ppos;
}
/* if the first char in the line can't fit!!! */
if ((chrpos == 0) && (lnode == line_start))
@@ -641,9 +653,9 @@
char *text1, *text2;
/* byte chrpos is over... so cut there */
- text1 = malloc(chrpos + 1);
- strncpy(text1, text, chrpos);
- text1[chrpos] = 0;
+ text1 = malloc(nchrpos + 1);
+ strncpy(text1, text, nchrpos);
+ text1[nchrpos] = 0;
text2 = strdup(text + chrpos);
lnode->text = text1;
free(text);
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs