diff --git a/lib/ios_icon_generator/cli/commands/mask.rb b/lib/ios_icon_generator/cli/commands/mask.rb index 4db5eca..3db1c3f 100644 --- a/lib/ios_icon_generator/cli/commands/mask.rb +++ b/lib/ios_icon_generator/cli/commands/mask.rb @@ -39,8 +39,8 @@ class Icon < Hanami::CLI::Command option :symbol_color, default: '#7F0000', desc: 'The color of the symbol to use to generate the mask.' option :font, default: 'Helvetica', desc: 'The font to use to generate the symbol.' option :file, default: nil, desc: 'The path to an image representing the symbol to use to generate the mask.' - option :x_size_ratio, type: :float, default: 0.46, desc: 'The x offset of the size of the mask.' - option :y_size_ratio, type: :float, default: 0.46, desc: 'The y offset of the size of the mask.' + option :x_size_ratio, type: :float, default: 0.54, desc: 'The x offset of the size of the mask.' + option :y_size_ratio, type: :float, default: 0.54, desc: 'The y offset of the size of the mask.' option :size_offset, type: :float, default: 0.12, desc: 'The size offset to use when applying the symbol. 0.0 means it\'s scale to the full image, 1.0 means the symbol has the full size of the logo.' option :x_offset, type: :float, default: 0.11, desc: 'The x offset to use when applying the symbol. 0.0 means bottom, 1.0 means top.' option :y_offset, type: :float, default: 0.11, desc: 'The y offset to use when applying the symbol. 0.0 means left, 1.0 means top.' diff --git a/lib/ios_icon_generator/cli/commands/stub.rb b/lib/ios_icon_generator/cli/commands/stub.rb index 70c20ea..ecd6185 100644 --- a/lib/ios_icon_generator/cli/commands/stub.rb +++ b/lib/ios_icon_generator/cli/commands/stub.rb @@ -34,10 +34,10 @@ class Stub < Hanami::CLI::Command option :font, default: 'Helvetica', desc: 'The font to use to generate the symbol.' option :symbol_color, default: '#7F0000', desc: 'The color of the symbol to use to generate the mask.' option :stroke_color, default: '#000000', desc: 'The stroke color of the mask' - option :stroke_width_offset, type: :float, default: 0.1, desc: 'The width of the stroke used when generating the symbol.' + option :stroke_width_offset, type: :float, default: 0.0, desc: 'The width of the stroke used when generating the symbol.' option :size_offset, type: :float, default: 0.5, desc: 'The point size used for the symbol, relative to the height of the icon. Values over 0.5 are not recommended.' option :x_offset, type: :float, default: 0.0, desc: 'The x offset to use when applying the symbol. 0.0 means bottom, 1.0 means top.' - option :y_offset, type: :float, default: 0.0, desc: 'The y offset to use when applying the symbol. 0.0 means left, 1.0 means top.' + option :y_offset, type: :float, default: -0.05, desc: 'The y offset to use when applying the symbol. 0.0 means left, 1.0 means top.' option :type, type: :array, default: %w[iphone], desc: 'Which target to generate the icons for. Can be "iphone", "ipad", "watch", "mac" or "carplay" or a combination of any of them, or "imessage"' option :parallel_processes, type: :integer, default: -1, desc: 'Number of processes to use to process the files. Defaults to -1, meaning the number of cores the machine. \ Set to 0 to disable parallel processing.' diff --git a/lib/ios_icon_generator/helpers/generate_icon.rb b/lib/ios_icon_generator/helpers/generate_icon.rb index 4ffcd06..20c7060 100644 --- a/lib/ios_icon_generator/helpers/generate_icon.rb +++ b/lib/ios_icon_generator/helpers/generate_icon.rb @@ -130,7 +130,7 @@ def self.generate_icon(icon_path:, output_folder:, types:, parallel_processes: n }, } - File.write(File.join(appiconset_path, 'Contents.json'), JSON.generate(contents_json)) + File.write(File.join(appiconset_path, 'Contents.json'), JSON.pretty_generate(contents_json)) progress&.call(total - 1, total) end diff --git a/lib/ios_icon_generator/helpers/mask_icon.rb b/lib/ios_icon_generator/helpers/mask_icon.rb index a62558e..c172305 100644 --- a/lib/ios_icon_generator/helpers/mask_icon.rb +++ b/lib/ios_icon_generator/helpers/mask_icon.rb @@ -31,8 +31,8 @@ def self.mask_icon( symbol: 'b', symbol_color: '#7F0000', font: 'Helvetica', - x_size_ratio: 0.5478515625, - y_size_ratio: 0.5478515625, + x_size_ratio: 0.54, + y_size_ratio: 0.54, size_offset: 0.0, x_offset: 0.0, y_offset: 0.0, @@ -77,7 +77,7 @@ def self.mask_icon( draw_shape = case mask[:shape] when :triangle - "-draw \"polyline 0,#{mask_size_height} 0,#{height} #{width - mask_size_width},#{height}\"" + "-draw \"polyline -#{width},#{height - mask_size_height} 0,#{height - mask_size_height} #{mask_size_width},#{height} #{mask_size_width},#{height * 2.0} -#{width},#{height * 2.0}\"" when :square "-draw \"rectangle -#{width},#{height * 2.0} #{mask_size_height},#{width - mask_size_width}\"" else @@ -95,7 +95,7 @@ def self.mask_icon( image['filename'] = icon_output end - File.write(File.join(output_folder, 'Contents.json'), JSON.generate(json_content)) + File.write(File.join(output_folder, 'Contents.json'), JSON.pretty_generate(json_content)) end end end