Is there a cross-interpreter way to force the use of a monospace font in a block of text?
This has come up a couple of times before (here and here, for example), but none of the suggested approaches (using <tt></tt>
, <pre></pre>
, or <font face='TADS-Typewriter'></font>
) appear to work in either gargoyle or parchment. They all appear to work (with slightly different appearances) in qtads, and frob in a terminal window does it more or less for free (although I don’t know if any of the term emulators that support proportional fonts would confuse it).
My simple test case is a block of text formatted like a table of contents, where I want the lines left and right justified, with the whitespace filled by periods:
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
versionInfo: GameID;
gameMain: GameMainDef
_chapters = [ 1, 12, 123, 1234 ]
lineWidth = 40
newGame() {
local line, i, n, txt;
txt = new StringBuffer();
line = new StringBuffer();
for(i = 1; i <= _chapters.length; i++) {
n = toString(_chapters[i]);
line.append('\ \ \ \ \ Chapter \^');
line.append(spellInt(i));
while(line.length + n.length < lineWidth)
line.append('.');
line.append(n);
txt.append(line);
txt.append('\n');
line.deleteChars(1);
}
"tt:\n<tt><<toString(txt)>></tt>\n ";
"pre:\n<pre><<toString(txt)>></pre>\n ";
"font:\n<font face='TADS-Typewriter'><<toString(txt)>></font>\n ";
}
;
Compiled .t3
file : game.t3 (1.2 MB)
Output from frob, which illustrates the formatting I’d expect:
tt:
Chapter One......................1
Chapter Two.....................12
Chapter Three..................123
Chapter Four..................1234
pre:
Chapter One......................1
Chapter Two.....................12
Chapter Three..................123
Chapter Four..................1234
font:
Chapter One......................1
Chapter Two.....................12
Chapter Three..................123
Chapter Four..................1234
Cropped screenshot of chrome displaying the same text in parchment (whichever version was current in the git repo earlier today):