New issue
Advanced search Search tips

Issue 643265 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocking:
issue 643297



Sign in to add a comment

[vector icons] Add support for rendering 'S' cubic Bezier curve path type

Project Member Reported by tdander...@chromium.org, Sep 1 2016

Issue description

The Skiafy script (http://evanstade.github.io/skiafy/) outputs ???, ??? as the first control point of a cubic Bezier curve corresponding to the SVG 'S' path command. This is because the control point needs to be computed as the reflection of the second control point on the previous command relative to the current point (refer to the SVG path spec for further details: https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands). As a result, manual computation is required to find the missing point.
 
Blocking: 643297
Besides 'S', the Skiafy script also can't handle svg node <g> (see the SVGs provided by tdanderson@ in bug 642385). It outputs:

<g> with a transform not handled
Did you use SVGO/SVGOMG? Most of the time that will get rid of the transforms.
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 7 2016

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

commit 9bcbbd3b5ffe60e191a92ff7cabde7cf3aac4502
Author: tdanderson <tdanderson@chromium.org>
Date: Wed Sep 07 18:04:52 2016

Add support for CUBIC_TO_S for rendering vector icons

Add support for the vector icon drawing command
CUBIC_TO_S, which will correspond to the SVG
path command 'S'. This new command computes
its implicit first control point by using
information about the current point and the
second control point on the previous command.

BUG= 643265 
TEST=manual

Review-Url: https://codereview.chromium.org/2307533003
Cr-Commit-Position: refs/heads/master@{#416996}

[modify] https://crrev.com/9bcbbd3b5ffe60e191a92ff7cabde7cf3aac4502/ui/gfx/paint_vector_icon.cc
[modify] https://crrev.com/9bcbbd3b5ffe60e191a92ff7cabde7cf3aac4502/ui/gfx/vector_icon_types.h

Cc: azurewei@chromium.org
Now that the CL in #5 has landed, you can manually replace the Skiafy output:

CUBIC_TO, ???, ???, 20.18f, 0, 13, 0,

with:

CUBIC_TO_SHORTHAND, 20.18f, 0, 13, 0,

and that curve will render correctly. I will be making a change to the Skiafy script to do this automatically so that no manual intervention is needed.

Also, azurewei@: ping on comment #4. Do you still encounter problems even after running the provided .svgs through svgo?
Svgo tool seems can't open the svg file with <g> flags. I just removed all the <g> flags and get the rendered vector icons with Skiafy. Thanks!

Comment 8 by est...@chromium.org, Sep 19 2016

svgo can handle <g> tags

Comment 9 by j...@beddoes.com, Sep 29 2016

It appears that the CUBIC_TO_SHORTHAND fix is not supported by Chromium v53 which is the version we are for an application of ours. Could someone clarify a) which version of Chromium supports the new fix and b) how to manually calculate the missing point manually in the meantime?
The fix is in version 55, and to be able to manually compute the missing coordinates please refer to the SVG spec here: https://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands

Comment 11 by j...@beddoes.com, Sep 29 2016

Incidentally, it seems the main cause for the ???, ??? issue is by running it through Jake's SVG optimiser and toggling the "Remove hidden elements" option. By ignoring this option, the optimised SVG image no longer produced ??? in the Skiafy output. Hope this helps whoever is reading :)
that's probably just a coincidence. I don't think that would consistently fix the problem. It crops up with or without svgo(mg).
Labels: -Proj-MaterialDesign-NativeUI -Proj-MaterialDesign-CrOS
Labels: -M-55
Status: Assigned (was: Started)
I updated the skiafy tool to use CUBIC_TO_SHORTHAND instead of the question marks. Can we mark this fixed?
Labels: M-62
Owner: est...@chromium.org
Status: Fixed (was: Assigned)
Yep, thanks a lot for updating.

Sign in to add a comment