Chapter 19: Advanced Text
19.4. Upper and lower case letters

In most European languages the same letters can appear in two forms: as capitals, like "X", mainly used to mark a name or the start of a sentence; or in their ordinary less prominent form, like "x". These forms are called upper and lower case because, historically, typesetters kept lead castings of letters in two wooden cases, one above the other on the workbench. Lower case letters were in the lower box closer to hand, being more often needed.

Human languages are complicated. Not every lower case letter has an upper case partner: ordinal markers in Hispanic languages don't, for instance, and the German "ß" is never used in upper case. Sometimes two different lower case letters have the same upper case form: "ς" and "σ", two versions of the Greek sigma, both capitalise to "Σ". Inform follows the international Unicode standard in coping with all this.

We can test whether text is in either case like so:

if WHATEVER is in lower case
if WHATEVER is in upper case

To pass, every character in WHATEVER must be a lower (or upper) case letter: so "marbles" is in lower case, but "marble alley" is not - the space is not a letter. (The empty text is in both lower and upper case.) And we can change the casing of text using:

WHATEVER in lower case
WHATEVER in upper case
WHATEVER in sentence case
WHATEVER in title case

Sentence case and title case make sense only for texts longer than a single letter. Sentence case capitalises the first letter of each sentence and reduces the rest to lower case; title case capitalises the first letter of each word, and lowers the rest. For instance, if X is "a ticket to Tromsø via Østfold":

lower case: a ticket to tromsø via østfold
upper case: A TICKET TO TROMSØ VIA ØSTFOLD
title case: A Ticket To Tromsø Via Østfold
sentence case: A ticket to tromsø via østfold

Accents are preserved in case changes. So (if we are using Glulx and have Unicode available) title case can turn Aristophanes' discomfortingly lower-case lines

ἐξ οὗ γὰρ ἡμᾶς προὔδοσαν μιλήσιοι,
οὐκ εἶδον οὐδ᾽ ὄλισβον ὀκτωδάκτυλον,
ὃς ἦν ἂν ἡμῖν σκυτίνη "πικουρία

by raising them proudly up like so:

Ἐξ Οὗ Γὰρ Ἡμᾶς Προὔδοσαν Μιλήσιοι,
Οὐκ Εἶδον Οὐδ᾽ Ὄλισβον Ὀκτωδάκτυλον,
Ὃς Ἦν Ἂν Ἡμῖν Σκυτίνη "Πικουρία.

Title and sentence casing can only be approximate if done by computer. Inform looks at the letters, but is blind to the words and sentences they make up. (Note the way sentence casing did not realise "Tromsø" and "Østfold" were proper nouns.) If asked to put the name "MCKAY" into title casing, Inform will opt for "Mckay", not recognising this as the Scottish patronymic surname "McKay". Given "baym dnieper", the title of David Bergelson's great Yiddish novel of 1932, it will opt for "BAYM DNIEPER": but properly speaking Yiddish does not have upper case lettering at all, though nowadays it is sometimes printed as if it did. And conventions are very variable about which words should be capitalised in titles: English publishers mostly agree that connectives, articles and prepositions should be in lower case, but in France almost anything goes, with Academie Française rules giving way to avant-garde book design. In short, we cannot rely on Inform's title casing to produce a result which a human reader will always think perfect.

One more caution, though it will affect hardly anyone. For projects using the Z-machine, only a restricted character set is available in indexed texts: for more, we must use Glulx. A mad anomaly of ZSCII, the Z-machine character set, is that it contains the lower case letter "ÿ" but not its upper case form "Ÿ", so that

"ÿ" in upper case

produces "Ÿ" in Glulx but "ÿ" in the Z-machine. This will come as a blow to Queensrÿche fans, but in all other respects any result on the Z-machine should agree with its counterpart on Glulx.


358
* Example  Rocket Man
Using case changes on any text produced by a "to say..." phrase.

RB

We can now change the case of any text produced by a "to say..." phrase. This is often useful when we would like to make use of a standard say phrase in some new context. Say, for instance, that we would like to "[is-are the list...]" in a context that needs the first letter to be capitalized.

We could write a new say phrase, such as "to say is-are the list of (N - a description) in sentence capitalization"; but there is an easier way, and that is to set an indexed text variable to the output of the to say phrase, and then print that indexed text in the case of our choice.

For example:

"Rocket Man"

Instead of going somewhere from the spaceport when the player carries something:
    let N be "[is-are the list of things carried by the player] really suitable gear to take to the moon?" in sentence case;
    say "[N][paragraph break]";

The Spaceport is a room. North of the Spaceport is the Rocket Launch Pad. The player carries a stuffed bear, a chocolate cookie, and a book.

The description of the book is "It is entitled [italic type]Why Not To Take [sentence cased inventory] To The Moon[roman type]."

To say sentence cased inventory:
    let N be "[a list of things carried by the player]" in title case;
    say "[N]".

Test me with "n / x book".

359
* Example  Capital City
To arrange that the location information normally given on the left-hand side of the status line appears in block capitals.

RB


PreviousContentsNext