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

group-collapsing #215

Open
JoKalliauer opened this issue Oct 22, 2018 · 2 comments
Open

group-collapsing #215

JoKalliauer opened this issue Oct 22, 2018 · 2 comments

Comments

@JoKalliauer
Copy link

Running scour for InputOutput.svg.txt does not collapse groups.

scour -i InputOutput.svg.txt -o InputOutput.svg.txt

If I understand --disable-group-collapsing correctly then it should collapse groups by default.

Input=Output

InputOutput.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg viewBox="0 0 1e3 1e3" xmlns="http://www.w3.org/2000/svg">
 <g font-family="Liberation Sans,Arial,Helvetica,sans-serif">
  <g text-anchor="middle">
   <g font-weight="400">
    <g font-size="64">
     <text x="99" y="99">Text</text>
    </g>
   </g>
  </g>
 </g>
</svg>

desired output

whish.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg  PUBLIC '-//W3C//DTD SVG 1.1//EN'  'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg viewBox="0 0 1e3 1e3" xmlns="http://www.w3.org/2000/svg">
 <text x="99" y="99" font-family="Liberation Sans,Arial,Helvetica,sans-serif" font-size="64" font-weight="400" text-anchor="middle">Text</text>
</svg>

Or what does group collapsing mean? (maybe one example)

@Perhelion
Copy link

One group would be also ok. For groups and text there are much more optimizations possible, e.g. including anti-groups and full transformation resolution.

@Gibbz
Copy link

Gibbz commented Sep 6, 2019

Yes id love to see support for removing all groups where possible

nthykier added a commit to nthykier/scour that referenced this issue May 17, 2020
An optimization that prunes nested <g>-tags when they contain exactly
one <g> and nothing else (except whitespace nodes).  This looks a bit
like `removeNestedGroups` except it only touches <g> tags without
attributes (but can remove <g>-tags completely from a tree, whereas
this optimization always leaves at least one <g> tag behind).

Closes: scour-project#215
Signed-off-by: Niels Thykier <niels@thykier.net>
nthykier added a commit to nthykier/scour that referenced this issue May 18, 2020
An optimization that prunes nested <g>-tags when they contain exactly
one <g> and nothing else (except whitespace nodes).  This looks a bit
like `removeNestedGroups` except it only touches <g> tags without
attributes (but can remove <g>-tags completely from a tree, whereas
this optimization always leaves at least one <g> tag behind).

Closes: scour-project#215
Signed-off-by: Niels Thykier <niels@thykier.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants