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

Issue 622336 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression

Blocked on:
issue 473476



Sign in to add a comment

SVGTextContentElement.getSubStringLength() returns non-zero width for zero-width non-joiner character

Reported by mail.vi...@gmail.com, Jun 22 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.41 Safari/537.36

Steps to reproduce the problem:
The following JS Bin displays the output of getSubStringLength() for two lines of SVG text. The first line contains the characters "X" and "Y"; the second line contains the same characters separated by a zero-width non-joiner (ZWNJ) character:
http://jsbin.com/dudowefufi/1/edit?html,js,output

What is the expected behavior?
The width of the ZWNJ should be zero.

What went wrong?
The width of the ZWNJ is shown as 5.77734375, which is exactly half the width of the "X" character on the first line (11.5546875).

Furthermore, the width of the "X" character on the *second* line is also reported as 5.77734375.

Did this work before? N/A 

Chrome version: 52.0.2743.41  Channel: beta
OS Version: 10.0
Flash Version: Shockwave Flash 22.0 r0

This issue affects both Windows and Mac Chrome. ZWNJ width is reported as zero in all other browsers tested. Other characters that are expected to be zero width e.g. zero-wdith space (ZWS, ​) are also reported as non-zero width by getSubStringLength().
 
Cc: brajkumar@chromium.org
Components: Blink>SVG
Labels: -Type-Bug M-53 hasbisect OS-Linux OS-Mac Type-Bug-Regression
Owner: pdr@chromium.org
Status: Assigned (was: Unconfirmed)
Able to reproduce on Windows 7, Ubuntu 14.04 and Mac OS 10.11.5 using chrome stable M52-52.0.2743.49.

Bisect Information:
=====================
Good build: 51.0.2673.0 
Bad Build : 51.0.2675.0 

Change Log URL: https://chromium.googlesource.com/chromium/src/+log/dbdf20c9eec45a535156daf94b94db89ace868f5..7927861fcaad41e2d4d4fb713745778bde1a2b0e

From the above change log suspecting below change

Review URL: https://codereview.chromium.org/1773403002

pdr@ - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner.

Thanks!

Comment 2 by pdr@chromium.org, Jun 23 2016

Blockedon: 473476
Thanks for taking the time to file this. We did change this due to https://github.com/w3c/svgwg/issues/65 and the spec has been clarified to work like you want (and not how I implemented it). My reading of the spec is that font-variant-ligatures should switch between the current behavior and the previous behavior, and the default should be the previous behavior.

Quick question: in your product, what would you want the result to be for the word "fin" where "fi" forms a ligature and therefore a single character? Assuming all characters have length 10 and the combined ligature "fi" has length 15, would you want:
length of f: 7.5
length of i: 7.5
length of n: 10

or

length of f: 15
length of i: 0
length of n: 10

or

length of f: 15
length of i: 15
length of n: 10

Comment 3 by yosin@chromium.org, Jun 24 2016

Cc: drott@chromium.org yosin@chromium.org

Comment 4 by kojii@chromium.org, Jun 24 2016

Cc: kojii@chromium.org
This expectation conflicts with what CSS WG resolved, I think CSS and SVG need to be consistent.

Comment 5 by pdr@chromium.org, Jun 24 2016

@kojii, I'm sorry, I've misrepresented the SVG resolution. The updated spec for getSubStringLength and getExtentOfChar is pretty clear and does not depend on font-variant-ligatures:
https://svgwg.org/svg2-draft/single-page.html#text-__svg__SVGTextContentElement__getSubStringLength

Can you double-check the spec text and see if you're happy with it compared to CSS?

Comment 6 by kojii@chromium.org, Jun 24 2016

Looking at the resolution in https://github.com/w3c/svgwg/issues/65, it's all about ligatures, correct? That's ok then.

This issue is different that the expectation says:
> The width of the ZWNJ should be zero
and ZWNJ forms a typographic character unit (a.k.a. grapheme cluster) with previous character. I'm not positive to get partial width of a grapheme cluster.

CSS WG has a resolution for the behavior of grapheme cluter, see:
https://github.com/w3c/csswg-drafts/commit/7dd11832ceed93cbd5ad1472d16ee24e496012f0

Comment 7 by kojii@chromium.org, Jun 24 2016

#5: pdr@, SVG WG and your comment #2 all talking about ligatures, while the original description is talking about grapheme clusters. Which are we really talking about?

For ligatures, CSS decided not to define the behavior atm, but in the long run, it's probably correct to get width of part of ligatures. It's just not easy and not likely to happen to us in short term.

For grapheme clusters (ZWNJ and such), I support CSS WG resolution in my comment #6.
Project Member

Comment 8 by sheriffbot@chromium.org, Jul 3 2016

Labels: -M-53 M-54 MovedFrom-53
Moving this nonessential bug to the next milestone.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Ping on this one, since it's listed as a Q2 goal for paint-dev.

Sign in to add a comment