From 9fdb822c27e6eee7c3034161d3c893eefc1dc491 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 27 Sep 2015 14:24:42 +0100 Subject: [PATCH] Add support for italic text attribute --- README.asciidoc | 3 +++ src/face.hh | 3 ++- src/face_registry.cc | 1 + src/ncurses_ui.cc | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 02c8c4d2..cf4708ee 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -781,6 +781,9 @@ attributes is a string of letters each defining an attributes: * `u`: Underline * `r`: Reverse * `b`: Bold + * `B`: Blink + * `d`: Dim + * `i`: Italic Using named faces instead of facespec permits to change the effective faces afterwards. diff --git a/src/face.hh b/src/face.hh index e650cd81..2540705e 100644 --- a/src/face.hh +++ b/src/face.hh @@ -14,7 +14,8 @@ enum class Attribute : int Reverse = 1 << 2, Blink = 1 << 3, Bold = 1 << 4, - Dim = 1 << 5 + Dim = 1 << 5, + Italic = 1 << 6, }; template<> struct WithBitOps : std::true_type {}; diff --git a/src/face_registry.cc b/src/face_registry.cc index 5e42452d..96ae696f 100644 --- a/src/face_registry.cc +++ b/src/face_registry.cc @@ -28,6 +28,7 @@ static Face parse_face(StringView facedesc) case 'b': res.attributes |= Attribute::Bold; break; case 'B': res.attributes |= Attribute::Blink; break; case 'd': res.attributes |= Attribute::Dim; break; + case 'i': res.attributes |= Attribute::Italic; break; default: throw runtime_error(format("unknown face attribute '{}'", StringView{*attr_it})); } } diff --git a/src/ncurses_ui.cc b/src/ncurses_ui.cc index 9dfca1ad..0c9cc71a 100644 --- a/src/ncurses_ui.cc +++ b/src/ncurses_ui.cc @@ -241,6 +241,9 @@ void set_face(WINDOW* window, Face face, const Face& default_face) set_attribute(window, A_BLINK, face.attributes & Attribute::Blink); set_attribute(window, A_BOLD, face.attributes & Attribute::Bold); set_attribute(window, A_DIM, face.attributes & Attribute::Dim); + #if defined(A_ITALIC) + set_attribute(window, A_ITALIC, face.attributes & Attribute::Italic); + #endif } static sig_atomic_t resize_pending = 0;