box-drawing characters
{{Short description|Characters for drawing frames and boxes}}
{{Hatnote|Several confusable characters redirect here. You may be looking for em dash, vertical bar, multiplication sign, slash (punctuation) or backslash.}}
{{SpecialChars}}
File:Midnight Commander screenshot.png using box-drawing characters in a terminal emulator]]
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. These characters are characterized by being designed to be connected horizontally and/or vertically with adjacent characters, which requires proper alignment. Box-drawing characters therefore typically only work well with monospaced fonts.
In graphical user interfaces, these characters are much less useful as it is simpler to draw lines and rectangles directly with graphical APIs. However, they are still useful for command-line interfaces and plaintext comments within source code.
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.
Other types of 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.
Unicode
=Box Drawing=
Unicode includes 128 such characters in the Box Drawing block. 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.
{{Unicode chart Box Drawing}}
The image below is provided as a quick reference for these symbols on systems that are unable to display them directly:
File:Unicode Box Drawings (2500 - 27FF).svg
{{clear}}
=Block Elements=
The Block Elements Unicode block includes shading characters. 32 characters are included in the block.
{{Unicode chart Block Elements}}
=Symbols for Legacy Computing=
In version 13.0, Unicode was extended with another block containing many graphics characters, Symbols for Legacy Computing, which includes a few box-drawing characters and other symbols used by obsolete operating systems (mostly from the 1980s). Few fonts support these characters (one is Noto Sans Symbols 2), but the table of symbols is provided here:
{{Unicode chart Symbols for Legacy Computing}}
The image below is provided as a quick reference for these symbols on systems that are unable to display them directly:
File:Symbols for Legacy Computing Unicode block.png
{{clear}}
=Symbols for Legacy Computing Supplement=
In version 16.0 (September 2024), Unicode was extended with another block containing many graphics characters, Symbols for Legacy Computing Supplement, which includes a few box-drawing characters and other symbols used by obsolete operating systems (mostly from the 1970s and 1980s).
{{Unicode chart Symbols for Legacy Computing Supplement}}
Platform-specific
Various different platforms defined their own unique set of box-drawing characters.
=DOS=
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 included in WGL4 and is far more popular and likely to be rendered correctly:
class="wikitable"
! !0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
B
|░||▒||▓||│||┤||╡||╢||╖||╕||╣||║||╗||╝||╜||╛||┐ |
---|
C
|└||┴||┬||├||─||┼||╞||╟||╚||╔||╩||╦||╠||═||╬||╧ |
D
|╨||╤||╥||╙||╘||╒||╓||╫||╪||┘||┌||█||▄||▌||▐||▀ |
The integral halves are also box drawing as they are used alongside 0xB3:
class="wikitable"
! !4!!5 |
F
|⌠||⌡ |
---|
Their number is further limited to 28 on those code pages that replace the 18 characters that combine single and double lines, the left and right half blocks, as well as integral halves with other, usually alphabetic, characters (such as code page 850):
class="wikitable"
! !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) characters (U+2500, U+2502), not the bold (heavy) characters (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.
class="wikitable"
!0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
8
| || || || ||╝||╗||╔||╚||╣||╩||╦||╠||═||║||╬|| |
---|
9
| ||▀||▄|| ||┘||┐||┌||└||┤||┴||┬||├||─||│||┼||█ |
=Unix, CP/M, BBS=
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:
class="wikitable"
! !!0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
6
| || || || || || || || || || ||┘||┐||┌||└||┼|| | |
---|
7
| ||─|| || ||├||┤||┴||┬||│|| || || || || || || | |
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), _{{nbsp}}(underscore), ={{nbsp}}(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.
=Teletext=
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. These characters were added to the Unicode standard in Version 13.{{Cite web|url=https://www.unicode.org/charts/PDF/Unicode-13.0/U130-1FB00.pdf|title=Symbols for Legacy Computing|website=Unicode Consortium|access-date=2020-04-19}}
=Historical=
Many microcomputers of the 1970s and 1980s had their own proprietary character sets, which also included box-drawing characters. Many of these were added to Unicode as Symbols for Legacy Computing.
==Commodore==
{{main|PETSCII}}
Commodore machines, such as the Commodore PET and the Commodore 64, included a set of text semigraphics with block elements and dithering patterns in the PETSCII character set.
File:PET Keyboard.svg keyboard layout, illustrating PETSCII graphics characters]]
{{clear}}
==Sinclair==
File:ZX81.chars.00-0A.80-8A.png
{{see also|ZX80 character set|ZX81 character set|ZX Spectrum character set}}
The Sinclair ZX80, ZX81, and ZX Spectrum included a set of text semigraphics with quadrant-based block elements. The ZX80 and ZX81 also included a set of text semigraphics with dithering patterns.
{{clear}}
==BBC and Acorn==
The BBC Micro could utilize 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.
class="wikitable"
|+ Teletext G1 Block Mosaics Set{{citation |title=Enhanced Teletext specification |url=https://www.etsi.org/deliver/etsi_i_ets/300700_300799/300706/01_60/ets_300706e01p.pdf#page=126 |publisher=European Telecommunications Standards Institute |page=126 |date=May 1997}} ! !0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
2
| NBSP | 🬀 | 🬁 | 🬂 | 🬃 | 🬄 | 🬅 | 🬆 | 🬇 | 🬈 | 🬉 | 🬊 | 🬋 | 🬌 | 🬍 | 🬎 |
---|
3
| 🬏 | 🬐 | 🬑 | 🬒 | 🬓 | ▌ | 🬔 | 🬕 | 🬖 | 🬗 | 🬘 | 🬙 | 🬚 | 🬛 | 🬜 | 🬝 |
6
| 🬞 | 🬟 | 🬠 | 🬡 | 🬢 | 🬣 | 🬤 | 🬥 | 🬦 | 🬧 | ▐ | 🬨 | 🬩 | 🬪 | 🬫 | 🬬 |
7
| 🬭 | 🬮 | 🬯 | 🬰 | 🬱 | 🬲 | 🬳 | 🬴 | 🬵 | 🬶 | 🬷 | 🬸 | 🬹 | 🬺 | 🬻 | █ |
class="wikitable"
|+ Braille Sextant Mosaics Set{{citation |title=Enhanced Teletext specification |url=https://www.etsi.org/deliver/etsi_i_ets/300700_300799/300706/01_60/ets_300706e01p.pdf#page=126 |publisher=European Telecommunications Standards Institute |page=126 |date=May 1997}}{{verification failed|date=February 2025}} ! !0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
2
| NBSP | 🬳 | 🬇 | 🬷 | 🬥 | 🬡 | 🬴 | 🬏 | 🬺 | 🬻 | 🬟 | 🬯 | 🬞 | 🬭 | 🬠 | 🬑 |
---|
3
| 🬵 | 🬃 | 🬓 | 🬋 | 🬩 | 🬢 | 🬚 | 🬹 | 🬱 | 🬖 | 🬧 | 🬦 | 🬣 | █ | 🬘 | 🬨 |
4
| 🬁 | 🬀 | 🬄 | 🬂 | 🬊 | 🬈 | 🬆 | 🬎 | 🬌 | 🬅 | 🬍 | 🬐 | ▌ | 🬒 | 🬙 | 🬗 |
5
| 🬕 | 🬝 | 🬛 | 🬔 | 🬜 | 🬮 | 🬲 | 🬫 | 🬰 | 🬸 | 🬶 | 🬤 | 🬪 | 🬬 | 🬉 | ▐ |
The BBC Master and later Acorn computers have the soft font by default defined with line drawing characters.
class="wikitable"
! !0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
A
| ||╷||╶||┌||╴||┐||─||┬||╵||│||└||├||┘||┤||┴||┼ |
---|
B
|╭||╮||╰||╯|| || || || || || || || || || || || |
==Amstrad==
The Amstrad CPC character set also has soft characters defined by default as block and line drawing characters.
class="wikitable"
! !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:
class="wikitable"
!0!!1!!2!!3!!4!!5!!6!!7!!8!!9!!A!!B!!C!!D!!E!!F |
8
| ||╧||╟||╚||╤||║||╔||╠||╢||╝||═||╩||╗||╣||╦||╬ |
---|
9
| ||╵||╶||└||╷||│||┌||├||╴||┘||─||┴||┐||┤||┬||┼ |
==Apple==
Encoding
On many platforms, the character shape is determined programmatically from the character code.
- ZX Spectrum block characters:
- : {{code|0x80 + topright*1 + topleft*2 + bottomright*4 + bottomleft*8}}
- Amstrad CPC block characters:
- : {{code|0x80 + topleft*1 + topright*2 + bottomleft*4 + bottomright*8}}
- Amstrad CPC line characters:
- : {{code|0x90 + up*1 + right*2 + down*4 + left*8}}
- BBC Master line characters:
- : {{code|0xA0 + down*1 + right*2 + left*4 + up*8}}
- Teletext block characters:
- : {{code|0xA0 + topleft*1 + topright*2 + middleleft*4 + middleright*8 + bottomleft*16 + bottomright*64}}
However, DOS line- and box-drawing characters are not ordered in any programmatic manner, so calculating a particular character shape needs to use a look-up table.
Examples
Sample diagrams made out of the standard box-drawing characters, using a monospaced font:
┌─┬┐ ╔═╦╗ ╓─╥╖ ╒═╤╕
│ ││ ║ ║║ ║ ║║ │ ││
├─┼┤ ╠═╬╣ ╟─╫╢ ╞═╪╡
└─┴┘ ╚═╩╝ ╙─╨╜ ╘═╧╛
┌───────────────────┐
│ ╔═══╗ Some Text │▒
│ ╚═╦═╝ in the box │▒
╞═╤══╩══╤═══════════╡▒
│ ├──┬──┤ │▒
│ └──┴──┘ │▒
└───────────────────┘▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
See also
{{commons category|Text mode box drawing}}
References
{{reflist|refs=
{{cite book |title=Hewlett-Packard - Technical Reference Manual - Portable PLUS |date=August 1985 |edition=1 |id=45559-90001 |publisher=Hewlett-Packard Company, Portable Computer Division |location=Corvallis, OR, USA |url=https://archive.org/details/bitsavers_hpportableblePLUSTechnicalReferenceManualAug1985_25919880 |access-date=2016-11-27 }}
{{cite book |title=Hewlett-Packard - Technical Reference Manual - Portable PLUS |date=December 1986 |orig-year=August 1985 |edition=2 |id=45559-90006 |publisher=Hewlett-Packard Company |location=Portable Computer Division, Corvallis, OR, USA |url=http://www.jeffcalc.hp41.eu/hpplus/files/techrefman.pdf |access-date=2016-11-27 |url-status=live |archive-url=https://web.archive.org/web/20161128194426/http://www.jeffcalc.hp41.eu/hpplus/files/techrefman.pdf |archive-date=2016-11-28}}
}}