mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
LibGfx: Slim down Gfx::TextLayout API by removing unused accessors
Also store the Font as a const reference instead of a raw pointer, since we don't allow a null Font here.
This commit is contained in:
parent
65c8cd37e3
commit
6b421fb521
4 changed files with 14 additions and 23 deletions
|
@ -44,22 +44,13 @@ enum class FitWithinRect {
|
|||
// b) Taking the Lines from TextLayout and painting each glyph.
|
||||
class TextLayout {
|
||||
public:
|
||||
TextLayout(Gfx::Font const* font, Utf8View const& text, FloatRect const& rect)
|
||||
TextLayout(Gfx::Font const& font, Utf8View const& text, FloatRect const& rect)
|
||||
: m_font(font)
|
||||
, m_text(text)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
Font const& font() const { return *m_font; }
|
||||
void set_font(Font const* font) { m_font = font; }
|
||||
|
||||
Utf8View const& text() const { return m_text; }
|
||||
void set_text(Utf8View const& text) { m_text = text; }
|
||||
|
||||
FloatRect const& rect() const { return m_rect; }
|
||||
void set_rect(FloatRect const& rect) { m_rect = rect; }
|
||||
|
||||
Vector<DeprecatedString, 32> lines(TextElision elision, TextWrapping wrapping, int line_spacing) const
|
||||
{
|
||||
return wrap_lines(elision, wrapping, line_spacing, FitWithinRect::Yes);
|
||||
|
@ -71,7 +62,7 @@ private:
|
|||
Vector<DeprecatedString, 32> wrap_lines(TextElision, TextWrapping, int line_spacing, FitWithinRect) const;
|
||||
DeprecatedString elide_text_from_right(Utf8View, bool force_elision) const;
|
||||
|
||||
Font const* m_font;
|
||||
Font const& m_font;
|
||||
Utf8View m_text;
|
||||
FloatRect m_rect;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue