A word processor is a complicated creature of many layers and pieces, but it represents a relatively simple concept: a piece of paper with writing on it. This leads to the problem of having many abstractions without enough intuitive names to describe those abstractions. Not everything can be a document. The solution to this sort of problem is usually finding powerful metaphors that make life easier.
Here are some of the abstractions for a document that need intuitive names:
- The data structure that breaks up plain text into meaningful pieces such as chapters, sections, headings, and various kinds of emphasis. This is the most abstract document because it avoids all rendering information like fonts, colors, underlines, or alignments.
- The data structure that provides text with rendering information such as fonts, colors, sizes, alignments. This also represents a document, but at a level that is closer to the printed page. It probably uses an instance of the first kind of document to help generate the content.
- The data structure that arranges glyphs into lines of text. This document can be given the number of a desired paragraph, a position within that paragraph, and a maximum width in pixels, and it produces a data structure that represents a line of text ready to draw. It makes sense to base this document abstraction upon an instance of the previous document abstraction because they both represent documents at different stages in the rendering process.
- The final data structure stores lines of text in their relative positions on the screen or page. It is capable of drawing an entire screen of text, inserting figures, and making columns. It knows which part of the document is currently visible, handles scrolling or dividing the document into pages for printing. This document abstraction is the very closest to the paper, but does that make it most worthy to be called document, or is the most abstract layer the true document since it is what the user is truly editing?
All four concepts are documents in their own way, but I can't call them all documents; that would be confusing. What is the proper metaphor to use here? Something that intuitively reflects the complexity of the task better than a document?
On top of all that, there are three different ways to represent a position within a paragraph.
- Measured in characters from the start of the paragraph
- Measured as a line number starting from the first line of the paragraph and then measured in characters from the start of the line
- Measured in pixels as the paragraph is rendered on the screen
These three representations are all positions, but things become confusing if I call them all positions. I need a simple way to distinguish them, something that fits well with the improved metaphor that I'll use to distinguish the four kinds of document.
I have looked into typography in search of good metaphors, but nothing jumps out at me.
I have also considered a metaphor from constructing a building. The first kind of document could be a Blueprint, the second kind could be a Foundation. Unfortunately #3 and #4 aren't clear, and it doesn't seem to help with the issue of paragraph positions.