mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 18:58:56 +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
Notes:
sideshowbarker
2024-07-17 21:39:27 +09:00
Author: https://github.com/sin-ack
Commit: 9121cc7cae
Pull-request: https://github.com/SerenityOS/serenity/pull/11512
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/linusg ✅
10 changed files with 253 additions and 0 deletions
|
@ -266,6 +266,8 @@
|
|||
#include <LibWeb/Bindings/TextConstructor.h>
|
||||
#include <LibWeb/Bindings/TextEncoderConstructor.h>
|
||||
#include <LibWeb/Bindings/TextEncoderPrototype.h>
|
||||
#include <LibWeb/Bindings/TextMetricsConstructor.h>
|
||||
#include <LibWeb/Bindings/TextMetricsPrototype.h>
|
||||
#include <LibWeb/Bindings/TextPrototype.h>
|
||||
#include <LibWeb/Bindings/UIEventConstructor.h>
|
||||
#include <LibWeb/Bindings/UIEventPrototype.h>
|
||||
|
@ -422,6 +424,7 @@
|
|||
ADD_WINDOW_OBJECT_INTERFACE(SVGSVGElement) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(Text) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(TextEncoder) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(TextMetrics) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(UIEvent) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(URLSearchParams) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(URL) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue