FontFaceSet.h 956 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. #include <LibWeb/CSS/FontFace.h>
  9. namespace Web::CSS {
  10. class FontFaceSet final : public Bindings::PlatformObject {
  11. WEB_PLATFORM_OBJECT(FontFace, Bindings::PlatformObject);
  12. JS_DECLARE_ALLOCATOR(FontFaceSet);
  13. public:
  14. [[nodiscard]] static JS::NonnullGCPtr<FontFaceSet> construct_impl(JS::Realm&, Vector<JS::Handle<FontFace>> initial_faces);
  15. [[nodiscard]] static JS::NonnullGCPtr<FontFaceSet> create(JS::Realm&);
  16. virtual ~FontFaceSet() override = default;
  17. JS::NonnullGCPtr<FontFaceSet> add(JS::Handle<FontFace> face);
  18. JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Promise>> load(String const& font, String const& text);
  19. private:
  20. FontFaceSet(JS::Realm&, Vector<JS::Handle<FontFace>> initial_faces);
  21. virtual void initialize(JS::Realm&) override;
  22. };
  23. }