GNUvola
Emacs Lisp · Typography

When a plus sign becomes a corner

An annotated reading of ascii-art-to-unicode, the small Emacs tool that gives a text diagram a more precise set of lines.

Software distributionascii-art-to-unicode 1.13 · ELPA packageThe package archive contains the editor extension and its documentation.

One character, several jobs

Draw a small rectangle with a keyboard. A plus sign at the top left indicates a corner. Put the same sign where a horizontal rule passes through a vertical one and it means a crossing. A reader infers the intended shape from the neighbours. A converter has to inspect them before it can choose a glyph.

In ascii-art-to-unicode the command called aa2u works on a selected or accessible region. A rectangle-specific command lets the author limit an edit to a block of columns. The selection matters when the drawing shares a buffer with notes, arithmetic or shell examples. In a label such as “A+B”, the middle mark belongs to a word-like expression and should stay put.

A corner and a junction, enlarged
┌  corner     ┬  branch     ┼  crossing

Preparing a drawing

First view the diagram in a fixed-width font. Check two neighbouring lines that look as if they share a column. If one contains a tab, a different tab setting can make their edges appear to slip. The package documentation recommends expanding tabs before conversion. Then choose a region that contains the whole corner, including the adjoining lines.

The author also provided commands to protect parts of a drawing as text. That is useful for a caption embedded inside a frame. After conversion, inspect junctions before changing line weight. A heavy rule can make a diagram easier to read at small sizes, but it cannot repair a missing connection. Retain the original text if another program needs the ASCII version as input.

Following the package record

The archived GNUvola page dates the first mailing-list post to April 2012. GNU ELPA’s history records the move to this homepage in the notes for version 1.9. Compare the two pages when dating an example. One marks the author’s first public description and the other identifies a release in the package archive.

Sources and further reading