[PATCH 2/2] Some CJK glyphs are wide, which occupy two columns. If the glyph is wide, then use two columns instead of one.

Bill Spitzak spitzak at gmail.com
Mon Jul 8 17:38:14 PDT 2013

There are two character widths.

The terminal should be using the string width reported from cairo for 
all graphics, such as the underscore shown here. A correct 
implementation should work acceptably with proportionally-spaced fonts. 
This is certainly not true of the current wayland terminal.

Code such as wcwidth.c should only be used to interpret incoming 
characters to figure out the resulting text display. For instance if you 
want to perfectly emulate a terminal you need to make a grid of 
character cells. A wcwidth=2 character when drawn replaces two entries 
in the grid. You then build text strings from each line of the grid and 
draw those strings as the lines on the output. I think this is not 
necessary for a demo, this would really be used only for a complex 
accurate emulation of old terminal software.

Thomas Daede wrote:
> A similar function is wcwidth(). There is an implementation here:
> http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c
> I don't know how it compares to the complexity or feature completeness
> of Pango's implementation (which I think is a wrapper around HarfBuzz)

More information about the wayland-devel mailing list