Author: matt
Date: 2011-10-01 09:25:30 -0700 (Sat, 01 Oct 2011)
New Revision: 9112
Log:
STR 2722: Fluid widget browser was not UTF8 reay yet.
Modified:
branches/branch-1.3/fluid/Fl_Type.cxx
Modified: branches/branch-1.3/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-1.3/fluid/Fl_Type.cxx 2011-10-01 15:54:11 UTC (rev
9111)
+++ branches/branch-1.3/fluid/Fl_Type.cxx 2011-10-01 16:25:30 UTC (rev
9112)
@@ -312,13 +312,17 @@
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);
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit