Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using black squares \xe2\x97\xbc◼ and white squares \xe2\x97\xbb◻ to display tetris boards in my shell. Unfortunately there is quite a visible line spacing between rows and that just doesn't look good.

I am on a Mac (zsh) and there is a line spacing setting. When I reduce it to the minimum (0.5) it looks pretty good. But unfortunately the rest of the terminal looks bad then ;)

So ideally I need a way to dynamically set the line height / line spacing or something. Or another creative idea to display pretty tetris boards.

Any help is welcome.

share|improve this question
1  
FYI: \xe2\x97\xbb is a byte sequence specific to the UTF-8 encoding. The canonical (?) representation of the same Unicode codepoint is \u25fb, or U+25FB. –  grawity Feb 8 '11 at 19:37
1  
Also, the shell you are using (zsh) doesn't matter. Only the terminal (Terminal.app) does. –  grawity Feb 8 '11 at 19:58

3 Answers 3

Terminal has controls for horizontal and vertical spacing in the Font panel, which you can open by clicking the Change button:

Terminal > Preferences > Settings > [your setting] > Text > Font > Change

In addition, if you use the VT100 "graphic" characters, Terminal will render them by drawing the lines "manually" to ensure they connect, instead of using character glyphs. Unfortunately, it doesn't contain single-character-cell boxes. You'd have to draw boxes using four characters to draw the corners. e.g.:

tput smacs; echo 'lk'; echo 'mj'; tput rmacs

Using a space character with a background color as suggested by Miles is the best way to fill exactly one character cell.

share|improve this answer

These are almost guaranteed to be supported in a terminal, even in non-Unicode modes:

  • U+2588 Full Block
  • U+2593 Dark Shade
  • U+2592 Medium Shade
  • U+2591 Light Shade

Also, ANSI colors.

share|improve this answer
    
Great, those look better than my blocks but there is still some spacing between rows. No ideas to work around that? –  eteubert Feb 8 '11 at 23:30

Mac OS X doesn't seem to have great support for box-drawing characters, in terms of displaying them with appropriate spacing. You may have better luck with an alternate terminal like xterm or iTerm.app. If you want to stick with Terminal.app, one thing you could try is outputting whitespace with varying background colors, which will at least give you blocks with no space in between (if not much else).

For example,

TERM=nsterm
for j in {0..25}; do
    for i in {0..15}; do
        tput setb $i
        echo -n '   '
    done
done; echo

yields

Terminal screenshot

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.