Browse Prior Art Database

Visual Compression For Long Lines Of Source Code Disclosure Number: IPCOM000181420D
Original Publication Date: 2009-Apr-01
Included in the Prior Art Database: 2009-Apr-01
Document File: 5 page(s) / 124K

Publishing Venue



A mechanism for displaying computer source code in a more compact form, whilst maintaining readability and significance conveyed by indentation, is disclosed. The technique of narrowing the width of characters used to display the code is described, and two methods presented for applying this narrowing technique to increase the quantity of code visible in a fixed screen area.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 5

Visual Compression For Long Lines Of Source Code

When viewing source code, indentation is often used to make the code easier for a human to parse. For example, within a loop or control structure, contents are typically shifted by one level of indentation. In order for the amount of indentation to be readily identifiable, code is typically displayed using a fixed width font so that all characters, including whitespace, are equal in width.

    Computer displays have a limited resolution, and a sufficiently long line of code may not be entirely visible at once. Using a technique such as 'word-wrap' found in a text editor typically does not give the desired result, since the appropriate level of indentation for the wrapped parts of a line depends on context. As a result, long lines of code can be difficult to read. Modern programming methodologies (which promote the use of more descriptive, and hence longer, identifiers and keywords) are more likely to encounter this problem.

    One solution to this problem is for the author to manually insert line breaks to split up long lines, inserting indentation appropriately to aid the reader (typically guided by a set of coding standards). Some code editors (such as that found within the Eclipse workbench) offer a 'code format' feature, which can be configured to insert line breaks and indentation into the code using rules based on the programming language. This action must be performed manually after editing the code.

    Rather than inserting line breaks into long lines, this mechanism attempts to overcome the limitations of the width of the display screen by selectively 'narrowing' the text. Consider narrowing in this context to be shrinking the width of a character whilst leaving the height unchanged. In order to narrow a character from its original width, a stretching transformation must be applied - techniques such as antialiasing are recommended to improve the clarity of the resulting characters after transformation.

    Two methods for exploiting this narrowing process when displaying code are as follows:
1) Render every character progressively thinner towards the end of the line, until either the entire line is visible, or characters have become too narrow. A number of parameters can control the process:

- the of...