diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2011-10-01 16:25:30 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2011-10-01 16:25:30 +0000 |
| commit | 95692bf2876398cad83afb767e488e6886a4e6bc (patch) | |
| tree | 16152358830dbcb44a59c3c54e3ac863b6032edf /fluid | |
| parent | 8e95ba0700562b196a461f54e1970b3fa427f18e (diff) | |
STR 2722: Fluid widget browser was not UTF8 reay yet.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9112 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Type.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index 9f8ae1539..b8b463e81 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -312,13 +312,17 @@ void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const { fl_font(textfont()|FL_BOLD, textsize()); fl_draw(c, X, Y+13); } else if ((c=l->label())) { - char buf[50]; char* p = buf; + char buf[100]; char* p = buf; *p++ = '"'; - for (int i = 20; i--;) { - if (! (*c & -32)) break; - *p++ = *c++; + int b,l=strlen(c); // size in bytes + for (int i = 20; i>0;i--) { // maximum 20 characters + if (*c==0) break; // end of string + fl_utf8decode(c, c+l, &b); // b=size of char in bytes + if (b==-1) break; // some error - leave + l-=b; // l = bytes left in string + while (b--)*p++ = *c++; // copy that character into the buffer } - if (*c) {strcpy(p,"..."); p+=3;} + if (*c) {strcpy(p,"..."); p+=3;} // there would be more to this string *p++ = '"'; *p = 0; fl_draw(buf, X, Y+13); |
