mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17: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:
parent
732e41714a
commit
9121cc7cae
10 changed files with 253 additions and 0 deletions
|
@ -937,6 +937,8 @@ static bool is_wrappable_type(IDL::Type const& type)
|
|||
return true;
|
||||
if (type.name == "NamedNodeMap")
|
||||
return true;
|
||||
if (type.name == "TextMetrics")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1637,6 +1639,7 @@ void generate_implementation(IDL::Interface const& interface)
|
|||
#include <LibWeb/Bindings/MessagePortWrapper.h>
|
||||
#include <LibWeb/Bindings/NamedNodeMapWrapper.h>
|
||||
#include <LibWeb/Bindings/NodeWrapperFactory.h>
|
||||
#include <LibWeb/Bindings/TextMetricsWrapper.h>
|
||||
#include <LibWeb/Bindings/TextWrapper.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
|
@ -2808,6 +2811,7 @@ void generate_prototype_implementation(IDL::Interface const& interface)
|
|||
#include <LibWeb/Bindings/RangeWrapper.h>
|
||||
#include <LibWeb/Bindings/StyleSheetListWrapper.h>
|
||||
#include <LibWeb/Bindings/SubtleCryptoWrapper.h>
|
||||
#include <LibWeb/Bindings/TextMetricsWrapper.h>
|
||||
#include <LibWeb/Bindings/TextWrapper.h>
|
||||
#include <LibWeb/Bindings/URLSearchParamsWrapper.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue