I discovered that in the Mac OS X Terminal, some Unicode characters take up more than one character space. For example 27FC (long rightwards arrow from bar). It prints two characters wide, but the second character prints on top of whatever the next character is, so you have to do ?<space>
for it to print correctly. For example, ?a
prints like.
(I made the font size large so that you could see it, but it does it for all font sizes).
By the way, this is the Menlo font in the Mac OS X 10.6 Terminal application.
23B3 (SUMMATION TOP) actually prints as two characters wide and tall (at least in Safari, it does this in the browser too, notice how it overlaps with the above line)?
However, in the terminal in Ubuntu, none of these characters print wider or taller than one character.
Is there a way to programmatically tell if a character takes up more than one space?
I'm using Python, so something that works either in pure Python or on POSIX (i.e., I can call some bash command using the os
module) would be preferred.
Also, I should note that if I increase the "Character Spacing" setting in the font settings of the terminal to 1.5 (from the default 1.0), then it looks like
.
Also, it'd be nice if an answer could give some insight into all of this (i.e., why does it happen?)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…