mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibWeb: Implement CanvasRenderingContext2D.measureText
This requires an implementation of the "text preparation algorithm" as specified here: html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm However, we're missing a lot of things such as the CanvasTextDrawingStyles interface, so most of the algorithm was not implemented. Additionally, we also are not able to use a LineBox like the algorithm suggests, because our layouting infra is not up to the task yet. The prepare_text function does nothing other than figuring out the width of the given text and return glyphs with offsets at the moment.
This commit is contained in:
parent
732e41714a
commit
9121cc7cae
10 changed files with 253 additions and 0 deletions
17
Userland/Libraries/LibWeb/HTML/TextMetrics.idl
Normal file
17
Userland/Libraries/LibWeb/HTML/TextMetrics.idl
Normal file
|
@ -0,0 +1,17 @@
|
|||
interface TextMetrics {
|
||||
// x-direction
|
||||
readonly attribute double width; // advance width
|
||||
readonly attribute double actualBoundingBoxLeft;
|
||||
readonly attribute double actualBoundingBoxRight;
|
||||
|
||||
// y-direction
|
||||
readonly attribute double fontBoundingBoxAscent;
|
||||
readonly attribute double fontBoundingBoxDescent;
|
||||
readonly attribute double actualBoundingBoxAscent;
|
||||
readonly attribute double actualBoundingBoxDescent;
|
||||
readonly attribute double emHeightAscent;
|
||||
readonly attribute double emHeightDescent;
|
||||
readonly attribute double hangingBaseline;
|
||||
readonly attribute double alphabeticBaseline;
|
||||
readonly attribute double ideographicBaseline;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue