Unlike in Glk/Glulx, the Z-machine’s text style codes are designed so that you can combine them: reverse video is 1, bold is 2, italic is 4, and monospace is 8, so you can request bold italic text with style 6, or reverse video monospace text with style 9.
My question is, do interpreters actually support this? How many interpreters actually allow bold italic text, for example?
The reason I ask is because currently, Dialog’s Z-machine backend turns off all styles before applying a new one, but it wouldn’t take much work to have it combine them instead—that is, if you have a (span @italic) inside a (span @bold), it’ll ask the interpreter for bold italics.
But if interpreters don’t support this, then there’s no point in going to the effort of adding it.
In my ultra-scientific survey of terps I had lying around, using this source:
lab is room.
when play begins:
say "[bold type]fee [italic type]fie [reverse type]fo[verse type] [roman type]fum ."
to say reverse type: (- @set_colour 0 9; @set_colour 2 0; -);
to say verse type: (- @set_colour 1 1; -)
frotz: styles stacked
bocfel: styles stacked
fizmo-ncursesw: styles stacked (but italic was represented by underlining)
gargoyle: styles stacked except that the reverse type continued to be black on white
lectrote: styles stacked except that the reverse type continued to be black on white
single-file-parchment: styles stacked except that the reverse type continued to be black on white
Conclusion: looks to me like it’s more supported than not.
Doh. I was wondering why it didn’t work in gargoyle and parchment, where I expected it to. I was distracted by that code achieving the desired effect in my (light-on-dark) terminal. ok, shortening it to:
to say reverse type: (- @set_colour 9 2; -)
I see the desired behavior in gargoyle and, when in light mode, parchment. Since the code is really specifying white text on black background and doesn’t know whether that’s normal or the inverse of normal I don’t see a difference in dark mode in parchment… but that’s actually to be expected.