[adwaita-icon-theme/wip/jimmac/inkscape1] symbolic: inkscape 1 compat



commit f3781f6ffe270531eea3ea1dc206603d4fdb19d2
Author: Jakub Steiner <jimmac gmail com>
Date:   Mon May 4 10:18:40 2020 +0200

    symbolic: inkscape 1 compat
    
    Untested verson of the render script working for Inkscape 1, based on
    help by Lukas.
    
    See https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/issues/57

 Adwaita/scalable/ui/pan-end-symbolic.svg | 42 +++++++++++++++++++++++++++++++-
 render-symbolic.rb                       | 28 +++++++++------------
 2 files changed, 52 insertions(+), 18 deletions(-)
---
diff --git a/Adwaita/scalable/ui/pan-end-symbolic.svg b/Adwaita/scalable/ui/pan-end-symbolic.svg
index 07169fe2..e3e88d22 100644
--- a/Adwaita/scalable/ui/pan-end-symbolic.svg
+++ b/Adwaita/scalable/ui/pan-end-symbolic.svg
@@ -1 +1,41 @@
-<svg xmlns="http://www.w3.org/2000/svg"; width="16" height="16"><path d="M6 13l5-5-5-5z" 
fill="#2e3436"/></svg>
\ No newline at end of file
+<?xml version='1.0' encoding='UTF-8' standalone='no'?>
+<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:dc='http://purl.org/dc/elements/1.1/' 
sodipodi:docname='pan-end-symbolic.svg' inkscape:export-filename='/home/sam/source-symbolic.png' 
inkscape:export-xdpi='270' inkscape:export-ydpi='270' height='16' id='svg7384' 
xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' 
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' 
xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' style='enable-background:new' 
xmlns:svg='http://www.w3.org/2000/svg' inkscape:version='1.0 (4035a4fb49, 2020-05-01)' version='1.1' 
width='16' xmlns='http://www.w3.org/2000/svg'>
+  <sodipodi:namedview inkscape:bbox-nodes='true' inkscape:bbox-paths='false' bordercolor='#000000' 
borderlayer='false' borderopacity='0.50196078' inkscape:current-layer='layer10' inkscape:cx='173.64778' 
inkscape:cy='-282.26913' inkscape:document-rotation='0' gridtolerance='10' inkscape:guide-bbox='true' 
guidetolerance='10' id='namedview88' inkscape:measure-end='0,0' inkscape:measure-start='0,0' 
inkscape:object-nodes='true' inkscape:object-paths='true' objecttolerance='10' pagecolor='#e2e2e2' 
inkscape:pageopacity='0' inkscape:pageshadow='2' showborder='false' showgrid='false' showguides='false' 
inkscape:showpageshadow='false' inkscape:snap-bbox='true' inkscape:snap-bbox-edge-midpoints='false' 
inkscape:snap-bbox-midpoints='true' inkscape:snap-center='false' inkscape:snap-global='true' 
inkscape:snap-grids='true' inkscape:snap-intersection-paths='false' inkscape:snap-midpoints='true' 
inkscape:snap-nodes='true' inkscape:snap-object-midpoints='true' inkscape:snap-others='true' inkscape:sn
 ap-page='false' inkscape:snap-smooth-nodes='true' inkscape:snap-to-guides='true' 
inkscape:window-height='1205' inkscape:window-maximized='0' inkscape:window-width='1553' 
inkscape:window-x='26' inkscape:window-y='23' inkscape:zoom='1'>
+    <inkscape:grid color='#000000' dotted='false' empcolor='#0800ff' empopacity='0.4627451' empspacing='4' 
enabled='true' id='grid4866' opacity='0.16470588' originx='-112.00585' originy='-951.99999' 
snapvisiblegridlinesonly='true' spacingx='1' spacingy='1' type='xygrid' visible='true'/>
+    <inkscape:grid dotted='true' empcolor='#3f3fff' empopacity='0' empspacing='4' id='grid3540' 
originx='-112.00585' originy='-951.99999' spacingx='0.5' spacingy='0.5' type='xygrid'/>
+  </sodipodi:namedview>
+  <metadata id='metadata90'>
+    <rdf:RDF>
+      <cc:Work rdf:about=''>
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>
+        <dc:title>Gnome Symbolic Icons</dc:title>
+        <cc:license rdf:resource='http://creativecommons.org/licenses/by-sa/4.0/'/>
+      </cc:Work>
+      <cc:License rdf:about='http://creativecommons.org/licenses/by-sa/4.0/'>
+        <cc:permits rdf:resource='http://creativecommons.org/ns#Reproduction'/>
+        <cc:permits rdf:resource='http://creativecommons.org/ns#Distribution'/>
+        <cc:requires rdf:resource='http://creativecommons.org/ns#Notice'/>
+        <cc:requires rdf:resource='http://creativecommons.org/ns#Attribution'/>
+        <cc:permits rdf:resource='http://creativecommons.org/ns#DerivativeWorks'/>
+        <cc:requires rdf:resource='http://creativecommons.org/ns#ShareAlike'/>
+      </cc:License>
+    </rdf:RDF>
+  </metadata>
+  <title id='title8473'>Gnome Symbolic Icons</title>
+  <defs id='defs7386'/>
+  <g inkscape:groupmode='layer' id='layer10' inkscape:label='ui' 
transform='translate(-112.00585,-951.99999)'>
+    <path inkscape:connector-curvature='0' d='m 118.00585,964.99999 5,-5 -5,-5 z' id='path6412' 
sodipodi:nodetypes='cccc' style='fill:#2e3436;fill-opacity:1;stroke:none'/>
+    
+  </g>
+  <g inkscape:groupmode='layer' id='layer1' inkscape:label='status' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer11' inkscape:label='legacy' 
transform='translate(-112.00585,-951.99999)'/>
+  <g inkscape:groupmode='layer' id='layer7' inkscape:label='places' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer6' inkscape:label='mimetypes' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer5' inkscape:label='emotes' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer9' inkscape:label='emblems' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer2' inkscape:label='devices' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer8' inkscape:label='categories' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer3' inkscape:label='apps' 
transform='translate(-112.00585,-887.99999)'/>
+  <g inkscape:groupmode='layer' id='layer4' inkscape:label='actions' 
transform='translate(-112.00585,-887.99999)'/>
+</svg>
diff --git a/render-symbolic.rb b/render-symbolic.rb
index 9cb28dd4..8cbfc8c1 100755
--- a/render-symbolic.rb
+++ b/render-symbolic.rb
@@ -22,29 +22,23 @@ def chopSVG(icon)
                FileUtils.cp(SRC,icon[:file]) 
                puts " >> #{icon[:name]}"
                # extract the icon
-               cmd = "#{INKSCAPE} -f #{icon[:file]} "
-               cmd += "--select #{icon[:id]} --verb=FitCanvasToSelection --verb=EditInvertInAllLayers 
--verb=EditDelete " # delete everything but the icon
-               cmd += "--verb=FileVacuum --verb=FileSave --verb=FileQuit > /dev/null 2>&1"
+               cmd = "#{INKSCAPE} -g #{icon[:file]} --select #{icon[:id]} 
--verb=\"FitCanvasToSelection;EditInvertInAllLayers"
+               cmd += 
";EditDelete;EditSelectAll;SelectionUnGroup;SelectionUnGroup;SelectionUnGroup;StrokeToPath;FileVacuum"
+               cmd += ";FileSave;FileClose;\"" #won't actually close window
                system(cmd)
                # remove bounding rectangle
+               #bounding rectangle is now a path. needs to be removed
                svgcrop = Document.new(File.new(icon[:file], 'r'))
-               svgcrop.root.each_element("//rect") do |rect| 
-                       w = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #get rid of 16 vs 
15.99999 
-                       h = ((rect.attributes["width"].to_f * 10).round / 10.0).to_i #Inkscape bugs
-                       if w == 16 && h == 16
-                               rect.remove
-                       end
-               end
+               svgcrop.root.each_element("//path") do |path|
+           puts(path.attributes['style'])
+           if path.attributes['style'].include? 'fill:none;'
+                   puts "DEBUG: found rect to remove #{path}"
+                   path.remove
+           end
+    end
                icon_f = File.new(icon[:file],'w+')
                icon_f.puts svgcrop
                icon_f.close
-               # convert any strokes and objects to paths
-               cmd = "#{INKSCAPE} -f #{icon[:file]} --verb=EditSelectAll --verb=SelectionUnGroup 
--verb=SelectionUnGroup --verb=SelectionUnGroup --verb=ObjectToPath --verb=StrokeToPath "
-               cmd += "--verb=FileSave --verb=FileQuit > /dev/null 2>&1"
-               system(cmd)
-               # save as plain SVG
-               cmd = "#{INKSCAPE} -f #{icon[:file]} -z --vacuum-defs --export-plain-svg=#{icon[:file]} > 
/dev/null 2>&1"
-               system(cmd)
                # remove as many extraneous elements as possible with SVGO
                cmd = "#{SVGO} --pretty --disable=convertShapeToPath --disable=convertPathData 
--enable=removeStyleElement -i #{icon[:file]} -o  #{icon[:file]} > /dev/null 2>&1"
                system(cmd)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]