bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24699: Some characters should have char-width of 2


From: Georges Ko
Subject: bug#24699: Some characters should have char-width of 2
Date: Sat, 15 Oct 2016 22:31:24 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (windows-nt) Hamster/2.0.0.1

Eli Zaretskii <eliz@gnu.org> writes:

>> These characters should have a char-width of 2, for consistency?
>
> I'm not sure what consistency you have in mind.

By consistency, I meant consistency with the characters of the same
"type", and by that I mean in the same code point block.

> We use the data in the Unicode file EastAsianWidth.txt to determine
> which characters should have a char-width of 2.  The characters you
> mention are not East-Asian characters, and therefore do not get 2 as
> their width.  And at least some of them, e.g. U+1F5A0, are of the same
> width on my screen as Latin letters, so 2 would be wrong for them.

Oh OK, that explains the widths, but some are of width 2 (see output at
the end of this post). I checked this EastAsianWidth.txt in
http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt: MAPLE
LEAF (#x1F341) and BEAR FACE (#x1F43B) are listed:

1F337..1F37C;W   # So    [70] TULIP..BABY BOTTLE
1F400..1F43E;W   # So    [63] RAT..PAW PRINTS

So BEAR FACE and MAPLE LEAF should be of the same width, but they are
not in Emacs:

(char-width ?🍁) => 2
(char-width ?🐻) => 1

Could the EastAsianWidth.txt (not found in Emacs sources) used to
generate was an old version? Is the generated output in characters.el
starting from this line?

;; 2: East Asian Wide and Full-width characters.
(let ((l '((#x1100 . #x115F)
.
.
.

See below the discrepancies between EastAsianWidth.txt data (from URL)
and actual char-width at the end of this post, just for this block,
which match the 63 RAT to RAW PRINTS code points.

> Can you tell what practical problem in Emacs are you trying to solve?

A side effect of having non-consistent char-width is badly aligned
org-mode tables. A table with a MAPLE LEAF (width=2) and a BEAR FACE
(width=1) is aligned like this by org-mode:

| Char | Name       |
|------+------------|
| 🍁   | MAPLE LEAF |
| 🐻    | BEAR FACE  |

2 and 3 spaces after MAPLE LEAF and BEAR FACE due to char-width
difference, so I have to add things like this to mitigate that:

(set-char-table-range char-width-table '(?🐻 . ?🐻) 2)

Block Miscellaneous Symbols and Pictographs:

E = EastAsianWidth.txt (2=W, 1=N) and W = (char-width c)

E | W | Char  | Code Point       | Name
--+---+-------+------------------+-------------------------------
2 | 1 | 🐀    | #x1F400 (128000) | RAT
2 | 1 | 🐁    | #x1F401 (128001) | MOUSE
2 | 1 | 🐂    | #x1F402 (128002) | OX
2 | 1 | 🐃    | #x1F403 (128003) | WATER BUFFALO
2 | 1 | 🐄    | #x1F404 (128004) | COW
2 | 1 | 🐅    | #x1F405 (128005) | TIGER
2 | 1 | 🐆    | #x1F406 (128006) | LEOPARD
2 | 1 | 🐇    | #x1F407 (128007) | RABBIT
2 | 1 | 🐈    | #x1F408 (128008) | CAT
2 | 1 | 🐉    | #x1F409 (128009) | DRAGON
2 | 1 | 🐊    | #x1F40A (128010) | CROCODILE
2 | 1 | 🐋    | #x1F40B (128011) | WHALE
2 | 1 | 🐌    | #x1F40C (128012) | SNAIL
2 | 1 | 🐍    | #x1F40D (128013) | SNAKE
2 | 1 | 🐎    | #x1F40E (128014) | HORSE
2 | 1 | 🐏    | #x1F40F (128015) | RAM
2 | 1 | 🐐    | #x1F410 (128016) | GOAT
2 | 1 | 🐑    | #x1F411 (128017) | SHEEP
2 | 1 | 🐒    | #x1F412 (128018) | MONKEY
2 | 1 | 🐓    | #x1F413 (128019) | ROOSTER
2 | 1 | 🐔    | #x1F414 (128020) | CHICKEN
2 | 1 | 🐕    | #x1F415 (128021) | DOG
2 | 1 | 🐖    | #x1F416 (128022) | PIG
2 | 1 | 🐗    | #x1F417 (128023) | BOAR
2 | 1 | 🐘    | #x1F418 (128024) | ELEPHANT
2 | 1 | 🐙    | #x1F419 (128025) | OCTOPUS
2 | 1 | 🐚    | #x1F41A (128026) | SPIRAL SHELL
2 | 1 | 🐛    | #x1F41B (128027) | BUG
2 | 1 | 🐜    | #x1F41C (128028) | ANT
2 | 1 | 🐝    | #x1F41D (128029) | HONEYBEE
2 | 1 | 🐞    | #x1F41E (128030) | LADY BEETLE
2 | 1 | 🐟    | #x1F41F (128031) | FISH
2 | 1 | 🐠    | #x1F420 (128032) | TROPICAL FISH
2 | 1 | 🐡    | #x1F421 (128033) | BLOWFISH
2 | 1 | 🐢    | #x1F422 (128034) | TURTLE
2 | 1 | 🐣    | #x1F423 (128035) | HATCHING CHICK
2 | 1 | 🐤    | #x1F424 (128036) | BABY CHICK
2 | 1 | 🐥    | #x1F425 (128037) | FRONT-FACING BABY CHICK
2 | 1 | 🐦    | #x1F426 (128038) | BIRD
2 | 1 | 🐧    | #x1F427 (128039) | PENGUIN
2 | 1 | 🐨    | #x1F428 (128040) | KOALA
2 | 1 | 🐩    | #x1F429 (128041) | POODLE
2 | 1 | 🐪    | #x1F42A (128042) | DROMEDARY CAMEL
2 | 1 | 🐫    | #x1F42B (128043) | BACTRIAN CAMEL
2 | 1 | 🐬    | #x1F42C (128044) | DOLPHIN
2 | 1 | 🐭    | #x1F42D (128045) | MOUSE FACE
2 | 1 | 🐮    | #x1F42E (128046) | COW FACE
2 | 1 | 🐯    | #x1F42F (128047) | TIGER FACE
2 | 1 | 🐰    | #x1F430 (128048) | RABBIT FACE
2 | 1 | 🐱    | #x1F431 (128049) | CAT FACE
2 | 1 | 🐲    | #x1F432 (128050) | DRAGON FACE
2 | 1 | 🐳    | #x1F433 (128051) | SPOUTING WHALE
2 | 1 | 🐴    | #x1F434 (128052) | HORSE FACE
2 | 1 | 🐵    | #x1F435 (128053) | MONKEY FACE
2 | 1 | 🐶    | #x1F436 (128054) | DOG FACE
2 | 1 | 🐷    | #x1F437 (128055) | PIG FACE
2 | 1 | 🐸    | #x1F438 (128056) | FROG FACE
2 | 1 | 🐹    | #x1F439 (128057) | HAMSTER FACE
2 | 1 | 🐺    | #x1F43A (128058) | WOLF FACE
2 | 1 | 🐻    | #x1F43B (128059) | BEAR FACE
2 | 1 | 🐼    | #x1F43C (128060) | PANDA FACE
2 | 1 | 🐽    | #x1F43D (128061) | PIG NOSE
2 | 1 | 🐾    | #x1F43E (128062) | PAW PRINTS

Georges
-- 
 Georges Ko                     gko@gko.net                      2016-10-15






reply via email to

[Prev in Thread] Current Thread [Next in Thread]