Inform 7 Home Page / Documentation
§5.9. 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 workstations. However, it does allow for a modest amount of styling.
say "[bold type]"
This text substitution produces no text. It's used only for a side-effect: to make the text following it appear in bold face. "[roman type]" should be used to switch back to normal. Example:
"Jane looked down. [bold type]Danger[roman type], the sign read."
say "[italic type]"
This text substitution produces no text. It's used only for a side-effect: to make the text following it appear in italics. "[roman type]" should be used to switch back to normal. Example:
"This is [italic type]very suspicious[roman type], said Peter."
say "[roman type]"
This text substitution produces no text. It's used only for a side-effect: to return to ordinary Roman type after a previous use of "[bold type]" or "[italic type]".
but there is one other effect we can employ:
say "[fixed letter spacing]"
This text substitution produces no text. It's used only for a side-effect: to make the text following it appear with fixed letter spacing. In variable letter spacing, a lower case "m" is much wider than an "l", which is natural to the ey 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. Example:
"On the door is written: [fixed letter spacing]J45--O-O-O[variable letter spacing]."
say "[variable letter spacing]"
This text substitution produces no text. It's used only for a side-effect: to return to ordinary letter spacing after a previous use of "[fixed letter spacing]".
Whichever effect we use, we should be careful to ensure that we return to normal -- roman type and variable letter spacing -- after any specially-treated text has been printed. Combining these effects (for, say, bold fixed-spaced lettering) is not guaranteed to work, though on some platforms it will.
|Start of Chapter 5: Text|
|Back to §5.8. Line breaks and paragraph breaks|
|Onward to §5.10. Accented letters|
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:
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:
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]";
say variable letter spacing;
say paragraph break.
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 the Z-machine.