SVG: Text elements with size smaller than 0.7 are not rendered in objectBoundingBox clipPaths
Reported by
paul.leb...@gmail.com,
Jul 10 2016
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Example URL: https://jsfiddle.net/3tqjewvo/ Steps to reproduce the problem: 1. Try the linked SVG test case What is the expected behavior? Two 'H' characters rendered in red What went wrong? Only the second one (size>=0.7) is rendered. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? Yes Chrome version: 51.0.2704.103 Channel: n/a OS Version: 6.1 (Windows 7, Windows Server 2008 R2) Flash Version: Shockwave Flash 22.0 r0 Works in Firefox and IE. Test case included below in case Fiddle link breaks: <svg width="500px" height="200px"> <defs> <clipPath id="clipper" clipPathUnits="objectBoundingBox"> <text id="test" x="0" y=".8" font-size="0.69">H</text> <text id="test" x="0.5" y=".8" font-size="0.7">H</text> </clipPath> </defs> <rect width="500px" height="200px" fill="red" clip-path="url(#clipper)"></rect> </svg> First noticed by SO user here: http://stackoverflow.com/questions/38287722/chrome-not-rendering-specific-font-size-for-svg-text-element-inside-clippath-set
,
Jul 11 2016
Thanks for the report. Not able to reproduce the issue on Win7, Mac OS X 10.11.5, Ubuntu 14.04 using Chrome Stable 51.0.2704.106, Beta 52.0.2743.60, Dev 53.0.2785.8 and Canary 54.0.2794.0 navigated to https://jsfiddle.net/3tqjewvo/ - two 'H' characters rendered in red - attached screenshot for reference. Could you please check with the above mentioned version and let us know if the issue still persists.
,
Jul 11 2016
This is still happening for me in "51.0.2704.103". I also updated to "51.0.2704.106" to check, and ir is still there. However I just discovered that it is affected by the zoom level. At default zoom (Ctrl 0) it renders incorrectly, but if I zoom up one level (Ctrl +), both 'H's render. At this higher zoom, I need to drop the font-size down to 0.63 before it disappears. If I zoom again, it disappears when I drop the size down to 0.55. This may also explain the difference between my results and the original S.O. reporter, who was seeing it drop out at 0.5.
,
Jul 11 2016
Also checked Canary 54.0.2793.0 on Win7. Seeing fault here as well.
,
Jul 11 2016
Thank you for providing more feedback. Adding requester "nyerramilli@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 11 2016
I can repro on Linux, but the threshold is different (0.5): https://jsfiddle.net/fmalita/nj9oe7u5/1/ Might be dependent on system fonts, etc.
,
Jul 12 2016
Probably a consequence of our busted OBB resource layout (issue 294900): since we're not instancing resources, we perform the layout in a context unrelated to the actual referencing element => the resource layout is oblivious to the OBB content transform we apply at paint time. In this particular case, it means don't observe the 500x200 OBB rect scale when we layout the clipPath => we compute unscaled font sizes. Since these are cached (FontDescription), we just bail at paint time because it looks like we're trying to draw super tiny text.
,
Jul 12 2016
I think we're just hitting minimum font size issues. Removing SVGInlineTextBoxPainter::textShouldBePainted fixes this on Mac but we still have Mac and Linux failures (https://codereview.chromium.org/2144523002).
,
Dec 14 2016
Running the test with a CL that addresses the min-font-size issue, it does appear to fix this. We should probably try to land something like pdr's CL still though. (I'd also like to acknowledge the oBB scaling issue, which most certainly is real in some cases too...)
,
Dec 15 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/94ccfef1071cee24bbe7125d79704a504c41106a commit 94ccfef1071cee24bbe7125d79704a504c41106a Author: fs <fs@opera.com> Date: Thu Dec 15 09:46:08 2016 Ignore minimum font-size for SVG text In some circumstances, the minimum font-size would be applied to the "scaled font", messing up rendering. Because of how the font is scaled, this would trigger much less than one might expect. Change the useSmartMinimumForFontSize argument to the FontSize::getComputedSizeFromSpecifiedSize function to be about entirely ignoring the minimum font-sizes (this function only has two callsites.) Refactor LayoutSVGInlineText::computeNewScaledFontForStyle a bit to deal with this new flow. Also always keep the "original" font when we compute a scale factor of 0 - it should be invisible regardless. BUG= 232332 , 335725 , 475795 ,626936,664961 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Review-Url: https://codereview.chromium.org/2575863002 Cr-Commit-Position: refs/heads/master@{#438794} [add] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/LayoutTests/svg/text/minimum-font-size-not-applied-expected.html [add] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/LayoutTests/svg/text/minimum-font-size-not-applied.html [modify] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/Source/core/css/FontSize.cpp [modify] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/Source/core/css/FontSize.h [modify] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.cpp [modify] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInlineText.h [modify] https://crrev.com/94ccfef1071cee24bbe7125d79704a504c41106a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
,
Mar 9 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Mar 9 2018
Fixed?
,
Mar 10 2018
The original sample works, but the render/non-render point has just shifted. It now seems to be at 0.5. See: https://jsfiddle.net/3tqjewvo/4/ <svg width="500px" height="200px"> <defs> <clipPath id="clipper" clipPathUnits="objectBoundingBox"> <text id="test" x="0" y=".8" font-size="0.4999">H</text> <text id="test" x="0.5" y=".8" font-size="0.5">H</text> </clipPath> </defs> <rect width="500px" height="200px" fill="red" clip-path="url(#clipper)"></rect> </svg> IIRC the font-rendering code doesn't draw text whose font-size is < 0.5 pixels. So I maybe this is related to that? *** Also I noticed, that if you take the original fiddle (https://jsfiddle.net/3tqjewvo/) and zoom the page up to 150% or 175% (only those scales) the bottom of the glyphs are clipped. Should I file a bug for that?
,
Mar 12 2018
Yeah, presumably somewhere something is rounding (and concluding that font-size == 0)... Feel free to file a bug about the clipping of the glyphs.
,
Mar 12 2018
Thanks. Filed that issue as #820955. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by tkent@chromium.org
, Jul 11 2016