mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +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:
parent
e689422564
commit
220e34b69d
9 changed files with 159 additions and 9 deletions
|
@ -80,6 +80,8 @@ public:
|
|||
Bindings::ImageSmoothingQuality image_smoothing_quality { Bindings::ImageSmoothingQuality::Low };
|
||||
float global_alpha = { 1 };
|
||||
Optional<CanvasClip> clip;
|
||||
Bindings::CanvasTextAlign text_align { Bindings::CanvasTextAlign::Start };
|
||||
Bindings::CanvasTextBaseline text_baseline { Bindings::CanvasTextBaseline::Alphabetic };
|
||||
};
|
||||
DrawingState& drawing_state() { return m_drawing_state; }
|
||||
DrawingState const& drawing_state() const { return m_drawing_state; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue