New issue
Advanced search Search tips

Issue 864193 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 24
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 277215
issue 853376



Sign in to add a comment

ShapeResultBuffer::IndividualCharacterRanges does not give the proper result for right-to-left text-runs

Project Member Reported by davidqu@chromium.org, Jul 16

Issue description

ShapeResultBuffer::IndividualCharacterRanges does not give the proper result for right-to-left text-runs.

After the change: https://crrev.com/c/1134202 TextMetrics will include a list of "advances" which should be the distance parallel to the baseline from the actualBoundingBoxLeft to the point where of each glyph starts to be drawn. This is simply being exposed to the canvas API from IndividualCharacterRanges. With RTL text, the values have a weird ordering.

Including an image of how the example should render.

What steps will reproduce the problem?
(1) On the latest chrome with the flag 'Experimental Web Platform' features open: https://jsfiddle.net/davidqum/gnvjt7hf/
(2) Look at the values under the vertical red lines

What is the expected result?
Each red vertical line should be right to the left of each glyph (like in the first two ltr cases)

What happens instead?
For the last three examples, the advances are incorrect within each word (although they seem to be in the right range per "word" relative to the full text run)


Notes: The non-printable character '\u202E' is used to force Latin-based-font text to be rendered from right to left
 
advances-rtl-bug.png
114 KB View Download
Blocking: 853376 277215
Cc: drott@chromium.org
Components: Blink>Canvas
Labels: -Pri-3 Pri-2
Status: Started (was: Untriaged)
Dominik,

this seems to me a fail on how the range function works. We are also going to check if ligatures are working as intended.

WDYT?
I can't say much and I don't have the cycles to analyse this at the moment. It does look like a bug in how the IndividualCharacterRanges function assembles the return result.
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 24

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

commit 67493d01633025e7436230039e57db20218209b9
Author: David Quiroz Marin <davidqu@chromium.org>
Date: Tue Jul 24 22:18:19 2018

Fix right-to-left advances from canvas measureText

This fixes advances from TextMetrics for Right-to-left text. Currently
it's returning values that are correct when there is just one text_run
(or word), but the values are in the reverse order within each text_run
for when there's more than one run.

Bug:  864193 
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I6459f3800a33aedf46692b3931fb5778ee3ce825
Reviewed-on: https://chromium-review.googlesource.com/1144629
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Reviewed-by: Justin Novosad <junov@chromium.org>
Commit-Queue: David Quiroz Marin <davidqu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577707}
[modify] https://crrev.com/67493d01633025e7436230039e57db20218209b9/third_party/WebKit/LayoutTests/fast/canvas-api/canvas-textMetrics-advances.html
[modify] https://crrev.com/67493d01633025e7436230039e57db20218209b9/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.cc

Status: Fixed (was: Started)

Sign in to add a comment