Chapter 5: Text
5.8. Text with type styles

Inform does not go in for the use of fonts: a work of IF will be rendered with different fonts on different machines anyway, from tiny personal organisers up to huge LCD panelled workstations. However, it does allow for a modest amount of styling. The substitution "[bold type]" switches to bold face; "[italic type]" to italic; and "[roman type]" back to plain roman. Thus

"This is [italic type]very suspicious[roman type], said Peter."

will (on most computers) be rendered as

This is very suspicious, said Peter.

Less is more with such devices, but there is one other effect we can employ: we can go into "[fixed letter spacing]" for a while, then return to "[variable letter spacing]", which is the normal condition. In variable letter spacing, a lower case "m" is much wider than an "l", which is natural to the eye since it has been printing practice since the Renaissance. Fixed letter spacing is more like typewriting, and it is best used to reproduce typewritten text or printed notices; it can also be convenient for making simple diagrams.

We should be careful to ensure that we return to the status quo ante (roman type and variable letter spacing) after any specially-treated text has been printed.


64
* Example  Garibaldi 2
Adding coloured text to the example of door-status readouts.

RB

The extension "Basic Screen Effects" provides a few more type styles, in the form of coloured lettering. The colours available are red, yellow, green, blue, white, magenta, and cyan, as well as the usual black; and to restore the player's default screen colour, we say "default letters".

Thus if we wanted to highlight locked and unlocked doors in our security readout example:

"Garibaldi"

Include Basic Screen Effects by Emily Short.

The security readout is a device. The description of the readout is "The screen is blank."

Instead of examining the switched on security readout:
    say "The screen reads: [fixed letter spacing]";
    say line break;
    repeat with item running through doors
    begin;
        say line break;
        say " [item] ([front side of the item]/[back side of the item]): [if the item is locked][green letters]LOCKED[default letters][otherwise][red letters]UNLOCKED[default letters][end if]";
    end repeat;
    say variable letter spacing;
    say paragraph break.

The player carries the security readout.

The Docking Bay is a room. The inner airlock is a door. It is north of the Docking Bay and south of the Zocalo. The inner airlock is lockable and unlocked. The outer airlock is lockable and locked. It is a door. It is south of the Docking Bay and north of Space.

The quarantine seal is a door. It is west of the Zocalo and east of Medlab. Quarantine seal is locked.

The security pass unlocks the inner airlock. The player carries the security pass.

Test me with "x readout / turn on readout / x readout / lock inner airlock with security pass / x readout".

Note that this extension does not currently produce the desired effects when compiling with the Glulx setting; to see it working, make sure that the settings tab is set to compile to z5 or z8.


PreviousContentsNext