Closed egmontkob closed 1 year ago
FYI, DEC used SGR ?4
and SGR ?5
to enable superscript and subscript, and SGR ?24
to disable both. And those sequences were also supported by a few modern terminals for a while, but I think at least some of them have since dropped that support because XTerm created a conflict by reusing the private SGR sequence for something entirely unrelated.
It's also worth mentioning that VTE was opposed to using proprietary SGR numbers for this, and preferred to follow the DEC standard (see https://gitlab.gnome.org/GNOME/vte/-/issues/361). Although there was no commitment to actually implementing superscript/subscript.
Yes, I missed that...
However, the description in https://github.com/mintty/mintty/wiki/Tips#text-attributes-and-rendering is different from my proposal. It seems, like the DEC ones, to allow for multiple superscripting and multiple subscripting.
My proposal, for ECMA-48 styling, is in line with the OpenType features 'subs' and 'sups' (but simulate if those features are not available in the font for the given characters). This does not allow multiple superscripting or subscripting. That is explicitly disallowed (in order to be in line with the OpenType features 'subs' and 'sups'); indeed the sub/sup proposed do not apply to already superscripted/subscripted Unicode characters.
Math expressions, which regularly allow superscript on superscript, etc. etc. are not covered at all by this proposal. It is covered by a completely separate proposal (but uploaded to this github repo): https://github.com/kent-karlsson/control/blob/main/math-layout-controls-2022-C.pdf.
So I think it is not too bad that I picked different code numbers for sub/sup than mintty... But the code numbers mintty uses for this are taken for completely different style settings in my proposal. Considering to "move" those (to use other code values).
Working draft summary on this point:
CSI 56:1[:v]m Raised to first superscript level and slightly smaller. Cmp. DEC CSI?4m. CSI 56[:0]m Not raised/lowered and back to the set size (default). Cmp. DEC CSI?24m. CSI 56:1=m Lowered to first subscript level and slightly smaller. Cmp. DEC CSI?5m.
CSI 73m Reserved for HTML-like superscript start. In contrast to all other SGR controls, CSI 73m…CSI 75m nest. CSI 74m Reserved for HTML-like subscript start. In contrast to all other SGR controls, CSI 74m…CSI 75m nest. CSI 75m Reserved for HTML-like superscript/subscript end. Use instead CSI 56:_g_m, which does not nest.
You picked CSI 56.
According to https://en.wikipedia.org/wiki/ANSI_escape_code, MinTTY already uses CSI 73, 74, 75 (I don't know if it's indeed the case, haven't verified) -- which, in turn, you've picked for line spacing and such.
Please consider not conflicting with an existing implementation.