SVGTextContentElement.getSubStringLength() returns non-zero width for zero-width non-joiner character
Reported by
mail.vi...@gmail.com,
Jun 22 2016
|
|||||
Issue descriptionUserAgent: 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().
,
Jun 23 2016
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
,
Jun 24 2016
,
Jun 24 2016
This expectation conflicts with what CSS WG resolved, I think CSS and SVG need to be consistent.
,
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?
,
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
,
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.
,
Jul 3 2016
Moving this nonessential bug to the next milestone. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jun 20 2017
Ping on this one, since it's listed as a Q2 goal for paint-dev. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by brajkumar@chromium.org
, Jun 23 2016Components: Blink>SVG
Labels: -Type-Bug M-53 hasbisect OS-Linux OS-Mac Type-Bug-Regression
Owner: pdr@chromium.org
Status: Assigned (was: Unconfirmed)