mirror of
https://github.com/fltk/fltk.git
synced 2026-05-22 23:37:02 +08:00
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
This commit is contained in:
+9
-5
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user