Add support for italic text attribute
This commit is contained in:
parent
e2720f1fbe
commit
9fdb822c27
|
@ -781,6 +781,9 @@ attributes is a string of letters each defining an attributes:
|
||||||
* `u`: Underline
|
* `u`: Underline
|
||||||
* `r`: Reverse
|
* `r`: Reverse
|
||||||
* `b`: Bold
|
* `b`: Bold
|
||||||
|
* `B`: Blink
|
||||||
|
* `d`: Dim
|
||||||
|
* `i`: Italic
|
||||||
|
|
||||||
Using named faces instead of facespec permits to change the effective faces
|
Using named faces instead of facespec permits to change the effective faces
|
||||||
afterwards.
|
afterwards.
|
||||||
|
|
|
@ -14,7 +14,8 @@ enum class Attribute : int
|
||||||
Reverse = 1 << 2,
|
Reverse = 1 << 2,
|
||||||
Blink = 1 << 3,
|
Blink = 1 << 3,
|
||||||
Bold = 1 << 4,
|
Bold = 1 << 4,
|
||||||
Dim = 1 << 5
|
Dim = 1 << 5,
|
||||||
|
Italic = 1 << 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct WithBitOps<Attribute> : std::true_type {};
|
template<> struct WithBitOps<Attribute> : std::true_type {};
|
||||||
|
|
|
@ -28,6 +28,7 @@ static Face parse_face(StringView facedesc)
|
||||||
case 'b': res.attributes |= Attribute::Bold; break;
|
case 'b': res.attributes |= Attribute::Bold; break;
|
||||||
case 'B': res.attributes |= Attribute::Blink; break;
|
case 'B': res.attributes |= Attribute::Blink; break;
|
||||||
case 'd': res.attributes |= Attribute::Dim; 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}));
|
default: throw runtime_error(format("unknown face attribute '{}'", StringView{*attr_it}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_BLINK, face.attributes & Attribute::Blink);
|
||||||
set_attribute(window, A_BOLD, face.attributes & Attribute::Bold);
|
set_attribute(window, A_BOLD, face.attributes & Attribute::Bold);
|
||||||
set_attribute(window, A_DIM, face.attributes & Attribute::Dim);
|
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;
|
static sig_atomic_t resize_pending = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user