ladybird/Userland/Libraries/LibWeb/CSS/FontFaceSet.h
Andrew Kaster e10721f1b5 LibWeb: Add stub implementation of FontFaceSet and Document.fonts
This is now enough for duolingo to load and use its fallback fonts.
2024-05-08 10:39:16 +02:00

32 lines
956 B
C++

/*
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/CSS/FontFace.h>
namespace Web::CSS {
class FontFaceSet final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(FontFace, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(FontFaceSet);
public:
[[nodiscard]] static JS::NonnullGCPtr<FontFaceSet> construct_impl(JS::Realm&, Vector<JS::Handle<FontFace>> initial_faces);
[[nodiscard]] static JS::NonnullGCPtr<FontFaceSet> create(JS::Realm&);
virtual ~FontFaceSet() override = default;
JS::NonnullGCPtr<FontFaceSet> add(JS::Handle<FontFace> face);
JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Promise>> load(String const& font, String const& text);
private:
FontFaceSet(JS::Realm&, Vector<JS::Handle<FontFace>> initial_faces);
virtual void initialize(JS::Realm&) override;
};
}