ncurses support for italics?

2019-08-07 04:10发布

问题:

Some terminals, such as urxvt, support display text in italics via the sitm and ritm terminfo entries:

echo `tput sitm`italics`tput ritm`

I'd like to use this in an application I've got which wants to render real italics into the console. Unfortunately the application is ncurses-based, and ncurses doesn't seem to have a attribute for italics --- it's got a whole bunch, including invisible text (which I'm sure is useful for something), but no italics.

Does anyone know of a way to trick ncurses into displaying italic text, or am I going to have to ditch ncurses and rewrite the program to use raw terminal sequences?

回答1:

It looks like ncurses 5.10 will contain A_ITALIC. The change went in on September 31 2013:

http://invisible-island.net/ncurses/NEWS-contents.html#t20130831

pdcurses supports A_ITALIC as well so there's at least a vague nod to compatibility. Unfortunately, this won't help me much until 5.10 is released and then becomes widespread...