Box-drawing characters

Box drawing characters, also known as line drawing characters, or pseudographics, are widely used in text user interfaces to draw various frames and boxes. In graphical user interfaces these characters are much less useful, because it is much simpler to draw lines and rectangles directly with graphical APIs; besides, box drawing characters work only with fixed-width (monospaced) fonts. They are still useful, however, for plaintext comments on websites.

Used along with box drawing characters are block elements, shade characters and terminal graphic characters; these can be used for filling regions of the screen and drop shadows.

Contents

Encodings

Unicode

Unicode includes 128 such characters:[1] The adjacent Block Elements table contains 32 block element, shade and terminal graphics characters.[2]

Box Drawing[1]
Unicode.org chart (PDF)
  0 1 2 3 4 5 6 7 8 9 A B C D E F
U+250x
U+251x
U+252x
U+253x
U+254x
U+255x
U+256x
U+257x
Notes
1.^ As of Unicode version 6.0
Block Elements[1]
Unicode.org chart (PDF)
  0 1 2 3 4 5 6 7 8 9 A B C D E F
U+258x
U+259x
Notes
1.^ As of Unicode version 6.0

DOS

In all MS-DOS code pages, box drawing characters are present, but their number is limited to 40 (for example in code page 437):

0 1 2 3 4 5 6 7 8 9 A B C D E F
B
C
D

Their number is further limited to 22 on those code pages that use their places for other, usually alphabetic, characters (such as code page 850):

0 1 2 3 4 5 6 7 8 9 A B C D E F
B
C
D

Unix

On many Unix systems, usually only 11 basic characters are available, via the VT100 alternate character set:

0 1 2 3 4 5 6 7 8 9 A B C D E F
6
7

And on some terminals, they are not available at all, so they are replaced with ASCII characters that approximate box drawing characters, such as - (hyphen-minus), | (vertical bar) and + (plus sign) in a kind of ASCII art fashion.

As these codes conflict with the lower-case ASCII characters (0x6A is equivalent to "j"), it may be necessary to shift into the graphic character set "<Esc>(0" to use these codes and back "<Esc>(B" when finished.

Historical

Many microcomputers of the 1970s and 1980s had their own proprietary character sets which also included box drawing characters. Some of these sets, such as Commodore's PETSCII, include box drawing symbols with no corresponding Unicode character.

The Sinclair ZX81 and Spectrum included a set of pseudographics with block elements and dithering patterns.

The BBC Micro could utilise the Teletext 7-bit character set, which had 128 box drawing characters, whose code points were shared with the regular alphanumeric and punctuation characters. Control characters were used to switch between regular text and box drawing.[3]

Some recent embedded systems also use proprietary character sets, usually extensions to ISO 8859 character sets, which include box drawing characters or other special symbols.

The World Standard Teletext (WST) uses pixel-drawing characters for some graphics. A character cell is divided in 2×3 regions, and 26 = 64 code positions are allocated for all possible combinations of “pixels”. However, these characters have not been encoded into the Unicode standard.

Examples

Sample constructions made out of the Unicode characters:

┌─┬┐╔═╦╗┏━┳┓╓─╥╖╒═╤╕
│││║ ║║┃┃┃║║║│││
├─┼┤╠═╬╣┣━╋┫╟─╫╢╞═╪╡
└─┴┘╚═╩╝┗━┻┛╙─╨╜╘═╧╛
┌───────────────────┐
│  ╔═══╗ Some Text  │▒
│  ╚═╦═╝ in the box │▒
╞═╤══╩══╤═══════════╡▒
│ ├──┬──┤           │▒
│ └──┴──┘           │▒
└───────────────────┘▒
 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒

See also

References

  1. ^ Box Drawing U+2500-U+257F, The Unicode Standard Code Charts
  2. ^ Block Elements U+2580-U+259F, The Unicode Standard Code Charts
  3. ^ http://www.doc.ic.ac.uk/%7Eih/teaching/teletext/tt-spec/