Commit 1a55fa11 authored by RazrFalcon's avatar RazrFalcon

(usvg) Remove sequential ClosePath segments from paths.

parent b7329156
......@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `letter-spacing` and `word-spacing` support.
- Partial `baseline-shift` support.
- `TextSpan::baseline_shift`.
- Remove sequential ClosePath segments from paths.
### Changed
- Shapes without fill and stroke will no longer be removed.
......
......@@ -167,7 +167,11 @@ fn convert_path(mut path: svgdom::Path) -> Vec<tree::PathSegment> {
});
}
svgdom::PathSegment::ClosePath { .. } => {
new_path.push(tree::PathSegment::ClosePath);
if let Some(tree::PathSegment::ClosePath) = new_path.last() {
// Do not add sequential ClosePath segments.
} else {
new_path.push(tree::PathSegment::ClosePath);
}
}
}
......
......@@ -914,7 +914,7 @@ e-marker-040,6a3bc334
e-marker-041,26e4493e
e-marker-042,f22e88ce
e-marker-043,891c21fb
e-marker-044,20d81ba3
e-marker-044,573f599a
e-marker-045,c7de07f4
e-marker-046,670315d6
e-marker-047,eabb389c
......
......@@ -523,3 +523,29 @@ test!(keep_groups_with_id, true,
</g>
</svg>
");
test!(simplify_paths_1, false,
"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1 1'>
<path d='M 10 20 L 10 30 Z Z Z'/>
</svg>",
"<svg
xmlns='http://www.w3.org/2000/svg'
width='1'
height='1'
viewBox='0 0 1 1'
preserveAspectRatio='xMidYMid'
xmlns:usvg='https://github.com/RazrFalcon/usvg'
usvg:version='0.4.0'>
<defs/>
<path
fill='#000000'
fill-opacity='1'
fill-rule='nonzero'
stroke='none'
marker-end='none'
marker-mid='none'
marker-start='none'
visibility='visible'
d='M 10 20 L 10 30 Z'/>
</svg>
");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment