obf 0.9.8.36 → 0.9.9.1

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
  SHA256:
3
- metadata.gz: 643f357ab48bdd49d04a5769707fec92e9b6c924ba551cbbcf65ba136b945e40
4
- data.tar.gz: d98c4a91aa881bdeee22e1563b3aafb7c036050b2b4a83379ff47fdea5b56687
3
+ metadata.gz: 2516fbb23f12e3378fa47cc3c61cae145104a2c2595022db3026c26e944f4a12
4
+ data.tar.gz: b5087e0ee7223306ba60ce4503b3293f3e0dfe8e3de2f206e3f31d833ed349be
5
5
  SHA512:
6
- metadata.gz: 9f86ae672f6c60077c5927271dfc2eb1fc020bd39eac7b0f2dc2f638f47608df541ead763c8e8a68d34cf7de5e130190f767f4a0e900edd90051a0f45d8d2364
7
- data.tar.gz: 735e978e4a00b66f0f032d570936d86eed0741ed44dc04b7a0716e86070ab728f6b811f8abf6726d850caba9d21cb919b1ff16cc618a6f5f7d3d90472d216b13
6
+ metadata.gz: 274d446b05caab4279d2a9acb563e7322b8e57521a9c2da386daa0da50057ee4f96b5d07cb1f832b012a60add50c08db803c894fbd6a6770bcf5831b3fbf08fb
7
+ data.tar.gz: 67bfaba475aaa1c882e3a0b705790f26b9fe90bd94cfeb77468f329404b20e7d1f0a78593c5181449dc6b4ccd82a06fcaec05b9767d7e5cc810bfaa8f713b45f
Binary file
data/lib/obf/external.rb CHANGED
@@ -149,6 +149,8 @@ module OBF::External
149
149
  'width' => original_image['width'],
150
150
  'height' => original_image['height'],
151
151
  'license' => OBF::Utils.parse_license(original_image['license']),
152
+ 'protected' => original_image['protected'],
153
+ 'protected_source' => original_image['protected_source'],
152
154
  'url' => original_image['url'],
153
155
  'data' => original_image['data'],
154
156
  'data_url' => original_image['data_url'],
@@ -172,7 +174,7 @@ module OBF::External
172
174
  image['height'] ||= path_hash['images'][image['id']]['height']
173
175
  else
174
176
  image_fetch = OBF::Utils.image_raw(image['data'] || image['url'])
175
- if image_fetch
177
+ if image_fetch && image_fetch['data']
176
178
  if !image['content_type'] || !image['width'] || !image['height']
177
179
  attrs = OBF::Utils.image_attrs(image_fetch['data'])
178
180
  image['content_type'] ||= image_fetch['content_type'] || attrs['content_type']
@@ -202,6 +204,8 @@ module OBF::External
202
204
  'width' => original_image['width'],
203
205
  'height' => original_image['height'],
204
206
  'license' => OBF::Utils.parse_license(original_image['license']),
207
+ 'protected' => original_image['protected'],
208
+ 'protected_source' => original_image['protected_source'],
205
209
  'url' => original_image['url'],
206
210
  'data_url' => original_image['data_url'],
207
211
  'content_type' => original_image['content_type']
@@ -217,6 +221,8 @@ module OBF::External
217
221
  'id' => original_sound['id'],
218
222
  'duration' => original_sound['duration'],
219
223
  'license' => OBF::Utils.parse_license(original_sound['license']),
224
+ 'protected' => original_sound['protected'],
225
+ 'protected_source' => original_sound['protected_source'],
220
226
  'url' => original_sound['url'],
221
227
  'data' => original_sound['data'],
222
228
  'data_url' => original_sound['data_url'],
@@ -250,6 +256,8 @@ module OBF::External
250
256
  'id' => original_sound['id'],
251
257
  'duration' => original_sound['duration'],
252
258
  'license' => OBF::Utils.parse_license(original_sound['license']),
259
+ 'protected' => original_sound['protected'],
260
+ 'protected_source' => original_sound['protected_source'],
253
261
  'url' => original_sound['url'],
254
262
  'data_url' => original_sound['data_url'],
255
263
  'content_type' => original_sound['content_type']
data/lib/obf/pdf.rb CHANGED
@@ -46,6 +46,10 @@ module OBF::PDF
46
46
  pdf.font_families.update('TimesNewRoman' => {
47
47
  normal: File.expand_path('../../TimesNewRoman.ttf', __FILE__)
48
48
  })
49
+ # TODO: option to add more fonts
50
+ pdf.font_families.update('Sazanami-Hanazono-Mincho' => {
51
+ normal: File.expand_path('../../Sazanami-Hanazono-Mincho.ttf', __FILE__)
52
+ })
49
53
  default_font = 'TimesNewRoman'
50
54
  if opts['font'] && !opts['font'].match(/TimesNewRoman/) && File.exists?(opts['font'])
51
55
  pdf.font_families.update('DocDefault' => {
@@ -53,7 +57,7 @@ module OBF::PDF
53
57
  })
54
58
  default_font = 'DocDefault'
55
59
  end
56
- pdf.fallback_fonts = ['TimesNewRoman', 'THFahKwangBold', 'MiedingerBook', 'Helvetica']
60
+ pdf.fallback_fonts = ['TimesNewRoman', 'THFahKwangBold', 'MiedingerBook', 'Helvetica', 'Sazanami-Hanazono-Mincho']
57
61
  pdf.font(default_font)
58
62
  default_font
59
63
  end
data/lib/obf/utils.rb CHANGED
@@ -153,7 +153,7 @@ module OBF::Utils
153
153
  image['content_type'] ||= attrs['content_type']
154
154
  end
155
155
  end
156
- return nil unless image
156
+ return nil unless image && image['data']
157
157
  str = "data:" + image['content_type']
158
158
  str += ";base64," + Base64.strict_encode64(image['data'])
159
159
  str
@@ -377,7 +377,7 @@ module OBF::Utils
377
377
 
378
378
  def self.image_attrs(path, extension='')
379
379
  res = {}
380
- if path.match(/^data:/)
380
+ if path && path.match(/^data:/)
381
381
  res['content_type'] = path.split(/;/)[0].split(/:/)[1]
382
382
  raw = Base64.strict_decode64(path.split(/\,/, 2)[1])
383
383
  file = Tempfile.new(['file', extension])
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.9.8.36
4
+ version: 0.9.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Whitmer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -147,6 +147,7 @@ files:
147
147
  - README.md
148
148
  - lib/Arial.ttf
149
149
  - lib/MiedingerBook.ttf
150
+ - lib/Sazanami-Hanazono-Mincho.ttf
150
151
  - lib/THFahKwangBold.ttf
151
152
  - lib/TimesNewRoman.ttf
152
153
  - lib/obf.rb
@@ -168,7 +169,7 @@ homepage: https://github.com/CoughDrop/obf
168
169
  licenses:
169
170
  - MIT
170
171
  metadata: {}
171
- post_install_message:
172
+ post_install_message:
172
173
  rdoc_options: []
173
174
  require_paths:
174
175
  - lib
@@ -183,9 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
184
  - !ruby/object:Gem::Version
184
185
  version: '0'
185
186
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.7.6
188
- signing_key:
187
+ rubygems_version: 3.0.9
188
+ signing_key:
189
189
  specification_version: 4
190
190
  summary: Open Board Format
191
191
  test_files: []