1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:57:45 +00:00

SharedGraphics: Allow passing a Font to text drawing functions.

This way we don't have to juggle around with calls to Painter::set_font()
which simplifies a bunch of places.
This commit is contained in:
Andreas Kling 2019-03-09 21:24:12 +01:00
parent b8f999cbef
commit ffe4522316
5 changed files with 63 additions and 29 deletions

View file

@ -35,9 +35,12 @@ public:
void blit(const Point&, const GraphicsBitmap&, const Rect& src_rect);
void blit_with_opacity(const Point&, const GraphicsBitmap&, const Rect& src_rect, float opacity);
void draw_text(const Rect&, const char* text, int length, TextAlignment = TextAlignment::TopLeft, Color = Color());
void draw_text(const Rect&, const String&, TextAlignment = TextAlignment::TopLeft, Color = Color());
void draw_text(const Rect&, const char* text, int length, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black);
void draw_text(const Rect&, const char* text, int length, TextAlignment = TextAlignment::TopLeft, Color = Color::Black);
void draw_text(const Rect&, const String&, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black);
void draw_text(const Rect&, const String&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black);
void draw_glyph(const Point&, char, Color);
void draw_glyph(const Point&, char, const Font&, Color);
const Font& font() const { return *state().font; }
void set_font(const Font& font) { state().font = &font; }