Add support for italic text attribute

This commit is contained in:
Maxime Coste 2015-09-27 14:24:42 +01:00
parent e2720f1fbe
commit 9fdb822c27
4 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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<Attribute> : std::true_type {};

View File

@ -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}));
}
}

View File

@ -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;