There are a few different projects at this point that combine modern CSS with the legacy Z-machine styling system: in particular, I’m thinking of Parchment, Dialog, and a proposed Glk extension.
The Z-machine basically provides four independent style properties, each of which can be on or off: bold, italic, monospace, and reverse-video.[1] The first three of these already have standard CSS names: font-style: italic, font-weight: bold, and font-family: monospace, monospace.[2]
The fourth one, though, hasn’t really been mainstream since the 80s, so I don’t expect it to ever be in proper CSS. At this point it seems like each system has a different way to mark it:
- Parchment uses
reverse: 1 - Dialog uses
text-decoration: reverse - Dan Fabulich proposes
--glk-reverse: 1
And I think it would be prudent to pick one and only one of these to proceed with. (This just came up in Dialog because of the new Apple II support; the Commodore 64 can’t easily do reverse-video, but on the Apple II it’s basically the only styling it does support, so it needs to be added to the 6502 interpreter.)
For reverse: 1, it’s easy to read and makes it clear exactly what’s going on. Using 1 like this is also clearly not standard CSS, which could be a pro (marking this as an extension) or a con (it clashes with the rest).
For text-decoration: reverse, it uses an existing CSS property with a nonexisting value, which is explicitly not an error in CSS (so browsers won’t care about it), but such a value could possibly be defined in the future (but if it was, I think it would mean exactly what we’re using it to mean!). This means it looks like standard CSS, even though it isn’t.
For --glk-reverse: 1, the two dashes mark it as a custom property according to the spec, so it’s guaranteed to never clash with anything. But this is also not what custom properties are supposed to do—they’re meant to be read with the var() function, renderers aren’t supposed to care about them directly. I also don’t love tying it to Glk explicitly, because Dialog doesn’t know or care about Glk; it just knows CSS and the Z-machine.
What do people think? Any big issues I’m overlooking? Dialog can easily implement any of them; I just want to make sure we settle on something that both @Dannii and I can work with. What Dialog fundamentally needs is a property that can take values meaning “explicitly reversed”, “explicitly not reversed”, and “inherit from parent”.
Plus color and background color which are handled separately. ↩︎
For the third, Dialog actually looks for the name
monospaceanywhere inside afont-familydeclaration, so you can usefont-family: Cartography Mono, monospaceif you want—the intent is that you can compile the same source code for Z-machine or for a more capable backend, which might allow arbitrary fonts. That’s less relevant for Glk. ↩︎