frameit 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34bc47b3efb69420fd5270e798ba713a9b948af4
4
- data.tar.gz: 8158ee167427955839b53705c4787102cd104547
3
+ metadata.gz: 0386691d3d975aaa1470d94950208b4f086d776b
4
+ data.tar.gz: a7ae4164557057c19324728f3a0ba5883e81cdac
5
5
  SHA512:
6
- metadata.gz: d0279c2c77228a3e5bae1bbe84c05338864efca6eb13e63c29eae7b50c0f6d7d20b1b873045c7b9ea557fe0fea2451803aba2873b893eed0bad37f8366044498
7
- data.tar.gz: 9bfde1c00507c0521a440a464d23b9d4d73bebc36525829f65b48edba521ddff4e46f039d4ba8ae6ce1e45d0a62e05c9a20af93fb534d9e8428a638a299a52f8
6
+ metadata.gz: 9f2afb9854ac5040fb8fec9ade1a5e073d8e002a02be5aa715638a5f2ad4f69e375cad43b77c74cef24c7da8e24f11c2e8d3e316482055e14e466618f163a6e8
7
+ data.tar.gz: afdb2af3b99176e503fedb2910bccd7a477e6900e8b3e2fbaff64d884792002c303025ec40d9f8d65a1bfb82335627fb871a81044d1cea026966ca1c4a029138
data/README.md CHANGED
@@ -6,11 +6,11 @@
6
6
  </a>
7
7
  </h3>
8
8
  <p align="center">
9
- <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
- <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
- <b>frameit</b> &bull;
12
- <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
- <a href="https://github.com/fastlane/sigh">sigh</a> &bull;
9
+ <a href="https://github.com/fastlane/deliver">deliver</a> &bull;
10
+ <a href="https://github.com/fastlane/snapshot">snapshot</a> &bull;
11
+ <b>frameit</b> &bull;
12
+ <a href="https://github.com/fastlane/pem">pem</a> &bull;
13
+ <a href="https://github.com/fastlane/sigh">sigh</a> &bull;
14
14
  <a href="https://github.com/fastlane/produce">produce</a> &bull;
15
15
  <a href="https://github.com/fastlane/cert">cert</a> &bull;
16
16
  <a href="https://github.com/fastlane/spaceship">spaceship</a> &bull;
