LibGfx: Add a helper to check if a TextAlignment is vertically centered

This commit is contained in:
Andreas Kling 2020-09-19 18:21:24 +02:00
parent 95eeb321f9
commit 5f8a9d348d
Notes: sideshowbarker 2024-07-19 02:19:51 +09:00

View File

@ -57,6 +57,18 @@ inline bool is_right_text_alignment(TextAlignment alignment)
}
}
inline bool is_vertically_centered_text_alignment(TextAlignment alignment)
{
switch (alignment) {
case TextAlignment::CenterLeft:
case TextAlignment::CenterRight:
case TextAlignment::Center:
return true;
default:
return false;
}
}
inline Optional<TextAlignment> text_alignment_from_string(const StringView& string)
{
#define __ENUMERATE(x) \