obf 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44736a323f88c6996ad1b669f4b6f9df4ee8a51a
4
- data.tar.gz: 4432293b3a3197d5f0542e576a673f09168f88b2
3
+ metadata.gz: 13d72d3a1108db429d2a7298c3ba99f5c745a28f
4
+ data.tar.gz: 853f4bacc4dd3f7b6d92d50fe7f01c8aedf9b0f6
5
5
  SHA512:
6
- metadata.gz: 3669f2ae9bc8864dd926c614a6d5d090b4056a3e013b08013a3ffdbc845e1c127fe92e6b11c4d675a12d1cc8c12d52c4fa570a6fdb8215080202d7d2146ade5f
7
- data.tar.gz: 6376f5ef17a123d6186608310eec61144fcd92e62570b74815b7468b2aabf0afbcdc63dbcf447626438be7f31016400836509b156c2756e6d5ee57044238ace2
6
+ metadata.gz: ca8ccd678f89aeb58f302b4965b87e76f68cc52f7996560ecbe77a2b2fc917be9627d78ec055e6aead76e7955d830eec098989ae978737fffd265491da55e69d
7
+ data.tar.gz: e8c10fd75ec8ed098b28f6488c3f3c7e13b305279bda8a200762d263863803203ffcf55b18dd3b6ff0380062107ba156b7b1a97358ce96fc796c3bb364f3412d
Binary file
data/lib/obf/pdf.rb CHANGED
@@ -39,6 +39,8 @@ module OBF::PDF
39
39
  :Title => obj['name']
40
40
  }
41
41
  )
42
+ font = opts['font'] || File.expand_path('../../TimesNewRoman.ttf', __FILE__)
43
+ pdf.font(font) if File.exists?(font)
42
44
 
43
45
 
44
46
  if obj['boards']
data/lib/obf/utils.rb CHANGED
@@ -157,17 +157,20 @@ module OBF::Utils
157
157
  return nil
158
158
  end
159
159
  file.close
160
- if extension && ['image/jpeg', 'image/jpg', 'image/gif'].include?(image['content_type']) && image['width'] && image['width'] < 1000 && image['width'] == image['height']
160
+ if extension && ['image/jpeg', 'image/jpg'].include?(image['content_type']) && image['width'] && image['width'] < 1000 && image['width'] == image['height']
161
161
  # png files need to be converted to make sure they don't have a transparent bg, or
162
162
  # else performance takes a huge hit.
163
- `cp #{file.path} #{file.path}.#{extension}`
164
- "#{file.path}.#{extension}"
163
+ `cp #{file.path} #{file.path}#{extension}`
164
+ "#{file.path}#{extension}"
165
165
  else
166
- # TODO: maybe convert to jpg instead of png?
167
- # see https://github.com/prawnpdf/prawn/issues/324
168
- # in that case, fill the image with a white background, perhaps?
169
166
  background ||= 'white'
170
- `convert #{file.path} -density 1200 -resize 200x200 -background "#{background}" -gravity center -extent 200x200 #{file.path}.jpg`
167
+ size = 400
168
+ if image['content_type'] && image['content_type'].match(/svg/) && background != 'white'
169
+ `convert -background none -density 300 -resize #{size}x#{size} -gravity center -extent #{size}x#{size} #{file.path} #{file.path}.png`
170
+ `convert #{file.path}.png -density 300 -resize #{size}x#{size} -background "#{background}" -gravity center -extent #{size}x#{size} #{file.path}.jpg`
171
+ else
172
+ `convert #{file.path} -density 300 -resize #{size}x#{size} -background "#{background}" -gravity center -extent #{size}x#{size} #{file.path}.jpg`
173
+ end
171
174
  "#{file.path}.jpg"
172
175
  end
173
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-12 00:00:00.000000000 Z
11
+ date: 2017-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -145,6 +145,7 @@ extra_rdoc_files:
145
145
  files:
146
146
  - LICENSE
147
147
  - README.md
148
+ - lib/TimesNewRoman.ttf
148
149
  - lib/obf.rb
149
150
  - lib/obf/avz.rb
150
151
  - lib/obf/external.rb