1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:37:35 +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:
sin-ack 2021-12-30 22:15:38 +00:00 committed by Linus Groh
parent 732e41714a
commit 9121cc7cae
10 changed files with 253 additions and 0 deletions

View file

@ -195,6 +195,7 @@ set(SOURCES
HTML/Scripting/Script.cpp
HTML/SyntaxHighlighter/SyntaxHighlighter.cpp
HTML/TagNames.cpp
HTML/TextMetrics.cpp
HTML/WebSocket.cpp
HighResolutionTime/Performance.cpp
ImageDecoding.cpp
@ -485,6 +486,7 @@ libweb_js_wrapper(HTML/MessagePort)
libweb_js_wrapper(HTML/PageTransitionEvent)
libweb_js_wrapper(HTML/PromiseRejectionEvent)
libweb_js_wrapper(HTML/SubmitEvent)
libweb_js_wrapper(HTML/TextMetrics)
libweb_js_wrapper(HTML/WebSocket)
libweb_js_wrapper(HighResolutionTime/Performance)
libweb_js_wrapper(IntersectionObserver/IntersectionObserver)