diff options
author | Lauris Kaplinski <lauris@src.gnome.org> | 2000-09-09 06:32:24 +0800 |
---|---|---|
committer | Lauris Kaplinski <lauris@src.gnome.org> | 2000-09-09 06:32:24 +0800 |
commit | 1768e0e4fde11a6dfdf2336536edce3c954f4474 (patch) | |
tree | 8d778c052a38846c98e1def4e10438a459c2debf /widgets | |
parent | 16e05ea9a531460f45404773e0cb1f0a8aafb10f (diff) | |
download | gsoc2013-evolution-1768e0e4fde11a6dfdf2336536edce3c954f4474.tar.gz gsoc2013-evolution-1768e0e4fde11a6dfdf2336536edce3c954f4474.tar.zst gsoc2013-evolution-1768e0e4fde11a6dfdf2336536edce3c954f4474.zip |
Some UTF-8 fixes and experimental 16-bit unicode font support
svn path=/trunk/; revision=5279
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/ChangeLog | 4 | ||||
-rw-r--r-- | widgets/e-text/e-text.c | 10 | ||||
-rw-r--r-- | widgets/text/e-text.c | 10 |
3 files changed, 14 insertions, 10 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog index 09425c22f6..00226f5cb0 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,7 @@ +2000-09-08 Lauris Kaplinski <lauris@helixcode.com> + + * e-text/e-text.c (calc_line_widths): Fix byte/char confusion + 2000-08-30 Federico Mena Quintero <federico@helixcode.com> * e-paned/e-hpaned.c (e_hpaned_motion): Do not flicker while diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c index ed87f21c95..cb064c9c40 100644 --- a/widgets/e-text/e-text.c +++ b/widgets/e-text/e-text.c @@ -683,8 +683,8 @@ calc_line_widths (EText *text) { struct line *lines; int i; - int j; gdouble clip_width; + gchar *p; /* Make sure line has been split */ if (text->text && text->num_lines == 0) @@ -721,10 +721,10 @@ calc_line_widths (EText *text) clip_width >= 0) { if (text->font) { lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++ ) { - if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, j) + text->ellipsis_width - <= clip_width) - lines->ellipsis_length = j; + for (p = lines->text; p && *p && (p - lines->text) < lines->length; p = unicode_next_utf8 (p)) { + if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, p - lines->text) + + text->ellipsis_width <= clip_width) + lines->ellipsis_length = p - lines->text; else break; } diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index ed87f21c95..cb064c9c40 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -683,8 +683,8 @@ calc_line_widths (EText *text) { struct line *lines; int i; - int j; gdouble clip_width; + gchar *p; /* Make sure line has been split */ if (text->text && text->num_lines == 0) @@ -721,10 +721,10 @@ calc_line_widths (EText *text) clip_width >= 0) { if (text->font) { lines->ellipsis_length = 0; - for (j = 0; j < lines->length; j++ ) { - if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, j) + text->ellipsis_width - <= clip_width) - lines->ellipsis_length = j; + for (p = lines->text; p && *p && (p - lines->text) < lines->length; p = unicode_next_utf8 (p)) { + if (e_font_utf8_text_width (text->font, E_FONT_PLAIN, lines->text, p - lines->text) + + text->ellipsis_width <= clip_width) + lines->ellipsis_length = p - lines->text; else break; } |