Box-drawing character
Box-drawing characters, also known as line-drawing characters, are a form of semigraphics widely used in text user interfaces to draw various geometric frames and boxes. Box-drawing characters typically only work well with monospaced fonts. In graphical user interfaces, these characters are much less useful as it is more simple and appropriate to draw lines and rectangles directly with graphical APIs. However, they are still useful for command-line interfaces and plaintext comments within source code.
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 portraying drop shadows.
EncodingsEdit
UnicodeEdit
Unicode includes 128 such characters in the Box Drawing block.[1] In many Unicode fonts only the subset that is also available in the IBM PC character set (see below) will exist, due to it being defined as part of the WGL4 character set.
Box Drawing[1] Official Unicode Consortium code 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
|
The Block Elements Unicode block includes shading characters. 32 characters are included in the block.
Block Elements[1] Official Unicode Consortium code chart (PDF) | ||||||||||||||||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
U+258x | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ |
U+259x | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ |
Notes
|
In version 13.0, Unicode was extended with another block containing many box-drawing characters, Symbols for Legacy Computing, which includes box-drawing characters and other symbols used by obsolete operating systems (mostly from the 1980s):
Symbols for Legacy Computing[1][2] Official Unicode Consortium code chart (PDF) | ||||||||||||||||
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
U+1FB0x | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ |
U+1FB1x | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ | ๐ฌ |
U+1FB2x | ๐ฌ | ๐ฌก | ๐ฌข | ๐ฌฃ | ๐ฌค | ๐ฌฅ | ๐ฌฆ | ๐ฌง | ๐ฌจ | ๐ฌฉ | ๐ฌช | ๐ฌซ | ๐ฌฌ | ๐ฌญ | ๐ฌฎ | ๐ฌฏ |
U+1FB3x | ๐ฌฐ | ๐ฌฑ | ๐ฌฒ | ๐ฌณ | ๐ฌด | ๐ฌต | ๐ฌถ | ๐ฌท | ๐ฌธ | ๐ฌน | ๐ฌบ | ๐ฌป | ๐ฌผ | ๐ฌฝ | ๐ฌพ | ๐ฌฟ |
U+1FB4x | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ |
U+1FB5x | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ | ๐ญ |
U+1FB6x | ๐ญ | ๐ญก | ๐ญข | ๐ญฃ | ๐ญค | ๐ญฅ | ๐ญฆ | ๐ญง | ๐ญจ | ๐ญฉ | ๐ญช | ๐ญซ | ๐ญฌ | ๐ญญ | ๐ญฎ | ๐ญฏ |
U+1FB7x | ๐ญฐ | ๐ญฑ | ๐ญฒ | ๐ญณ | ๐ญด | ๐ญต | ๐ญถ | ๐ญท | ๐ญธ | ๐ญน | ๐ญบ | ๐ญป | ๐ญผ | ๐ญฝ | ๐ญพ | ๐ญฟ |
U+1FB8x | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ |
U+1FB9x | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | ๐ฎ | |
U+1FBAx | ๐ฎ | ๐ฎก | ๐ฎข | ๐ฎฃ | ๐ฎค | ๐ฎฅ | ๐ฎฆ | ๐ฎง | ๐ฎจ | ๐ฎฉ | ๐ฎช | ๐ฎซ | ๐ฎฌ | ๐ฎญ | ๐ฎฎ | ๐ฎฏ |
U+1FBBx | ๐ฎฐ | ๐ฎฑ | ๐ฎฒ | ๐ฎณ | ๐ฎด | ๐ฎต | ๐ฎถ | ๐ฎท | ๐ฎธ | ๐ฎน | ๐ฎบ | ๐ฎป | ๐ฎผ | ๐ฎฝ | ๐ฎพ | ๐ฎฟ |
U+1FBCx | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | ๐ฏ | |||||
U+1FBDx | ||||||||||||||||
U+1FBEx | ||||||||||||||||
U+1FBFx | ๐ฏฐ | ๐ฏฑ | ๐ฏฒ | ๐ฏณ | ๐ฏด | ๐ฏต | ๐ฏถ | ๐ฏท | ๐ฏธ | ๐ฏน | ||||||
Notes |
DOSEdit
The hardware code page of the original IBM PC supplied the following box-drawing characters, in what DOS now calls code page 437. This subset of the Unicode box-drawing characters is thus far more popular and likely to be rendered correctly:
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 replace the 18 "single/double hybrid" characters with 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 | โ | โ |
Note: The non-double characters are the "thin" (light) ones (U+2500, U+2502), not the "bold" (heavy) ones (U+2501, U+2503).
Some OEM DOS computers supported other character sets, for example the Hewlett-Packard HP 110 / HP Portable and HP 110 Plus / HP Portable Plus, where in a modified version of the character set box-drawing characters were added in reserved areas of their normal HP Roman-8 character set.[2][3]
[2][3] | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | โ | โ | โ | โ | โฃ | โฉ | โฆ | โ | โ | โ | โฌ | |||||
9 | โ | โ | โ | โ | โค | โด | โฌ | โ | โ | โ | โผ |
Unix, CP/M, BBSEdit
On many Unix systems and early dial-up bulletin board systems the only common standard for box-drawing characters was the VT100 alternate character set (see also: DEC Special Graphics). The escape sequence Esc ( 0
switched the codes for lower-case ASCII letters to draw this set, and the sequence Esc ( B
switched back:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | โ | โ | โ | โ | โผ | |||||||||||
7 | โ | โ | โค | โด | โฌ | โ |
A Bash script that displays all of the semigraphic characters:
$ for i in 6a 6b 6c 6d 6e 71 74 75 76 77 78; do printf "0x$i \x$i \x1b(0\x$i\x1b(B\n"; done
0x6a j โ
0x6b k โ
0x6c l โ
0x6d m โ
0x6e n โผ
0x71 q โ
0x74 t โ
0x75 u โค
0x76 v โด
0x77 w โฌ
0x78 x โ
On some terminals, these characters are not available at all, and the complexity of the escape sequences discouraged their use, so often only ASCII characters that approximate box-drawing characters are used, such as - (hyphen-minus), | (vertical bar), _ (underscore), = (equal sign) and + (plus sign) in a kind of ASCII art fashion.
Modern Unix terminal emulators use Unicode and thus have access to the line-drawing characters listed above.
HistoricalEdit
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 ZX80, ZX81 and Spectrum included a set of text semigraphics 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.[4]
The BBC Master and later Acorn computers have the soft font by default defined with line drawing characters.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | โท | โถ | โ | โด | โ | โ | โฌ | โต | โ | โ | โ | โ | โค | โด | โผ | |
B | โญ | โฎ | โฐ | โฏ |
The Amstrad CPC also has soft characters defined by default as block and line drawing characters.
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | โ | |
9 | โต | โถ | โ | โท | โ | โ | โ | โด | โ | โ | โด | โ | โค | โฌ | โผ |
The CP/M Plus character set used on various Amstrad computers of the CPC, PCW and Spectrum families included a rich set of line-drawing characters as well:[5][6][7]
[5] | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8 | โง | โ | โ | โค | โ | โ | โ | โข | โ | โ | โฉ | โ | โฃ | โฆ | โฌ | |
9 | โต | โถ | โ | โท | โ | โ | โ | โด | โ | โ | โด | โ | โค | โฌ | โผ |
MouseText is a set of display characters for the Apple IIc, IIe, and IIgs that includes box-drawing characters.
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 System 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".[8] These characters were added to the Unicode standard in Version 13.[9]
Character codeEdit
On many platforms, the character shape is determined programmatically from the character code.
ZX Spectrum block characters: 0x80 + topright*1 + topleft*2 + bottomright*4 + bottomleft*8
Amstrad CPC block characters: 0x80 + topleft*1 + topright*2 + bottomleft*4 + bottomright*8
Amstrad CPC line characters: 0x90 + up*1 + right*2 + down*4 + left*8
BBC Master line characters: 0xA0 + down*1 + right*2 + left*4 + up*8
Teletext block characters: 0xA0 + topleft*1 + topright*2 + middleleft*4 + middleright*8 + bottomleft*16 + bottomright*64
DOS linedraw characters are not ordered in any programmatic manner, and calculating a particular character shape needs to use a look-up table.
ExamplesEdit
Sample diagrams made out of the standard box-drawing characters, using a monospaced font:
โโโฌโ โโโฆโ โโโฅโ โโโคโ โ โโ โ โโ โ โโ โ โโ โโโผโค โ โโฌโฃ โโโซโข โโโชโก โโโดโ โโโฉโ โโโจโ โโโงโ โโโโโโโโโโโโโโโโโโโโโ โ โโโโโ Some Text โโ โ โโโฆโโ in the box โโ โโโคโโโฉโโโคโโโโโโโโโโโโกโ โ โโโโฌโโโค โโ โ โโโโดโโโ โโ โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
See alsoEdit
Wikimedia Commons has media related to Text mode box drawing. |
ReferencesEdit
- ^ Box Drawing U+2500-U+257F, The Unicode Standard Code Charts
- ^ a b Hewlett-Packard - Technical Reference Manual - Portable PLUS (1 ed.). Corvallis, OR, USA: Hewlett-Packard Company, Portable Computer Division. August 1985. 45559-90001. Retrieved 2016-11-27.
- ^ a b Hewlett-Packard - Technical Reference Manual - Portable PLUS (PDF) (2 ed.). Portable Computer Division, Corvallis, OR, USA: Hewlett-Packard Company. December 1986 [August 1985]. 45559-90006. Archived (PDF) from the original on 2016-11-28. Retrieved 2016-11-27.
- ^ Broadcast Teletext Specification, September 1976 (as HTML or scans of original document)
- ^ a b "Appendix II: CP/M Plus character sets / II.1 The complete character set (Language 0)". Spectrum +3 CP/M Plus manual (User Manual). Archived from the original on 2009-10-15. Retrieved 2017-07-10. [1]
- ^ Elliott, John C. (2015-04-04). "Amstrad Extended BIOS Internals". Seasip.info. Archived from the original on 2017-07-15. Retrieved 2017-07-15.
- ^ "Amstrad CP/M Plus character set". Archived from the original on 2017-07-15. Retrieved 2017-07-15.
- ^ Wiels. "TeleText - Het Protocol" (in Dutch). Mosaic characters. Archived from the original on 2017-12-22. Retrieved 2017-12-21.
- ^ "Symbols for Legacy Computing" (PDF). Unicode Consortium. Retrieved 2020-04-19.