(sent on behalf of davidqu@, because his emails are still being moderated. Moderators, feel free to drop his previous emails)
Contact emails
dav...@chromium.org, fs...@chromium.org
Spec
https://html.spec.whatwg.org/multipage/canvas.html#textmetrics
Summary
The current canvas TextMetrics API only exposes the width of the measured text. Part of the new API was already implemented under a flag, but there were some inconsistencies and bugs, especially with RightToLeft text. We fixed the problems and implemented a new version of the spec including an array of advances per character and a dictionary returning baselines.
The feature bug (https://crbug.com/277215) has strong user support (21 stars)
Link to “Intent to Implement” blink-dev discussion
The thread was titled “Intend to ship”, but it was seen as “Intend to implement” and was never actually shipped.
Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes
Demo link
-
Debuggability
No DevTools needed for debug. Users can console print the full TextMetrics object in one line.
Risks
Interoperability and Compatibility
Safari already has some of the metrics implemented but since the spec was recently updated some work still needs to be done (advances and getBaselines) to have full interoperability with Chrome. Firefox started development 4 years ago but never shipped. Edge is the only one that has no public signals of implementing yet.
Edge: No signals
Firefox: In development
Safari: Partially Shipped
We know this is a major feature requested by developers (as well as internal Google teams like Google Docs). This API will help developers have more control and more accurate text rendering. As of today a different way to achieve this is by using rendering text to the DOM and using getBoundingClientRect to get some measurements. This process not only requires a draw call but also doesn’t help obtaining the advances or the more granular metrics.
Activation
Enable the platform experiment ExtendedTextMetrics
Is this feature fully tested by web-platform-tests? Link to test suite results from wpt.fyi.
A set of test for each metric, prefixed by “2d.text.measure”:
https://wpt.fyi/results/2dcontext/drawing-text-to-the-canvas
Entry on the feature dashboard
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADp2-T9J%2BO%3D7AxKx0Ab1isbszhXrr9_xa-7Ck5A6EFhEqmnp1Q%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw9AUZmPVbBYFYQNp2qHSh9rog_Mhe2G5OB%2B_-XgymT38Q%40mail.gmail.com.
this new API matches a discussion around TextMetric within CSS-Houdini and addresses some small inconsistencies in the original spec (some values were wrongly defined on spec, correctly implemented on Safari, wrongly implemented on Chrome initially, and fixed now and on spec).
Friendly ping about this Intend to ship.The change that removes the flag to expose the full API is ready to be cherry picked and is passing all tests: https://chromium-review.googlesource.com/c/chromium/src/+/1199810. I'm just missing one LGTM from third_party/blink/API_OWNERS
I know there was a discussion on the spec thread about Safari shipping the old spec to their stable channel, but someone commented on that thread agreeing with the idea of making baselines optional, which is not possible with the current API.
Any comment or suggestion about this would be very appreciated.Thanks,David
On Tuesday, September 4, 2018 at 10:57:37 AM UTC-4, Koji Ishii wrote:I see, from that IIUC you meant canvas API now matches "advances" member to the current ED of Houdini Font Metrics API, and other members are still to be discussed?That seems reasonable to me then. Sorry I thought there was a discussion I missed.2018年9月4日(火) 9:39 Fernando Serboncini <fs...@chromium.org>:[+eae]I think there was some draft here: https://drafts.css-houdini.org/font-metrics-api-1/I'm not sure there was an online discussion, but I'm sure Emil mentioned some offline ones.On Mon, Sep 3, 2018 at 5:05 PM Koji Ishii <ko...@chromium.org> wrote:Fernando Serboncini <fs...@chromium.org>:this new API matches a discussion around TextMetric within CSS-Houdini and addresses some small inconsistencies in the original spec (some values were wrongly defined on spec, correctly implemented on Safari, wrongly implemented on Chrome initially, and fixed now and on spec).Can you tell me where the CSS-Houdini discussion has happened? I was talking to other browsers about the font metrics API discussion coming soon and we're looking forward to it, but I guess I missed the discussion had happened.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/98c0c883-1478-47df-8cef-d409d6bc384d%40chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOMQ%2Bw_FQhsRGbeW3fLFh%2BveMw8i9-dLQ6Uro6_13A4FoFVQPA%40mail.gmail.com.
Thiemo Nagel
Software Engineer
Google Germany GmbH, Erika-Mann-Straße 33, 80686 München
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg