mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:17:44 +00:00
LibGfx: Add pure virtual fallible clone() for Fonts
This commit is contained in:
parent
d9fb838cf6
commit
1be830e3c6
3 changed files with 4 additions and 2 deletions
|
@ -21,7 +21,7 @@ namespace Gfx {
|
||||||
class BitmapFont final : public Font {
|
class BitmapFont final : public Font {
|
||||||
public:
|
public:
|
||||||
virtual NonnullRefPtr<Font> clone() const override;
|
virtual NonnullRefPtr<Font> clone() const override;
|
||||||
ErrorOr<NonnullRefPtr<Font>> try_clone() const;
|
ErrorOr<NonnullRefPtr<Font>> try_clone() const override;
|
||||||
static NonnullRefPtr<BitmapFont> create(u8 glyph_height, u8 glyph_width, bool fixed, size_t glyph_count);
|
static NonnullRefPtr<BitmapFont> create(u8 glyph_height, u8 glyph_width, bool fixed, size_t glyph_count);
|
||||||
static ErrorOr<NonnullRefPtr<BitmapFont>> try_create(u8 glyph_height, u8 glyph_width, bool fixed, size_t glyph_count);
|
static ErrorOr<NonnullRefPtr<BitmapFont>> try_create(u8 glyph_height, u8 glyph_width, bool fixed, size_t glyph_count);
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual NonnullRefPtr<Font> clone() const = 0;
|
virtual NonnullRefPtr<Font> clone() const = 0;
|
||||||
|
virtual ErrorOr<NonnullRefPtr<Font>> try_clone() const = 0;
|
||||||
virtual ~Font() {};
|
virtual ~Font() {};
|
||||||
|
|
||||||
virtual FontPixelMetrics pixel_metrics() const = 0;
|
virtual FontPixelMetrics pixel_metrics() const = 0;
|
||||||
|
|
|
@ -33,7 +33,8 @@ public:
|
||||||
RefPtr<Gfx::Bitmap> rasterize_glyph(u32 glyph_id) const;
|
RefPtr<Gfx::Bitmap> rasterize_glyph(u32 glyph_id) const;
|
||||||
|
|
||||||
// ^Gfx::Font
|
// ^Gfx::Font
|
||||||
virtual NonnullRefPtr<Font> clone() const override { return *this; } // FIXME: clone() should not need to be implemented
|
virtual NonnullRefPtr<Font> clone() const override { return MUST(try_clone()); } // FIXME: clone() should not need to be implemented
|
||||||
|
virtual ErrorOr<NonnullRefPtr<Font>> try_clone() const override { return *this; }
|
||||||
virtual u8 presentation_size() const override { return m_point_height; }
|
virtual u8 presentation_size() const override { return m_point_height; }
|
||||||
virtual int pixel_size() const override { return m_point_height * 1.33333333f; }
|
virtual int pixel_size() const override { return m_point_height * 1.33333333f; }
|
||||||
virtual float point_size() const override { return m_point_height; }
|
virtual float point_size() const override { return m_point_height; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue