1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

LibGfx: Add TextAlignment::BottomRight

This commit is contained in:
Peter Elliott 2020-08-21 08:52:39 -06:00 committed by Andreas Kling
parent 23a43d10f3
commit 28db3cd5ef
3 changed files with 10 additions and 0 deletions

View file

@ -888,6 +888,7 @@ void Painter::draw_text_line(const IntRect& a_rect, const Utf8View& text, const
break;
case TextAlignment::TopRight:
case TextAlignment::CenterRight:
case TextAlignment::BottomRight:
rect.set_x(rect.right() - font.width(final_text));
break;
case TextAlignment::Center: {
@ -1037,6 +1038,9 @@ void Painter::draw_text(const IntRect& rect, const StringView& raw_text, const F
case TextAlignment::Center:
bounding_rect.center_within(rect);
break;
case TextAlignment::BottomRight:
bounding_rect.set_location({ (rect.right() + 1) - bounding_rect.width(), (rect.bottom() + 1) - bounding_rect.height() });
break;
default:
ASSERT_NOT_REACHED();
}