[PATCH 1/2] As some CJK fonts are dual-width, use the average width of ASCII glyphs instead of the max_x_advance of the font, just like the vte project.

Bill Spitzak spitzak at gmail.com
Tue Jul 9 10:17:55 PDT 2013


Having done this before (but about 18 years ago) I *REALLY* doubt this 
solution is better. However it is possible that font design has changed 
a good deal since then?

Using the width of a '2' made attempts by software to print columns look 
*vastly* better. It was unreadable before this because the average width 
was not equal to *any* character.

And an average that is not weighted by letter frequency makes no sense. 
I suspect the result here (because it weights the larger capital letters 
about 6x more than it should) is to raise the average so that it 
approaches the width of a '2' (or an 'n'). I would dump this and just 
use the width of a '2'.

The fact that it is in Gnome code is *not* a selling point imho.

Peng Wu wrote:
> Actually I used the technique from vte terminal widget.
> 
> See: https://git.gnome.org/browse/vte/tree/src/vtedraw.h#n34
> 
> The average width is used for the ascii glyphs.
> Use "2" or "n" glyph is good for some font, but maybe not for the other
> fonts.
> Use the average width is good for most fonts, including
> dual-width/proportional fonts.


More information about the wayland-devel mailing list