TextMetrics support

24 views
Skip to first unread message

Fabio Donzella

unread,
Nov 25, 2020, 5:38:50 PM11/25/20
to Chromium-discuss
Hi everyone,

there's any chance to know if and when TextMetrics APIs (https://developer.mozilla.org/en-US/docs/Web/API/TextMetrics) will be not experimental anymore? Will they become standard or not?

I'm writing production code for future releases and I'd like to know if I can use these APIs or not! Thanks in advance!

Koji Ishii

unread,
Nov 26, 2020, 2:01:59 AM11/26/20
to fabiod...@hotmail.it, Chromium-discuss, Yi Xu
Hi Fabio, thanks for the question. Which properties are you interested in?

We're shipping following properties:
    actualBoundingBoxAscent
    actualBoundingBoxDescent
    actualBoundingBoxLeft
    actualBoundingBoxRight
    width

We will be shipping following properties in M87 (tracking crbug.com/1129621):
    fontBoundingBoxAscent
    fontBoundingBoxDescent

These properties expose platform-dependent values. We're also shipping the following 3 descriptors to make it interoperable across platforms in M87 (tracking crbug.com/1098355):
    ascent-override
    descent-override
    line-gap-override

We're considering other properties too, but they have some technical issues to be resolved. It'd help us to learn which properties you need.

--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

Fabio Donzella

unread,
Nov 26, 2020, 2:55:00 AM11/26/20
to Chromium-discuss, Koji Ishii, Chromium-discuss, yi...@chromium.org, Fabio Donzella
Hi Koji, thanks for your reply.

Let me briefly explain what I'm doing: I'm porting an old graphic engine windows based to a Web App using HTML5 Canvas and WebAssembly. I'm facing a lot of issues to replicate the original behaviour with texts (fonts especially), that's because the original rendering done by GDI is different, depending on the font. I know that the 100% precision is almost impossible, but at least I want to reach as much as possible that percentage without binding to any O.S. in particular

What I need is exactly fontBoundingBoxAscent/ fontBoundingBoxDescent, actualBounding is depending on the string drawn on the Canvas and so it would not provide an homogeneus approach. Maybe I can avoid other properties like ascent, descents ecc. for now.

Considering that the code I'm actually writing will be part of a system that will remain in production for many years, I'm particularly interested in security, reliability and robustness: so I'm happy to hear that this will come out very soon, but in general these TextMetrics API are an experimental technology and I want some insurances that these features will not be dropped in a near future or any other limitation that can cause me some problems

Thanks in advance for your help,
Fabio
Reply all
Reply to author
Forward
0 new messages