@@ -41,10 +41,10 @@ Get in contact with the developer on Twitter: [@FastlaneTools](https://twitter.c
41
41
 
42
42
  -------
43
43
  <p align="center">
44
- <a href="#features">Features</a> &bull;
45
- <a href="#installation">Installation</a> &bull;
46
- <a href="#usage">Usage</a> &bull;
47
- <a href="#tips">Tips</a> &bull;
44
+ <a href="#features">Features</a> &bull;
45
+ <a href="#installation">Installation</a> &bull;
46
+ <a href="#usage">Usage</a> &bull;
47
+ <a href="#tips">Tips</a> &bull;
48
48
  <a href="#need-help">Need help?</a>
49
49
  </p>
50
50
 
@@ -101,7 +101,7 @@ You only have to do this once per computer.
101
101
  - Press ```Enter```
102
102
  - Unzip and move the content of the zip files to ```~/.frameit/devices_frames```
103
103
  - Press ```Enter```
104
-
104
+
105
105
  # Usage
106
106
 
107
107
  Why should you have to use Photoshop, just to add a frame around your screenshots?
@@ -113,7 +113,7 @@ Just navigate to your folder of screenshots and use the following command:
113
113
  To use the silver version of the frames:
114
114
 
115
115
  frameit silver
116
-
116
+
117
117
  To run the setup process again to add new frames use:
118
118
 
119
119
  frameit setup
@@ -122,7 +122,7 @@ When using `frameit` without titles on top, the screenshots will have the full r
122
122
 
123
123
  # Titles and Background (optional)
124
124
 
125
- With `frameit` 2.0 you are now able to add a custom background, title and text colors to your screenshots.
125
+ With `frameit` 2.0 you are now able to add a custom background, title and text colors to your screenshots. Optionally you can also set a custom font size.
126
126
 
127
127
  A working example can be found in the [fastlane examples](https://github.com/fastlane/examples/tree/master/MindNode/screenshots) project.
128
128
 
@@ -239,7 +239,7 @@ Check out the [MindNode example project](https://github.com/fastlane/examples/tr
239
239
  - [`cert`](https://github.com/fastlane/cert): Automatically create and maintain iOS code signing certificates
240
240
  - [`spaceship`](https://github.com/fastlane/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
241
241
  - [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
242
- - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
242
+ - [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
243
243
  - [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
244
244
  - [`scan`](https://github.com/fastlane/scan): The easiest way to run tests of your iOS and Mac app
245
245
  - [`match`](https://github.com/fastlane/match): Easily sync your certificates and profiles across your team using git
@@ -5,8 +5,6 @@ module Frameit
5
5
  attr_accessor :image # the current image used for editing
6
6
  attr_accessor :top_space_above_device
7
7
 
8
- FONT_SIZE_REFERENCE_WIDTH = 640.0 # The size of device a, e.g. "12px" is defined for
9
-
10
8
  def frame!(screenshot)
11
9
  self.screenshot = screenshot
12
10
  prepare_image
@@ -174,22 +172,18 @@ module Frameit
174
172
  sum_width = title.width
175
173
  sum_width += keyword.width + keyword_padding if keyword
176
174
 
177
- # Only resize if we haven't specified a custom font size
178
- font_size = font_size('title')
179
- if font_size.nil?
180
- # Resize the 2 labels if necessary
181
- smaller = 1.0 # default
182
- ratio = (sum_width + keyword_padding * 2) / image.width.to_f
183
- if ratio > 1.0
184
- # too large - resizing now
185
- smaller = (1.0 / ratio)
186
-
187
- UI.message "Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}" if $verbose
188
-
189
- title.resize "#{(smaller * title.width).round}x"
190
- keyword.resize "#{(smaller * keyword.width).round}x" if keyword
191
- sum_width *= smaller
192
- end
175
+ # Resize the 2 labels if necessary
176
+ smaller = 1.0 # default
177
+ ratio = (sum_width + keyword_padding * 2) / image.width.to_f
178
+ if ratio > 1.0
179
+ # too large - resizing now
180
+ smaller = (1.0 / ratio)
181
+
182
+ UI.message "Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}" if $verbose
183
+
184
+ title.resize "#{(smaller * title.width).round}x"
185
+ keyword.resize "#{(smaller * keyword.width).round}x" if keyword
186
+ sum_width *= smaller
193
187
  end
194
188
 
195
189
  vertical_padding = vertical_frame_padding
@@ -216,13 +210,13 @@ module Frameit
216
210
  background
217
211
  end
218
212
 
219
- def derived_font_size
213
+ def actual_font_size
220
214
  [@image.width / 10.0].max.round
221
215
  end
222
216
 
223
217
  # The space between the keyword and the title
224
218
  def keyword_padding
225
- (derived_font_size / 2.0).round
219
+ (actual_font_size / 2.0).round
226
220
  end
227
221
 
228
222
  # This will build 2 individual images with the title, which will then be added to the real image
@@ -240,7 +234,6 @@ module Frameit
240
234
  end
241
235
 
242
236
  current_font = font(key)
243
- custom_font_size = font_size(key)
244
237
  text = fetch_text(key)
245
238
  UI.message "Using #{current_font} as font the #{key} of #{screenshot.path}" if $verbose and current_font
246
239
  UI.message "Adding text '#{text}'" if $verbose
@@ -251,12 +244,7 @@ module Frameit
251
244
  title_image.combine_options do |i|
252
245
  i.font current_font if current_font
253
246
  i.gravity "Center"
254
- if custom_font_size
255
- i.pointsize custom_font_size
256
- UI.message "Using custom font size #{custom_font_size}" if $verbose
257
- else
258
- i.pointsize derived_font_size
259
- end
247
+ i.pointsize actual_font_size
260
248
  i.draw "text 0,0 '#{text}'"
261
249
  i.fill fetch_config[key.to_s]['color']
262
250
  end
@@ -328,36 +316,5 @@ module Frameit
328
316
  UI.message "No custom font specified for #{screenshot}, using the default one" if $verbose
329
317
  return nil
330
318
  end
331
-
332
- def scaled_font_size(font_size)
333
- font_ratio = font_size / FONT_SIZE_REFERENCE_WIDTH
334
- return (font_ratio * screenshot.size[0].to_f).round
335
- end
336
-
337
- # The fontSize we want to use
338
- def font_size(key)
339
- single_font_size = fetch_config[key.to_s]['fontSize']
340
- return single_font_size if single_font_size
341
-
342
- fonts = fetch_config[key.to_s]['fonts']
343
- if fonts
344
- fonts.each do |font|
345
- if font['supported']
346
- font['supported'].each do |language|
347
- if screenshot.path.include? language
348
- return scaled_font_size(font["fontSize"])
349
- end
350
- end
351
- else
352
- # No `supported` array, this will always be true
353
- UI.message "Found a fontSize with no list of supported languages, using this now" if $verbose
354
- return scaled_font_size(font["fontSize"])
355
- end
356
- end
357
- end
358
-
359
- UI.message "No custom fontSize specified for #{screenshot}, using the default one" if $verbose
360
- return nil
361
- end
362
319
  end
363
320
  end
@@ -1,3 +1,3 @@
1
1
  module Frameit
2
- VERSION = "2.5.0"
2
+ VERSION = "2.5.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frameit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause