DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2158 Version: 1.3-current After a lot of dicking around trying to add wcwidth.c to libfltk_xutf8.a and failing, I finally just #include'd it directly in Fl_Text_Buffer.cxx and set up: <pre> int Fl_Text_Buffer::expand_character(const char* s, int indent, char *outStr, int tabDist, char nullSubsChar) { char c = *s; if ((c & 0x80) && (c & 0x40)) { int len = fl_utf8len(c); int ret = 0; unsigned int ucs = fl_utf8decode(s, s+len, &ret); int width = mk_wcwidth((wchar_t)ucs); fprintf(stderr, "mk_wcwidth(%x) -> %d\n", ucs, width); return width; } return expand_character(c, indent, outStr, tabDist, nullSubsChar); } int Fl_Text_Buffer::character_width(const char* s, int indent, int tabDist, char nullSubsChar) { char c = *s; if ((c & 0x80) && (c & 0x40)) { int len = fl_utf8len(c); int ret = 0; unsigned int ucs = fl_utf8decode(s, s+len, &ret); int width = mk_wcwidth((wchar_t)ucs); fprintf(stderr, "mk_wcwidth(%x) -> %d\n", ucs, width); return width; } return character_width(c, indent, tabDist, nullSubsChar); } </pre> to call the existing versions, and started to substitute the calls for the originals with the new ones, but then you need to create a lookalike for Fl_Text_Buffer::character(pos) that returns a char* and so on. I got so far, but then the textdisplay example stopped displaying the chinese characters, even though I could see that the above were calling mk_wcwidth(0x54c8) and returning 2. Then I discovered that there's a whole load of calculations based on reverse mapping from column numbers on the display to pixel widths. At this point, I realised this is just one big can of worms, and it probably means that my other idea for adding a column indicator to wrap_mode() will probably be difficult to get working too :-( Link: http://www.fltk.org/str.php?L2158 Version: 1.3-current _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
