Characters per line

Last updated

In typography and computing, characters per line (CPL) or terminal width refers to the maximal number of monospaced characters that may appear on a single line. It is similar to line length in typesetting.

Contents

History

The ruler on the carriage of an Olivetti Lettera 22. This typewriter can print only 87 characters in a line Particolare Olivetti Lettera 22.JPG
The ruler on the carriage of an Olivetti Lettera 22. This typewriter can print only 87 characters in a line

The limit of the line length in 70–80 characters may well have originated from various technical limitations of various equipment. The American teletypewriters could type only 72 CPL, while the British ones even less, 70 CPL. [1] In the era of typewriters, most designs of the typewriter carriage were limited to 80–90 CPL. Standard paper sizes, such as the international standard A4, also impose limitations on line length: using the US standard Letter paper size (8.5×11"), it is only possible to print a maximum of 85 or 102 characters (with the font size either 10 or 12 characters per inch) without margins on the typewriter. With various margins – usually from 1–1.5 inches (25–38 mm) for each side, but there is no strict standard – these numbers may shrink to 55–78 CPL.

Typometer with the characters per line scales Typometer 3.jpg
Typometer with the characters per line scales
A Fortran coding form (paper). Source code has 72 CPL, but a form is 80-characters wide. Last 8 positions are "identification sequence" FortranCodingForm.png
A Fortran coding form (paper). Source code has 72 CPL, but a form is 80-characters wide. Last 8 positions are "identification sequence"

In computer technology, a line of an IBM punched card consisted of 80 characters. Widespread computer terminals such as DEC's VT52 and VT100 mostly followed this standard, showing 80 CPL and 24 lines. This line length was carried over into the original 80×25 text mode of the IBM PC, along with its clones and successors. To this day, virtual terminals most often display 80×24 characters.

The "long" line of 132 CPL comes from mainframes' line printers. [2] [3] [4] However, some printers or printing terminals could print as many as 216 CPL, given certain extra-wide paper sizes and/or extra-narrow font sizes. [5]

In modern computing

With the advent of desktop computing and publishing, and technologies such as TrueType used in word processing and web browsing, a uniform CPL has been made mostly obsolete. HTML (and some other modern text presentation formats) uses dynamic word wrapping which is more flexible than characters per line restriction and may produce a text block with non-rectangular shape, just like in paper typesetting.

Many plain text documents still conform to 72 CPL out of tradition (e.g., RFC   678).

In programming

Many style guides for computer programming define the maximum or desirable number of characters in a line of source code:

Characters per lineProgramming style
72 Ada [6]

Agda [7]

79 Python [8] [9]
80
88Python, The Black code style [24]
90 CCM4 [25]
100 Android [26]

Common Lisp [27] [28]

Google Java [29]

Rust (rustfmt default) [30]

102 Racket [31]
120 PHP [21]
132 Fortran [32] (until 2023) [33]

Blink [34]

Moodle [35]

140 Puppet [36]
180 Mono [37]
undefined Go [38]

JavaScript (JavaScript has no official style guide)

With the increasing common use of larger widescreen monitors, some of these limits have been relaxed, as in the Linux kernel [39] and FreeBSD. [40]

See also

Related Research Articles

<span class="mw-page-title-main">ASCII art</span> Computer art form using text characters

ASCII art is a graphic design technique that uses computers for presentation and consists of pictures pieced together from the 95 printable characters defined by the ASCII Standard from 1963 and ASCII compliant character sets with proprietary extended characters. The term is also loosely used to refer to text-based visual art in general. ASCII art can be created with any text editor, and is often used with free-form languages. Most examples of ASCII art require a fixed-width font such as Courier for presentation.

<span class="mw-page-title-main">IBM 3270</span> Family of block-oriented display terminals and printers made by IBM

The IBM 3270 is a family of block oriented display and printer computer terminals introduced by IBM in 1971 and normally used to communicate with IBM mainframes. The 3270 was the successor to the IBM 2260 display terminal. Due to the text color on the original models, these terminals are informally known as green screen terminals. Unlike a character-oriented terminal, the 3270 minimizes the number of I/O interrupts required by transferring large blocks of data known as data streams, and uses a high speed proprietary communications interface, using coaxial cable.

<span class="mw-page-title-main">Dot matrix printing</span> Computer printing process

Dot matrix printing, sometimes called impact matrix printing, is a computer printing process in which ink is applied to a surface using a relatively low-resolution dot matrix for layout. Dot matrix printers are a type of impact printer that prints using a fixed number of pins or wires and typically use a print head that moves back and forth or in an up-and-down motion on the page and prints by impact, striking an ink-soaked cloth ribbon against the paper. They were also known as serial dot matrix printers. Unlike typewriters or line printers that use a similar print mechanism, a dot matrix printer can print arbitrary patterns and not just specific characters.

<span class="mw-page-title-main">Monospaced font</span> Font whose characters occupy the same amount of horizontal space

A monospaced font, also called a fixed-pitch, fixed-width, or non-proportional font, is a font whose letters and characters each occupy the same amount of horizontal space. This contrasts with variable-width fonts, where the letters and spacings have different widths.

<span class="mw-page-title-main">Control key</span> Key on computer keyboards

In computing, a Control keyCtrl is a modifier key which, when pressed in conjunction with another key, performs a special operation. Similarly to the Shift key, the Control key rarely performs any function when pressed by itself. The Control key is located on or near the bottom left side of most keyboards, with many featuring an additional one at the bottom right.

<span class="mw-page-title-main">Newline</span> Special characters in computing signifying the end of a line of text

A newline is a control character or sequence of control characters in character encoding specifications such as ASCII, EBCDIC, Unicode, etc. This character, or a sequence of characters, is used to signify the end of a line of text and the start of a new one.

<span class="mw-page-title-main">Computer terminal</span> Computer input/output device for users

A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. Most early computers only had a front panel to input or display bits and had to be connected to a terminal to print or input text through a keyboard. Teleprinters were used as early-day hard-copy terminals and predated the use of a computer screen by decades. The computer would typically transmit a line of data which would be printed on paper, and accept a line of data from a keyboard over a serial or other interface. Starting in the mid-1970s with microcomputers such as the Sphere 1, Sol-20, and Apple I, display circuitry and keyboards began to be integrated into personal and workstation computer systems, with the computer handling character generation and outputting to a CRT display such as a computer monitor or, sometimes, a consumer TV, but most larger computers continued to require terminals.

In computer programming, indentation style is a convention, a.k.a. style, governing the indentation of blocks of source code. An indentation style generally involves consistent width of whitespace before each line of a block, so that the lines of code appear to be related, and dictates whether to use space or tab characters for the indentation whitespace.

<span class="mw-page-title-main">Courier (typeface)</span> Monospaced slab serif font by IBM

Courier is a monospaced slab serif typeface commissioned by IBM and designed by Howard "Bud" Kettler (1919–1999) in the mid-1950s. The Courier name and typeface concept are in the public domain. Courier has been adapted for use as a computer font, and versions of it are installed on most desktop computers.

Text mode is a computer display mode in which content is internally represented on a computer screen in terms of characters rather than individual pixels. Typically, the screen consists of a uniform rectangular grid of character cells, each of which contains one of the characters of a character set; at the same time, contrasted to graphics mode or other kinds of computer graphics modes.

<span class="mw-page-title-main">IBM System/3</span> IBM midrange computer (1969–1985)

The IBM System/3 was an IBM midrange computer introduced in 1969, and marketed until 1985. It was produced by IBM Rochester in Minnesota as a low-end business computer aimed at smaller organizations that still used IBM 1400 series computers or unit record equipment. The first member of what IBM refers to as their "midrange" line, it also introduced the RPG II programming language. It is the first ancestor in the product line whose current version is the IBM i series and includes the highly successful AS/400.

<span class="mw-page-title-main">Backspace</span> Key on a keyboard

Backspace is the keyboard key that in typewriters originally pushed the carriage one position backwards, and in modern computer systems typically moves the display cursor one position backwards, deletes the character at that position, and shifts back any text after that position by one character.

<span class="mw-page-title-main">Code page 437</span> Character set of the original IBM PC

Code page 437 is the character set of the original IBM PC. It is also known as CP437, OEM-US, OEM 437, PC-8, or DOS Latin US. The set includes all printable ASCII characters as well as some accented letters (diacritics), Greek letters, icons, and line-drawing symbols. It is sometimes referred to as the "OEM font" or "high ASCII", or as "extended ASCII".

A bell character is a device control code originally sent to ring a small electromechanical bell on tickers and other teleprinters and teletypewriters to alert operators at the other end of the line, often of an incoming message. Though tickers punched the bell codes into their tapes, printers generally do not print a character when the bell code is received. Bell codes are usually represented by the label "BEL". They have been used since 1870.

<span class="mw-page-title-main">Slashed zero</span> Glyph variant of numeral 0 (zero) with slash

The dotted or slashed zero 0̷ is a representation of the Arabic digit "0" (zero) with a slash or a dot through it. This variant zero glyph is often used to distinguish the digit "zero" ("0") from the Latin script letter "O" anywhere that the distinction needs emphasis, particularly in encoding systems, scientific and engineering applications, computer programming, and telecommunications. It thus helps to differentiate characters that would otherwise be homoglyphs. It was commonly used during the punch card era, when programs were typically written out by hand, to avoid ambiguity when the character was later typed on a card punch.

<span class="mw-page-title-main">IBM 2741</span>

The IBM 2741 is a printing computer terminal that was introduced in 1965. Compared to the teletypewriter machines that were commonly used as printing terminals at the time, the 2741 offers 50% higher speed, much higher quality printing, quieter operation, interchangeable type fonts, and both upper and lower case letters.

<span class="mw-page-title-main">IBM Selectric</span> Line of electric typewriters by IBM

The IBM Selectric was a highly successful line of electric typewriters introduced by IBM on 31 July 1961.

<span class="mw-page-title-main">Linux console</span> Console of the Linux kernel

The Linux console is a system console internal to the Linux kernel. A system console is the device which receives all kernel messages and warnings and which allows logins in single user mode. The Linux console provides a way for the kernel and other processes to send text output to the user, and to receive text input from the user. The user typically enters text with a computer keyboard and reads the output text on a computer monitor. The Linux kernel supports virtual consoles – consoles that are logically separate, but which access the same physical keyboard and display. The Linux console are implemented by the VT subsystem of the Linux kernel, and do not rely on any user space software. This is in contrast to a terminal emulator, which is a user space process that emulates a terminal, and is typically used in a graphical display environment.

<span class="mw-page-title-main">VGA text mode</span> Computer graphics standard from 1987

VGA text mode was introduced in 1987 by IBM as part of the VGA standard for its IBM PS/2 computers. Its use on IBM PC compatibles was widespread through the 1990s and persists today for some applications on modern computers. The main features of VGA text mode are colored characters and their background, blinking, various shapes of the cursor, and loadable fonts. The Linux console traditionally uses hardware VGA text modes, and the Win32 console environment has an ability to switch the screen to text mode for some text window sizes.

Pitch is the number of (monospaced) letters, numbers and spaces in one inch (25.4 mm) of running text, that is, characters per inch, measured horizontally. The pitch was most often used as a measurement of the size of typewriter fonts as well as those of impact printers used with computers.

References

  1. Department of the Army, ed. (1947). Teletypewriter Circuits and Equipment (fundamentals). Washington: US Government Printing Office. p. 69.
  2. Pomerantz, Ori; Vander Weele, Barbara; Nelson, Mark; et al., eds. (2008). Mainframe Basics for Security Professionals. IBM Press. ISBN   9780132704342.
  3. Wells, April J. (2003). Oracle 11i E-Business Suite from the Front Lines. CRC Press. p. 168. ISBN   9780203508961.
  4. "Difference between..LRECL = 133 and LRECL = 132". IBMMAINFRAMES.com - IBM Mainframe Support Forums. 2004.
  5. "Appendix K. Traditional Terminals and Printers". Terminals & Printers Handbook 1983–84. Digital. 1983.
  6. Ada 95 Quality and Style Guide
  7. agda/agda-stdlib: Style guide for the standard library
  8. PEP 8 Style Guide for Python Code
  9. Style Guide for Python Code
  10. GCC Coding Conventions
  11. Google C++ Style Guide
  12. Chromium Objective-C and Objective-C++ style guide
  13. Google Python Style Guide
  14. Google's R Style Guide
  15. Google JavaScript Style Guide
  16. "4.1. Line length". Java Code Conventions (PDF). Sun Microsystems, Inc. 1997. p. 5.
  17. "Linux kernel code style as of June 2020". git.kernel.org. Archived from the original on 2020-05-31. Retrieved 2020-06-13.
  18. "Object Pascal Style Guide". Archived from the original on 2015-07-09. Retrieved 2018-03-14.
  19. "style(9) - OpenBSD manual pages". Archived from the original on 2016-05-24. Retrieved 2024-03-04. All code should fit in 80 columns.
  20. Conway, Damian (2005). Perl Best Practices: Standards and Styles for Developing Maintainable Code. O'Reilly. p. 40. ISBN   978-0-596-55502-3.
  21. 1 2 PSR-2: Coding Style Guide
  22. The Ruby Style Guide
  23. OCaml Programming Guidelines
  24. "The Black code style - Black (stable) documentation". black.readthedocs.io. Retrieved 2024-06-28.
  25. CCM4 self-imposed limit
  26. Android Code Style Guidelines for Contributors
  27. Common Lisp Style Guide
  28. Google Common Lisp Style Guide
  29. Google Java Style
  30. rustfmt Documentation
  31. How to Program Racket: a Style Guide
  32. FORTRAN 90
  33. Reid, John (2022-03-21), The new features of Fortran 202x (PDF)
  34. Blink Coding Style Guidelines
  35. Moodle Coding Style
  36. Leach, Parker. "The Puppet language style guide". puppet.com. Retrieved 2024-06-28.
  37. Mono Coding Guidelines
  38. Effective Go
  39. "The Linux Kernel Deprecates The 80 Character Line Coding Style". www.phoronix.com. Retrieved 2024-05-31.
  40. "⚙ D30255 style: Relax 80 column rule". reviews.freebsd.org. Retrieved 2024-05-31.