Portable way to force use of monospaced font in TADS3/adv3?

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):
parch

2 Likes

I keep hearing from the Parchment/Gargoyle team(s) that support for more TADS markup (beyond just bold and italics) is still on the way.

I’m guessing that even if these interpreters can render monospaced text for other systems, it probably is unable to read TADS files in a way that would let it use that functionality for our games, at least for now.

Same thing with centering.

On the assumption that this will be solved in the future, I’m designing my games to at least be accessible to non-QTADS terps, and assuming that one day Parchment and Gargoyle will render everything correctly.

1 Like

Aaaah, that’s right. Support for T3 in emglken/parchment is just a couple years old. So talk of solutions in a thread from June 2020 doesn’t work for parchment because parchment wasn’t even running T3 games at that point.

I was sitting here wondering if it was something I was doing wrong or if something had changed or something like that.

1 Like

Could you specify monospace in the old non-HTML/Multimedia TADS 2? If so, then it’s probably not too difficult to add support. If not, then we’d need to add support for HTML TADS first. (Note, HTML TADS is about programming the formatting using HTML, it does not require HTML to then interpret the games.)

1 Like

(Man, there’s so much technical history in IF. I keep forgetting that there were previous TADS versions before 3. It’s interesting to slowly gain these insights, though.)

Unfortunately, I’m not sure. I think the “standard” for TADS in my head is HTML TADS, unfortunately, lol.

I don’t know either. Are there any interpreters out there that would work for testing? qtads is HTML, frob is text-only, and gargoyle, parchment, and emglken share the same TADS code.

1 Like

I’ve finally gotten around to opening a pull request that should enable proper handling of <tt> (and also <pre>) for Glk-based interpreters.

6 Likes

ok, let’s wait for Gargoyle 23.1 then feed it my “Scroll of Style”…

Best regards from Italy,
dott. Piergiorgio.

1 Like

Parchment now supports <tt> and <pre> in TADS.
Huge thanks to @ArdiMaster for solving this problem!

6 Likes

YESSSSSS

Those tags were absolutely crucial in a previous game, and part of the reason why I put it on pause for a while was because it seemed like only QTADS supported them. Having them supported in online terps means a lot.

1 Like

Outstanding.

1 Like