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


FWIW, just a few notes to make clear what I think to see from the example
pictures.

In FLTK 1.1 wrapping (wrap_mode(1,N), N>0) works only with fixed fonts
correctly, because it only counts bytes (columns) of text.

Duncan, from what I can see, I think that your patch is almost correct,
but only for LGC characters, where each glyph occupies one column
position. Sparkaround showed an example with CJK characters, where each
character occupies two "normal" (LGC) character positions, and hence his
patch version with 2 columns instead of 1 column for each character works
better for his example.

Conclusion(?): There is no such thing like a "fixed font width" in UTF-8,
because LGC and CJK characters have _different_ widths.

Possible solution: to avoid calling fl_measure() or some other expensive
method, we could maybe calculate the Unicode code point and use a table to
decide whether that particular character has a width of 1 or 2 columns.

Sparkaround: Looking back at your post, I think that I just described what
wcwidth() is intended to do. And for the record:

http://www.opengroup.org/onlinepubs/009695399/functions/wcwidth.html

But note in the above text: "This function was removed from the final
ISO/IEC 9899:1990/Amendment 1:1995 (E), and the return value for a
non-printable wide character is not specified."

There is also Markus Kuhn's free implementation:

http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c


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

Reply via email to