Printing

Printing is fully supported within the Symbian text model. It requires that documents be paginated, so that the page for each element of the document may be identified. A page region printer for printing multi-page documents is required. Then, there are various editing and preview requirements.

Printing

The print system specifies a page region printer interface using the MPageRegionPrinter class. Text views provides CTextPageRegionPrinter which implements this interface. This allows a large text object to be printed essentially by specifying a print setup and requesting the CTextPageRegionPrinter to start printing.

Pagination

Printing a large document requires that it be split into pages. It is also necessary to be able to identify the pagination of a document for other purposes — for example, so that the user can know which page he or she is working on while editing the document, and so that fields containing page numbers can be maintained while editing.

On the other hand, pagination is an expensive operation requiring that the entire document be laid out so that line heights and line breaks can be determined, and the document position associated with each page break can be determined.

The CTextPaginator class is an active object which, acting like a separate non-pre-emptive thread of execution, performs pagination incrementally, without noticeably interrupting the process of handling user input. This class allows a document's pagination to be maintained roughly during periods of intense user activity, and then for the system to catch up when the user activity slows down or stops.

Selective printing

Text objects are used in contexts where pagination is inappropriate. For instance, each cell in a spreadsheet may contain a text object. In this case, pagination is controlled by the application program, but text views may be used to determine the size of each object, and to draw each object during banded printing.

WYSIWYG mode

As well as screen layout and printer layout, CTextLayout supports a WYSIWYG layout mode so that the final appearance of the document on the printer can be judged in advance, even while editing.

In screen layout mode, font specifications in the text object are mapped onto their nearest available screen font, and this screen font is used for both layout and display purposes.

In printer layout mode, font specifications in the text object are mapped onto their nearest available font from the selected print setup, and this font is used for layout and display. For this purpose, printer drivers supply font metrics to be used by applications such as text layout. But they do not need to supply font bitmaps or outlines, since these are needed only by the printer.

WYSIWYG mode is in between these two. Font specifications in the document are used to select the font metrics from the print setup, but a font from the screen’s font store. The printer font metrics are used to lay out the document, and the screen font is used to draw the view on the screen. This provides fully accurate layout while editing the document. The cost is slightly higher overheads for formatting, and some degradation in the aesthetic quality of the view — but the WYSIWYG mode has been carefully designed to optimize aesthetics, within the context of the WYSIWYG requirements.

Print preview

Finally, text layout supports a printer preview display. This also uses printer metrics but, since on the one hand a print preview displays many pages and is therefore potentially expensive on memory, and on the other hand not all the features of a document can be seen anyway in print preview mode, the print preview mode takes steps to reduce unnecessary memory overhead from layout.