Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting simple shapes (rect, arc, line, polyline, polygone) to path elements and merging. #96

Closed
redscorpix opened this issue Feb 10, 2013 · 7 comments
Assignees

Comments

@redscorpix
Copy link

Input:
<rect x="2" y="2" fill="#FFFFFF" width="2" height="2"/>
<rect x="2" y="6" fill="#FFFFFF" width="2" height="2"/>
<rect x="2" y="10" fill="#FFFFFF" width="2" height="2"/>
Paths:
<path fill="#fff" d="M2,2 h2 v2 h-2z"/>
<path fill="#fff" d="M2,6 h2 v2 h-2z"/>
<path fill="#fff" d="M2,10 h2 v2 h-2z"/>
Output:
<path fill="#fff" d="M2,2 h2 v2 h-2z M2,6 h2 v2 h-2z M2,10 h2 v2 h-2z"/>

@ghost ghost assigned deepsweet Feb 13, 2013
@puzrin
Copy link

puzrin commented May 16, 2013

I joint to this request. Especially interested in polyline conversion - this type of content happens sometime in sources, provided to fontello project.

@voltidev
Copy link

@bcherny
Copy link

bcherny commented May 19, 2014

@deepsweet is this actually fixed? running through the default 0.4.4 config,

input:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     width="16px" height="16px" viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<path display="none" fill="#231F20" d="M8,15L3,7h10L8,15z M3,5h10V3H3V5z"/>
<g>
    <polygon fill="#231F20" points="9.375,6.378 9.375,2.268 6.625,2.268 6.625,6.378 3.5,6.378 8,11.268 12.5,6.378   "/>
    <line fill="#231F20" stroke="#231F20" stroke-width="2" stroke-miterlimit="10" x1="13" y1="13.142" x2="3" y2="13.142"/>
</g>
<g display="none">
    <polygon display="inline" fill="#231F20" points="6.625,9.889 6.625,14 9.375,14 9.375,9.889 12.5,9.889 8,5 3.5,9.889     "/>

        <line display="inline" fill="#231F20" stroke="#231F20" stroke-width="2" stroke-miterlimit="10" x1="3" y1="3.125" x2="13" y2="3.125"/>
</g>
</svg>

output:

<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><g fill="#231F20"><path d="M9.375 6.378v-4.11h-2.75v4.11h-3.125l4.5 4.89 4.5-4.89z"/><path stroke="#231F20" stroke-width="2" stroke-miterlimit="10" d="M13 13.142h-10"/></g></svg>

or is svg unable to rewrite + merge the second path?

@vedran-milic
Copy link

Is it possible to turn this feature off?

@derhuerst
Copy link

@vedran-milic Run svgo with --disable convertShapeToPath.

@vedran-milic
Copy link

@derhuerst Thanks

@JoKalliauer
Copy link

Is it posible to convert it the other way round:

I want to convert <path to <rect because ìn Inkscape <flowRoot> only works with rect properly but not with path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants