github web-platform-tests/wpt merge_pr_48420

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
4 months ago

Implement TextMetrics::getTextClusters()

This change creates a new API method for TextMetrics objects in Canvas,
that returns the specific ranged split into its minimal grapheme
clusters, i.e. the smallest units that make sense to render separately
from the perspective of the user.

The returned object, named TextCluster, contains all the information
needed for it to be rendered and shaped in the same way as in the input
given to ctx.measureText(). This includes the begin and end indices
on the input string, x and y positions relative to the anchor point of
the Canvas context when the text is measured, and the complete text to
preserve the context needed to reshape the text exactly the same.

The final optional parameter for getTextClustersForRange() is
dictionary to specify the desired anchor point position for each
cluster. This enables the API to adjust the returned x and y positions
to a different align/baseline that the ones used when the text was
measured.

The new API was enabled under the ExtendedTextMetrics flag.

The next CL in the stack creates a new method for the Canvas rendering
context that enables the rending of TextCluster objects.

Bug: 341213359
Change-Id: Ie668ec4a266d4b5a99443125c7099e6f72714f7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5839992
Reviewed-by: Koji Ishii kojii@chromium.org
Commit-Queue: Andres Ricardo Perez andresrperez@chromium.org
Cr-Commit-Position: refs/heads/main@{#1363086}

Don't miss a new wpt release

NewReleases is sending notifications on new releases.