FontPlugin.h 934 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefPtr.h>
  8. #include <AK/Vector.h>
  9. #include <LibGfx/Font/FontDatabase.h>
  10. #include <LibWeb/Platform/FontPlugin.h>
  11. namespace Ladybird {
  12. class FontPlugin final : public Web::Platform::FontPlugin {
  13. public:
  14. FontPlugin(bool is_layout_test_mode, Gfx::SystemFontProvider* = nullptr);
  15. virtual ~FontPlugin();
  16. virtual Gfx::Font& default_font() override;
  17. virtual Gfx::Font& default_fixed_width_font() override;
  18. virtual RefPtr<Gfx::Font> default_emoji_font(float point_size) override;
  19. virtual FlyString generic_font_name(Web::Platform::GenericFont) override;
  20. void update_generic_fonts();
  21. private:
  22. Vector<FlyString> m_generic_font_names;
  23. RefPtr<Gfx::Font> m_default_font;
  24. RefPtr<Gfx::Font> m_default_fixed_width_font;
  25. bool m_is_layout_test_mode { false };
  26. };
  27. }