Bug#960164: xterm: forceBoxChars mode + cjkWidth mode renders oddly

2020-05-10 Thread Thomas Dickey
On Sun, May 10, 2020 at 01:38:51PM +1000, Timothy Allen wrote:
> Package: xterm
> Version: 356-1
> Severity: minor

:-)

> However, the box-drawing characters are "East-Asian Width: Ambiguous"
> in Unicode, so in CJK-width mode they should occupy 2 character cells,
> looking something like this:

"should" makes a lot of assumptions.  Where it falls short is that
(as far as I recall...) none of the systems' locale support can tell
an application that the width ought to be "fullwidth".

Attaching a quick demo using wcwidth -- running with all of the available
locales, it finds no occurrence of "fullwidth" line-drawing characters.

-- 
Thomas E. Dickey 
https://invisible-island.net
ftp://ftp.invisible-island.net
#define _XOPEN_SOURCE		/* See feature_test_macros(7) */
#include 
#include 
#include 
#include 

#define DATA(code,name) { code, #name }
static struct {
wchar_t code;
const char *name;
} table[] = {

DATA(0x2500, box drawings light horizontal),
	DATA(0x2502, box drawings light vertical),
	DATA(0x250c, box drawings light down and right),
	DATA(0x2510, box drawings light down and left),
	DATA(0x2514, box drawings light up and right),
	DATA(0x2518, box drawings light up and left),
	DATA(0x251c, box drawings light vertical and right),
	DATA(0x2524, box drawings light vertical and left),
	DATA(0x252c, box drawings light down and horizontal),
	DATA(0x2534, box drawings light up and horizontal),
	DATA(0x253c, box drawings light vertical and horizontal),
};

int
main(int argc, char *argv[])
{
int n;

for (n = 1; n < argc; ++n) {
	int c;
	setlocale(LC_CTYPE, argv[n]);
	for (c = 0; c < sizeof(table) / sizeof(table[0]); ++c) {
	int w = wcwidth(table[c].code);
	if (w != 1) {
		printf("%s:%d:%s\n", argv[n], w, table[n].name);
	}
	}
	setlocale(LC_CTYPE, "C");
}
return EXIT_SUCCESS;
}


signature.asc
Description: PGP signature


Bug#960164: xterm: forceBoxChars mode + cjkWidth mode renders oddly

2020-05-09 Thread Timothy Allen
Package: xterm
Version: 356-1
Severity: minor

Steps to reproduce:

  - Launch xterm in "CJK width" mode, forcing xterm to render
box-drawing characters itself:

xterm -cjk_width +fbx

  - Run the following command to print some box-drawing characters:

python3 -c 'print("a\u2500\u2500\u2500b\na\u2550\u2550\u2550b\n")'

Expected results:

In non-CJK-width mode, all the printed characters are one character-cell
wide, so the output looks like this (assuming the browser/email client
you're using also uses non-CJK-width mode):

a───b
a═══b

However, the box-drawing characters are "East-Asian Width: Ambiguous"
in Unicode, so in CJK-width mode they should occupy 2 character cells,
looking something like this:

a──b
a══b

Actual results:

a───   b
a═ ═ ═ b

For the second line, I guess xterm doesn't actually treat those box-drawing
characters specially, so it just pads them out, which is fair enough.

For the first line, though, xterm understands the box-drawing characters
should be wide, and it leaves room for them to be wide, but it draws them
narrow. At the very least, if it's going to draw them narrow it should pad
them out like the second line, but if it's going to draw them it might as
well draw them the correct width to begin with.



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.4.0-4-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages xterm depends on:
ii  libc6   2.30-4
ii  libfontconfig1  2.13.1-4
ii  libfreetype62.10.1-2
ii  libice6 2:1.0.9-2
ii  libtinfo6   6.2-1
ii  libutempter01.1.6-6
ii  libx11-62:1.6.9-2+b1
ii  libxaw7 2:1.0.13-1+b2
ii  libxext62:1.3.3-1+b2
ii  libxft2 2.3.2-2
ii  libxinerama12:1.1.4-2
ii  libxmu6 2:1.1.2-2+b3
ii  libxpm4 1:3.5.12-1
ii  libxt6  1:1.1.5-1+b3
ii  xbitmaps1.1.1-2

Versions of packages xterm recommends:
ii  x11-utils  7.7+5

Versions of packages xterm suggests:
pn  xfonts-cyrillic  

-- no debconf information