CanvasText.h 680 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/DeprecatedString.h>
  8. #include <AK/Optional.h>
  9. #include <LibWeb/HTML/TextMetrics.h>
  10. namespace Web::HTML {
  11. // https://html.spec.whatwg.org/multipage/canvas.html#canvastext
  12. class CanvasText {
  13. public:
  14. virtual ~CanvasText() = default;
  15. virtual void fill_text(StringView, float x, float y, Optional<double> max_width) = 0;
  16. virtual void stroke_text(StringView, float x, float y, Optional<double> max_width) = 0;
  17. virtual JS::NonnullGCPtr<TextMetrics> measure_text(StringView text) = 0;
  18. protected:
  19. CanvasText() = default;
  20. };
  21. }