2022-08-12 19:10:01 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-12-16 17:49:34 +03:30
|
|
|
#include <AK/ByteString.h>
|
2022-08-12 19:10:01 +01:00
|
|
|
#include <AK/Optional.h>
|
|
|
|
#include <LibWeb/HTML/TextMetrics.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/multipage/canvas.html#canvastext
|
|
|
|
class CanvasText {
|
|
|
|
public:
|
|
|
|
virtual ~CanvasText() = default;
|
|
|
|
|
2023-09-06 19:41:48 +12:00
|
|
|
virtual void fill_text(StringView, float x, float y, Optional<double> max_width) = 0;
|
|
|
|
virtual void stroke_text(StringView, float x, float y, Optional<double> max_width) = 0;
|
2024-11-15 04:01:23 +13:00
|
|
|
virtual GC::Ref<TextMetrics> measure_text(StringView text) = 0;
|
2022-08-12 19:10:01 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
CanvasText() = default;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|