1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibWeb: Add Canvas Context2D basic text align and text baseline support

Add the CanvasTextDrawingStyles mixin with the textAlign and
textBaseline attributes. Update fill_text in CanvasRenderingContext2D
to move the text rect by the text align and text baseline attributes.
Wrote a simple HTML example to showcase the new features.
This commit is contained in:
Bastiaan van der Plaat 2023-08-03 12:18:17 +02:00 committed by Andreas Kling
parent e689422564
commit 220e34b69d
9 changed files with 159 additions and 9 deletions

View file

@ -28,6 +28,7 @@
#include <LibWeb/HTML/Canvas/CanvasRect.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
#include <LibWeb/HTML/Canvas/CanvasText.h>
#include <LibWeb/HTML/Canvas/CanvasTextDrawingStyles.h>
#include <LibWeb/HTML/Canvas/CanvasTransform.h>
#include <LibWeb/HTML/CanvasGradient.h>
#include <LibWeb/Layout/InlineNode.h>
@ -53,7 +54,8 @@ class CanvasRenderingContext2D
, public CanvasImageData
, public CanvasImageSmoothing
, public CanvasCompositing
, public CanvasPathDrawingStyles<CanvasRenderingContext2D> {
, public CanvasPathDrawingStyles<CanvasRenderingContext2D>
, public CanvasTextDrawingStyles<CanvasRenderingContext2D> {
WEB_PLATFORM_OBJECT(CanvasRenderingContext2D, Bindings::PlatformObject);