mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 14:57:54 +03:00
LibGfx: Add pure virtual fallible clone() for Fonts
This commit is contained in:
parent
d9fb838cf6
commit
1be830e3c6
Notes:
sideshowbarker
2024-07-17 09:56:35 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/1be830e3c6 Pull-request: https://github.com/SerenityOS/serenity/pull/16104
@ -21,7 +21,7 @@ namespace Gfx {
|
||||
class BitmapFont final : public Font {
|
||||
public:
|
||||
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 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 ErrorOr<NonnullRefPtr<Font>> try_clone() const = 0;
|
||||
virtual ~Font() {};
|
||||
|
||||
virtual FontPixelMetrics pixel_metrics() const = 0;
|
||||
|
@ -33,7 +33,8 @@ public:
|
||||
RefPtr<Gfx::Bitmap> rasterize_glyph(u32 glyph_id) const;
|
||||
|
||||
// ^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 int pixel_size() const override { return m_point_height * 1.33333333f; }
|
||||
virtual float point_size() const override { return m_point_height; }
|
||||
|
Loading…
Reference in New Issue
Block a user