Characters per line

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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.

History[edit]

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 be 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. The most widespread and standard paper size in the US (8.5×11") also has been imposing limitations on the line length: it is possible to print only 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 to 1.5 inches for each side, but there is no strict standard) these numbers may shrink to 55–78 CPL.

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"

In computer technology, a line of an IBM punched card could consist of only 80 characters. The widespread computer terminals such as IBM 3270 followed this limitation, their monitors could show only 80 CPL (but with the various number of lines), though with some terminals this number was either reduced by half to 40 CPL, limited to 64 CPL (SWTP CT-64, with 16 lines[2]), or optionally increased to 132 CPL (DEC VT100 family, with 14 lines[3]). Such line lengths have been carried over into text modes of personal computers.

The "long" line of 132 CPL comes from line printers of mainframes.[4][5][6] 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.[7]

In modern computing[edit]

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.

RFC 2046                      Media Types                  November 1996
   A. Collected Grammar ....................................   43
1.  Introduction
   The first document in this set, RFC 2045, defines a number of header
   fields, including Content-Type. The Content-Type field is used to
   specify the nature of the data in the body of a MIME entity, by
   giving media type and subtype identifiers, and by providing auxiliary
   information that may be required for certain media types.  After the
RFC 2046, which defines the text/plain MIME type, is itself a 72 CPL plain text. Top of page 3

In programming[edit]

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

Characters per line Programming style
72 Ada[8]
79 Python[9][10]
80
90 CCM4[23]
99 Python[9][10]
100 Android[24]

Google Java[25]

Common Lisp[26][27]

120 PHP[22]
132 Fortran[28]

Blink[29]

Moodle[30]

180 Mono[31]
undefined Go[32]

See also[edit]

References[edit]

  1. ^ Department of the Army, ed. (1947). Teletypewriter Circuits and Equipment (fundamentals). Washington: US Government Printing Office. p. 69. 
  2. ^ CT-64
  3. ^ VT100
  4. ^ Pomerantz, Ori; Vander Weele, Barbara; Nelson, Mark; et al., eds. (2008). Mainframe Basics for Security Professionals. 
  5. ^ Wells, April J. (2003). Oracle 11i E-Business Suite from the Front Lines. p. 168. 
  6. ^ "Difference between..LRECL = 133 and LRECL = 132". IBMMAINFRAMES.com - IBM Mainframe Support Forums. 2004. 
  7. ^ "Appendix K. Traditional Terminals and Printers". Terminals & Printers Handbook 1983–84. Digital. 1983. 
  8. ^ Ada 95 Quality and Style Guide
  9. ^ a b PEP 8 Style Guide for Python Code
  10. ^ a b Style Guide for Python Code
  11. ^ GCC Coding Conventions
  12. ^ Google C++ Style Guide
  13. ^ Chromium Objective-C and Objective-C++ style guide
  14. ^ Google Python Style Guide
  15. ^ Google's R Style Guide
  16. ^ "4.1. Line length". Java Code Conventions (PDF). Sun Microsystems, Inc. 1997. p. 5. 
  17. ^ JavaScript Style Guide and Coding Conventions
  18. ^ Linux kernel coding style
  19. ^ Mozilla Coding style
  20. ^ Object Pascal Style Guide
  21. ^ Conway, Damian (2005). Perl Best Practices: Standards and Styles for Developing Maintainable Code. O'Reilly. p. 40. ISBN 978-0-596-55502-3. 
  22. ^ a b PSR-2: Coding Style Guide
  23. ^ CCM4 self-imposed limit
  24. ^ Android Code Style Guidelines for Contributors
  25. ^ Google Java Style
  26. ^ Common Lisp Style Guide
  27. ^ Google Common Lisp Style Guide
  28. ^ FORTRAN 90
  29. ^ Blink Coding Style Guidelines
  30. ^ Moodle Coding Style
  31. ^ Mono Coding Guidelines
  32. ^ Effective Go