lib/frameit/editor.rb in frameit-2.6.2 vs lib/frameit/editor.rb in frameit-2.7.0

- old
+ new

@@ -140,10 +140,16 @@ end background end def put_device_into_background(background) + show_complete_frame = fetch_config['show_complete_frame'] + if show_complete_frame + max_height = background.height - top_space_above_device + image.resize "x#{max_height}>" + end + left_space = (background.width / 2.0 - image.width / 2.0).round @image = background.composite(image, "png") do |c| c.compose "Over" c.geometry "+#{left_space}+#{top_space_above_device}" @@ -177,11 +183,11 @@ ratio = (sum_width + keyword_padding * 2) / image.width.to_f if ratio > 1.0 # too large - resizing now smaller = (1.0 / ratio) - UI.message "Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}" if $verbose + UI.verbose("Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}") title.resize "#{(smaller * title.width).round}x" keyword.resize "#{(smaller * keyword.width).round}x" if keyword sum_width *= smaller end @@ -233,12 +239,12 @@ i.resize "#{max_width * 5.0}x#{image_height}!" # `!` says it should ignore the ratio end current_font = font(key) text = fetch_text(key) - UI.message "Using #{current_font} as font the #{key} of #{screenshot.path}" if $verbose and current_font - UI.message "Adding text '#{text}'" if $verbose + UI.verbose("Using #{current_font} as font the #{key} of #{screenshot.path}") if current_font + UI.verbose("Adding text '#{text}'") text.gsub! '\n', "\n" # Add the actual title title_image.combine_options do |i| @@ -279,11 +285,11 @@ return result.last if result end # No string files, fallback to Framefile config result = fetch_config[type.to_s]['text'] if fetch_config[type.to_s] - UI.message "Falling back to default text as there was nothing specified in the .strings file" if $verbose + UI.verbose("Falling back to default text as there was nothing specified in the .strings file") if type == :title and !result # title is mandatory UI.user_error! "Could not get title for screenshot #{screenshot.path}. Please provide one in your Framefile.json" end @@ -305,16 +311,16 @@ return font["font"] end end else # No `supported` array, this will always be true - UI.message "Found a font with no list of supported languages, using this now" if $verbose + UI.verbose("Found a font with no list of supported languages, using this now") return font["font"] end end end - UI.message "No custom font specified for #{screenshot}, using the default one" if $verbose + UI.verbose("No custom font specified for #{screenshot}, using the default one") return nil end end end