obf 0.9.8.35 → 0.9.9.0

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: 3274b731d612ffd8a4ce7b39c4f5c24693c15d62ef2e22126df98ce428e8d0ae
4
- data.tar.gz: e7956b737623c1f5b8471c2fc3465478aebb6dd60b157bae69c7ffa9935da140
3
+ metadata.gz: a69fdd5e4096eb1801dcfa04abe1d091abfcca98aab6c8170bab7bb3ae93375d
4
+ data.tar.gz: 2d09ffd7e75aedc26c1b764fe2d442c8d527f484d44d678c7757117b46565629
5
5
  SHA512:
6
- metadata.gz: fc988d4f31a72cf4e64db2256e6610dfbfbf397937f65822689cb89751a80475de8ff4e93cface38edab88821f077a79c5f9352de5c7a233f6d5e4e65a62bd59
7
- data.tar.gz: d93c9e458967e25de8b6d79feeffac73cef7f4ef674f57b15432aa3f66312017aa932c921c2afeb770f352557f382ef16409b6f871d2feae021232ada4d650bd
6
+ metadata.gz: 5d9a0f073fa2028b6f967caed39687d67b21d82c7cd8f37e06f26a8c7e42d99d2a1a76b474a674bea4893325ad1dbf49d2ae38f07f7bdccc22cf1b4514c2c34f
7
+ data.tar.gz: a8015113cbb3c8e2f3fcf79283e645dd96fb2dd67a3c7623e430301f8d5338898057c4a2b6e2d6b48d1b4daad93dfeddcf646ca325bb995b30559c735d40431e
Binary file
data/lib/obf/external.rb CHANGED
@@ -116,6 +116,8 @@ module OBF::External
116
116
  OBF::Utils.update_current_progress(idx.to_f / button_count.to_f)
117
117
  end
118
118
 
119
+ # board_id 1_527892 has some svg's still, not pre-rasterized versions
120
+ # 1_531854 convert-im6.q16: non-conforming drawing primitive definition `Helvetica''' @ error/draw.c/DrawImage/3265.
119
121
  if to_include[:images]
120
122
  hydra = OBF::Utils.hydra
121
123
  grabs = []
@@ -129,6 +131,7 @@ module OBF::External
129
131
  end
130
132
  end
131
133
  end
134
+ OBF::Utils.log(" batch-retrieving #{grabs.length} images for board #{res['name'] || res['id']}")
132
135
  hydra.run
133
136
 
134
137
  grabs.each do |grab|
@@ -192,6 +195,20 @@ module OBF::External
192
195
  end
193
196
  res['images'] << trim_empties(image)
194
197
  end
198
+ elsif to_include[:image_urls]
199
+ images.each do |original_image|
200
+ image = {
201
+ 'id' => original_image['id'],
202
+ 'width' => original_image['width'],
203
+ 'height' => original_image['height'],
204
+ 'license' => OBF::Utils.parse_license(original_image['license']),
205
+ 'url' => original_image['url'],
206
+ 'data_url' => original_image['data_url'],
207
+ 'content_type' => original_image['content_type']
208
+ }
209
+ res['images'] << trim_empties(image)
210
+ end
211
+
195
212
  end
196
213
 
197
214
  if to_include[:sounds]
@@ -225,6 +242,18 @@ module OBF::External
225
242
  sound['path'] = zip_path
226
243
  end
227
244
 
245
+ res['sounds'] << trim_empties(sound)
246
+ end
247
+ elsif to_include[:sound_urls]
248
+ sounds.each do |original_sound|
249
+ sound = {
250
+ 'id' => original_sound['id'],
251
+ 'duration' => original_sound['duration'],
252
+ 'license' => OBF::Utils.parse_license(original_sound['license']),
253
+ 'url' => original_sound['url'],
254
+ 'data_url' => original_sound['data_url'],
255
+ 'content_type' => original_sound['content_type']
256
+ }
228
257
  res['sounds'] << trim_empties(sound)
229
258
  end
230
259
  end
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
@@ -181,9 +185,11 @@ module OBF::PDF
181
185
  text_options = {:text => "Go Back"}
182
186
  text_options[:anchor] = "page1" if options['links']
183
187
  pdf.formatted_text_box [text_options], :at => [x + 10, header_height], :width => 80, :height => 80, :align => :center, :valign => :bottom, :overflow => :shrink_to_fit
184
- backlinks = (options['backlinks'] || []).join(',')
185
- pdf.fill_color "ffffff"
186
- pdf.formatted_text_box [{:text => backlinks}], :at => [x + 20, header_height + 5 - 25], :width => 70, :height => 30, :align => :center, :valign => :center, :overflow => :shrink_to_fit
188
+ if options['backlinks'].length <= 3
189
+ backlinks = (options['backlinks'] || []).join(',')
190
+ pdf.fill_color "ffffff"
191
+ pdf.formatted_text_box [{:text => backlinks}], :at => [x + 20, header_height + 5 - 25], :width => 70, :height => 30, :align => :center, :valign => :center, :overflow => :shrink_to_fit
192
+ end
187
193
  end
188
194
  end
189
195
 
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
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.35
4
+ version: 0.9.9.0
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-01-28 00:00:00.000000000 Z
11
+ date: 2022-02-22 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.2.3
188
+ signing_key:
189
189
  specification_version: 4
190
190
  summary: Open Board Format
191
191
  test_files: []