mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +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
|
@ -7,6 +7,7 @@
|
|||
#import <HTML/Canvas/CanvasImageSmoothing.idl>
|
||||
#import <HTML/Canvas/CanvasPath.idl>
|
||||
#import <HTML/Canvas/CanvasPathDrawingStyles.idl>
|
||||
#import <HTML/Canvas/CanvasTextDrawingStyles.idl>
|
||||
#import <HTML/Canvas/CanvasRect.idl>
|
||||
#import <HTML/Canvas/CanvasState.idl>
|
||||
#import <HTML/Canvas/CanvasText.idl>
|
||||
|
@ -14,6 +15,10 @@
|
|||
|
||||
enum ImageSmoothingQuality { "low", "medium", "high" };
|
||||
|
||||
// FIXME: This should be in CanvasTextDrawingStyles.idl but then it is not exported
|
||||
enum CanvasTextAlign { "start", "end", "left", "right", "center" };
|
||||
enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#canvasrenderingcontext2d
|
||||
[Exposed=Window]
|
||||
interface CanvasRenderingContext2D {
|
||||
|
@ -34,5 +39,5 @@ CanvasRenderingContext2D includes CanvasText;
|
|||
CanvasRenderingContext2D includes CanvasDrawImage;
|
||||
CanvasRenderingContext2D includes CanvasImageData;
|
||||
CanvasRenderingContext2D includes CanvasPathDrawingStyles;
|
||||
// FIXME: CanvasRenderingContext2D includes CanvasTextDrawingStyles;
|
||||
CanvasRenderingContext2D includes CanvasTextDrawingStyles;
|
||||
CanvasRenderingContext2D includes CanvasPath;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue