From e7d4e9525e6bfbd1223a8a9e15e30c488953d587 Mon Sep 17 00:00:00 2001 From: Jakub Steiner Date: Mon, 3 May 2021 21:06:20 +0200 Subject: [PATCH] icons: Symbolic Preview library - assemble icon assets into a new sheet, based on our 2021 tooling. See https://blog.jimmac.eu/2021/how-to-symbolic/ --- data/icons/src/README.md | 4 + data/icons/src/org.gnome.Builder.svg | 2691 ++++++++++++++++++++++++++ data/icons/src/render-symbolic.rb | 101 - 3 files changed, 2695 insertions(+), 101 deletions(-) create mode 100644 data/icons/src/README.md create mode 100644 data/icons/src/org.gnome.Builder.svg delete mode 100755 data/icons/src/render-symbolic.rb diff --git a/data/icons/src/README.md b/data/icons/src/README.md new file mode 100644 index 000000000..7ec4fb5bf --- /dev/null +++ b/data/icons/src/README.md @@ -0,0 +1,4 @@ +Symbolic Icon Howto + +Use [Symbolic Preview](https://flathub.org/apps/details/org.gnome.design.SymbolicPreview) to render the icons. [Read more about the process](https://blog.jimmac.eu/2021/how-to-symbolic/). + diff --git a/data/icons/src/org.gnome.Builder.svg b/data/icons/src/org.gnome.Builder.svg new file mode 100644 index 000000000..d0099ca02 --- /dev/null +++ b/data/icons/src/org.gnome.Builder.svg @@ -0,0 +1,2691 @@ + + + + + + + + + + image/svg+xml + + + + + + + Symbolic Icons + + Each Inkscape layer will become the output context. Icons are composed of a group that contains a 16x16px rectangle object. Duplicate it and enter the group with to edit. As the bounding box is set to no-stroke, no-fill you will find it useful to work in outline view mode. + + Ctrl + Enter + To name an icon, use Object Properties and set its title. Label attribute holds space separated keywords used for search. Color of the icon doesn't matter as all of them recolor at run time. + + builder-split-tab + + + + + + + builder-split-tab-left + + + + + + + builder-split-tab-right + + + + + + + builder-move-right + + + + + builder-move-left + + + + + builder-view-bottom-pane + + + + + + builder-view-right-pane + + + + + + builder-view-left-pane + + + + + + builder-build-configure + + + + + + builder-documentation + + + + + + + builder-editor + + + + + + + + builder-unit-tests + + + + + + + builder-unit-tests-pass + + + + + + + builder-unit-tests-fail + + + + + builder-unit-tests-running + + + + + + builder-build + + + + + builder-debugger + + + + + builder-vcs-git + + + + + debug-step-in + + + + + + debug-step-out + + + + + + debug-step-over + + + + + + debug-execute-to-cursor + + + + + + debug-execute-from-cursor + + + + + + debug-continue + + + + + completion-word + + + + + debug-breakpoint + + + + + completion-snippet + + + + + + + + + + + + + + + + ui-item + + + + + ui-object + + + + + + + ui-menu + + + + + + + + + + + + ui-submenu + + + + + + + + + + + + ui-style + + + + + ui-section + + + + + + ui-child + + + + + + + + + + ui-packing + + + + + + + + + + + + + + + + + ui-property + + + + + + + + ui-template + + + + + + ui-attributes + + + + + + + ui-signal + + + + + + + ui-object-alt + + + + + + ui-property-alt + + + + + + ui-attributes-alt + + + + + + + ui-template-alt + + + + + + + ui-signal-alt + + + + + + + + + + + ui-packing-alt + + + + + + ui-style-alt + + + + + + ui-section-alt + + + + + + ui-submenu-alt + + + + + + ui-menu-alt + + + + + + ui-item-alt + + + + + + lang-function + + + + + + + + lang-typedef + + + + + lang-include + + + + + lang-define + + + + + lang-class + + + + + + + lang-method + + + + + + + + lang-enum + + + + + lang-enum-value + + + + + lang-struct + + + + + lang-struct-field + + + + + lang-variable + + + + + lang-union + + + + + + lang-namespace + + + + + + + + + + + + + + + text-x-changelog + + + + + + + + + + text-x-copying + + + + + + text-sql + + + + + + + + + text-x-cpp + + + + + + text-markdown + + + + + application-x-php + + + + + + + text-html + + + + + + + text-x-script + + + + + + text-x-csrc + + + + + text-css + + + + + + text-x-python + + + + + + + text-x-ruby + + + + + + + + text-x-chdr + + + + + + text-x-vala + + + + + text-x-javascript + + + + + + + + text-rust + + + + + + + + + + + + + + + + + + + + + + text-x-authors + + + + + + + + text-x-readme + + + + + + + + + org.gnome.Builder + + + + + + + diff --git a/data/icons/src/render-symbolic.rb b/data/icons/src/render-symbolic.rb deleted file mode 100755 index 71ccdb37e..000000000 --- a/data/icons/src/render-symbolic.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env ruby - -require "rexml/document" -require "fileutils" -include REXML - - -INKSCAPE = 'flatpak run org.inkscape.Inkscape' -# INKSCAPE = '/usr/bin/inkscape' -SRC = "symbolic.svg" -PREFIX = "../hicolor/scalable" - -# SVGO is a Node.js SVG optimization tool install with 'sudo npm install -g svgo' -# script will skip if SVGO is not present -SVGO = '/usr/bin/svgo' - -def chopSVG(icon) - FileUtils.mkdir_p(icon[:dir]) unless File.exists?(icon[:dir]) - unless (File.exists?(icon[:file]) && !icon[:forcerender]) - 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" - system(cmd) - # remove bounding rectangle - 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 - 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 -i #{icon[:file]} -o #{icon[:file]} > /dev/null 2>&1" - system(cmd) - else - puts " -- #{icon[:name]} already exists" - end -end #end of function - -def get_output_filename(d,n) - if (/rtl$/.match(n)) - outfile = "#{d}/#{n.chomp('-rtl')}-symbolic-rtl.svg" - else - outfile = "#{d}/#{n}-symbolic.svg" - end - return outfile -end - -#main -# Open SVG file. -svg = Document.new(File.new(SRC, 'r')) - -if (ARGV[0].nil?) #render all SVGs - puts "Rendering from icons in #{SRC}" - # Go through every layer. - svg.root.each_element("/svg/g[@inkscape:groupmode='layer']") do |context| - context_name = context.attributes.get_attribute("inkscape:label").value - puts "Going through layer '" + context_name + "'" - context.each_element("g") do |icon| - #puts "DEBUG #{icon.attributes.get_attribute('id')}" - dir = "#{PREFIX}/#{context_name}" - icon_name = icon.attributes.get_attribute("inkscape:label").value - # prevent rendering of icons ending in : - if icon_name.end_with?("-alt") - puts " ++ skipping icon '" + icon_name + "'" - else - chopSVG({ :name => icon_name, - :id => icon.attributes.get_attribute("id"), - :dir => dir, - :file => get_output_filename(dir, icon_name)}) - end - end - end - puts "\nrendered all SVGs" -else #only render the icons passed - icons = ARGV - ARGV.each do |icon_name| - icon = svg.root.elements["//g[@inkscape:label='#{icon_name}']"] - dir = "#{PREFIX}/#{icon.parent.attributes['inkscape:label']}" - chopSVG({ :name => icon_name, - :id => icon.attributes["id"], - :dir => dir, - :file => get_output_filename(dir, icon_name), - :forcerender => true}) - end - puts "\nrendered #{ARGV.length} icons" -end \ No newline at end of file -- GitLab