New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 853376 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 7
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: ----
Type: Feature

Blocked on:
issue 473476
issue 864193

Blocking:
issue 277215



Sign in to add a comment

Glyph advances for text

Project Member Reported by luizp@google.com, Jun 15 2018

Issue description

Ability to get glyph advances via the Canvas API (either via measureText or a new method). Would likely ultimately delegate to SkPaint::getTextWidths.

See more details on the use-case here: https://docs.google.com/document/d/1Dk6WCW8heNsbNpi_fL1YSRJoBqKz3e_tJBD4fNaazws/edit
 

Comment 1 by bokan@chromium.org, Jun 19 2018

Components: -Blink Blink>Canvas

Comment 2 by jsb...@chromium.org, Jun 28 2018

Cc: e...@chromium.org
Cc: fs...@chromium.org

Comment 4 by fs...@chromium.org, Jun 29 2018

Blockedon: 473476
Blocking: 277215
Status: Available (was: Untriaged)

Comment 5 by rbyers@chromium.org, Jun 29 2018

Owner: fs...@chromium.org
Status: Started (was: Available)
fserb@ says this is really part of issue 277215 and will likely ship at the same time.  Assigning to him to make it clear it's in progress (for go/gsuite-chrome-priorities).
Owner: davidqu@chromium.org
Project Member

Comment 7 by bugdroid1@chromium.org, Jul 16

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/65d210ea996414c459af053f8a103f24500c5605

commit 65d210ea996414c459af053f8a103f24500c5605
Author: David Quiroz Marin <davidqu@chromium.org>
Date: Mon Jul 16 23:13:26 2018

Expose glyph advances in TextMetrics

Adding a new attribute to the TextMetrics object to expose glyph
advances for a given text. This will be a list of pixel widths for each
glyph in the text measured in pixels from the text alignment origin in
the text direction (rtl or ltr).

Added some basic test and commented some edge cases that we still
need to resolve.

Bug:  853376 , 277215
Change-Id: I7df30ce493c843032d974ca79ca793c89b318d82
Reviewed-on: https://chromium-review.googlesource.com/1134202
Reviewed-by: Justin Novosad <junov@chromium.org>
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: David Quiroz Marin <davidqu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575470}
[add] https://crrev.com/65d210ea996414c459af053f8a103f24500c5605/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-textMetrics-advances.html
[modify] https://crrev.com/65d210ea996414c459af053f8a103f24500c5605/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
[modify] https://crrev.com/65d210ea996414c459af053f8a103f24500c5605/third_party/blink/renderer/core/html/canvas/text_metrics.cc
[modify] https://crrev.com/65d210ea996414c459af053f8a103f24500c5605/third_party/blink/renderer/core/html/canvas/text_metrics.h
[modify] https://crrev.com/65d210ea996414c459af053f8a103f24500c5605/third_party/blink/renderer/core/html/canvas/text_metrics.idl

Blockedon: 864193
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 16

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3c61aca7b5c67ebdee22f5e146f215d724249fae

commit 3c61aca7b5c67ebdee22f5e146f215d724249fae
Author: David Quiroz Marin <davidqu@chromium.org>
Date: Thu Aug 16 19:51:19 2018

Separate TextMetrics advances from CharacterRanges (ligatures fixed).

Moving code to a separate function to avoid conflicting with svg code
that uses CharacterRanges. Also fixed advances for ligatures and other
edge cases. Similar to text selection approach, for ligatures the
advances per character are distributed evenly along the glyph's
actual width. In the case that one character has multiple glyphs,
the advance for the next character will be the sum of all it's
glyphs' widths.

Bug:853376,277215

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I3a69d57dbb9f9c5cbc263da2d91f522f00ae4080
Reviewed-on: https://chromium-review.googlesource.com/1160874
Commit-Queue: David Quiroz Marin <davidqu@chromium.org>
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583778}
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-textMetrics-advances.html
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/core/html/canvas/text_metrics.cc
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/platform/fonts/font.cc
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/platform/fonts/font.h
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.cc
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.h
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.cc
[modify] https://crrev.com/3c61aca7b5c67ebdee22f5e146f215d724249fae/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.h

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 24

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec

commit 28a5d3f696f0ed6dc8f877b38652c48b9cae71ec
Author: David Quiroz Marin <davidqu@chromium.org>
Date: Fri Aug 24 20:19:09 2018

Add WPT tests for canvas TextMetrics.

Currently WPT tests only covers width for canvas TextMetrics. This change
adds basic tests for all the other metrics:
-advances
-actualBoundingBoxLeft, actualBoundingBoxRight, actualBoundingBoxAscent,
 actualBoundingBoxDescent
-emHeightAscent, emHeightDescent
-fontBoundingBoxAscent, fontBoundingBoxDescent
-getBaselines()

Bug: 277215, 853376 
Change-Id: Ieba242e583bc98e747f35b1dc799bea7b55e3c24
Reviewed-on: https://chromium-review.googlesource.com/1185784
Commit-Queue: David Quiroz Marin <davidqu@chromium.org>
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#585961}
[modify] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.basic.png
[modify] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.maxWidth.large.png
[modify] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.draw.fill.rtl.png
[modify] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.draw.stroke.basic.png
[add] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.measure.actualBoundingBox.html
[add] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.measure.advances.html
[add] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.measure.baselines.html
[add] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.measure.emHeights.html
[add] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/drawing-text-to-the-canvas/2d.text.measure.fontBoundingBox.html
[modify] https://crrev.com/28a5d3f696f0ed6dc8f877b38652c48b9cae71ec/third_party/WebKit/LayoutTests/external/wpt/2dcontext/tools/tests2dtext.yaml

Cc: davidqu@chromium.org
Owner: ----
Status: Available (was: Started)
@fserb, @davidqu: is this a dup of canvas text metrics?
Owner: fs...@chromium.org
Status: Fixed (was: Available)
It was/is a subfeature of https://bugs.chromium.org/p/chromium/issues/detail?id=277215 (the new text metrics API).
We can probably fix this in the name of whatever is the new thing.
Isn't this a dup, not fixed?
I don't think it is. 

New Text Metric API (277215) was a bunch of changes, including baselines, bounding boxes, etc. Then we added "advances" to it. This bug tracked only that change (we had different bugs for the other features).
In the particular case of advances (as described here), we implemented but we are probably launching a slightly different version. I don't think it's a dup of anything.

And it's fine to close it because we can create a separate bug for the new interface.

Sign in to add a comment