Optionalwidth: numberOptionalheight: numberExecute all buffered draw commands.
Ordering contract: GPU-accelerated commands (drawImage, fillRect, strokeRect) are rendered first, then Canvas 2D helper operations (text/path) are composited on top. Callers must ensure fillText/strokeText are issued AFTER all drawImage calls within a single frame.
Optionalpadding: numberOptionalmeasureMeasure text in the same canvas context class used for comment rendering.
In WKWebView on macOS, font matching can depend on whether the canvas was
connected to the document when its context first resolved the font. The
main renderer is connected, while comment text is rendered on detached
offscreen canvases. Implementations can use this hook to measure with a
detached canvas as well, avoiding connected-vs-detached font metric
mismatches that cause clipping. drawScale is supplied so implementations
can mirror render-time state, although WKWebView's observed mismatch is
caused by canvas connection state rather than the transform itself.
Optional — implementations that return identical metrics regardless of
context state (Chrome, Firefox, Node-canvas) may omit it. Callers fall
back to measureText() when the method is absent.
Optionalarg1: number
Draw a sub-renderer's content onto this renderer.
The source image is read from
image.canvas.