diff options
author | Andreas Kling <kling@serenityos.org> | 2020-09-19 18:21:24 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-19 19:16:22 +0200 |
commit | 5f8a9d348d1f43e666557ddcae4ecff6b4da0a38 (patch) | |
tree | e8217f933daa2a5f200ea6fb73a4241d8c821f6b /Libraries/LibGfx | |
parent | 95eeb321f90d326f93fe7ce2ceb0f71c03ab9ab6 (diff) | |
download | serenity-5f8a9d348d1f43e666557ddcae4ecff6b4da0a38.zip |
LibGfx: Add a helper to check if a TextAlignment is vertically centered
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r-- | Libraries/LibGfx/TextAlignment.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Libraries/LibGfx/TextAlignment.h b/Libraries/LibGfx/TextAlignment.h index 5c34b4cf26..5faea7f480 100644 --- a/Libraries/LibGfx/TextAlignment.h +++ b/Libraries/LibGfx/TextAlignment.h @@ -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) \ |