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

LibWeb: Use the new Gfx::Painter::draw_text_run() API for drawing text

This avoids a bunch of unnecessary work in Painter which not only took
time, but sometimes also led to alignment issues. draw_text_run() will
draw the text where we tell it, and that's it.
This commit is contained in:
Andreas Kling 2022-03-28 21:05:51 +02:00
parent dd940dfa85
commit 1c88536298
4 changed files with 16 additions and 9 deletions

View file

@ -43,6 +43,10 @@ public:
const Gfx::FloatPoint& offset() const { return m_offset; }
void set_offset(const Gfx::FloatPoint& offset) { m_offset = offset; }
// The baseline of a fragment is the number of pixels from the top to the text baseline.
void set_baseline(float y) { m_baseline = y; }
float baseline() const { return m_baseline; }
const Gfx::FloatSize& size() const { return m_size; }
void set_width(float width) { m_size.set_width(width); }
void set_height(float height) { m_size.set_height(height); }
@ -75,6 +79,7 @@ private:
Gfx::FloatSize m_size;
float m_border_box_top { 0 };
float m_border_box_bottom { 0 };
float m_baseline { 0 };
Type m_type { Type::Normal };
};