obf 0.8.5 → 0.8.6

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/obf/pdf.rb +7 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab2c55d56ca5f570a188f3936a58324965cfb5f9
4
- data.tar.gz: b0dc51874a5a7a7b3f010d6f243cd109909ab506
3
+ metadata.gz: 4c5ab9a0744ec8904c6f373ab147aadd5fa896f1
4
+ data.tar.gz: 939fa830adbf2f3f3c0f53f22cdb912c33de60d4
5
5
  SHA512:
6
- metadata.gz: 4b90045b54cdb8f01cef1ef31e2c003a4f7ff908d8337f4cab8bb1d06553ecfed2eaeb490de01b3952874501093b1474733bc0a78f112e489d6d6ac53b66c7a4
7
- data.tar.gz: 2353646c0179cebd7832a883c5f2242a22e0047119eeb4f8be4ba1aa5b258877ed111cacd466db1abb51b42f3f0fc4fab26dc36c26fd81a3c0b7e306a82e4a6d
6
+ metadata.gz: d6837a6e94af08d818dec313d0e819b1fd1fcabedd253bc8957b25cbf8edb58ec137dec2764636c958edc1ebe82f08a257d0c7603960e08be58339e29fb1add0
7
+ data.tar.gz: e5beb2f5409dd1a0921b669e21ca0ab2c1b128e65796acfcbf2f52fa0c2a934e991d12c0015fb39e507568c15cec1a2ea0b5290f21f47553782b040cb284b2a1
@@ -41,7 +41,8 @@ module OBF::PDF
41
41
  :Title => obj['name']
42
42
  }
43
43
  )
44
- font = opts['font'] || File.expand_path('../../TimesNewRoman.ttf', __FILE__)
44
+ font = opts['font'] if opts['font'] && File.exists?(opts['font'])
45
+ font ||= File.expand_path('../../TimesNewRoman.ttf', __FILE__)
45
46
  pdf.font(font) if File.exists?(font)
46
47
 
47
48
 
@@ -55,6 +56,7 @@ module OBF::PDF
55
56
  'zipper' => zipper,
56
57
  'pages' => obj['pages'],
57
58
  'headerless' => !!opts['headerless'],
59
+ 'font' => font,
58
60
  'text_on_top' => !!opts['text_on_top'],
59
61
  'transparent_background' => !!opts['transparent_background'],
60
62
  'text_case' => opts['text_case']
@@ -64,6 +66,7 @@ module OBF::PDF
64
66
  else
65
67
  build_page(pdf, obj, {
66
68
  'headerless' => !!opts['headerless'],
69
+ 'font' => font,
67
70
  'text_on_top' => !!opts['text_on_top'],
68
71
  'transparent_background' => !!opts['transparent_background'],
69
72
  'text_case' => opts['text_case']
@@ -80,6 +83,7 @@ module OBF::PDF
80
83
 
81
84
  def self.build_page(pdf, obj, options)
82
85
  OBF::Utils.as_progress_percent(0, 1.0) do
86
+ pdf.font(options['font']) if options['font'] && File.exists?(options['font'])
83
87
  doc_width = 11*72 - 72
84
88
  doc_height = 8.5*72 - 72
85
89
  default_radius = 3
@@ -159,16 +163,10 @@ module OBF::PDF
159
163
  elsif options['text_case'] == 'lower'
160
164
  text = text.downcase
161
165
  end
162
- pdf.text_box text, :at => [0, vertical], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit, :direction => direction
166
+
163
167
  if options['text_only']
164
168
  # render text
165
169
  pdf.fill_color "000000"
166
- text = (button['label'] || button['vocalization']).to_s
167
- if options['text_case'] == 'upper'
168
- text = text.upcase
169
- elsif options['text_case'] == 'lower'
170
- text = text.downcase
171
- end
172
170
  pdf.text_box text, :at => [0, 0], :width => button_width, :height => button_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit, :direction => direction
173
171
  else
174
172
  # render image
@@ -201,13 +199,7 @@ module OBF::PDF
201
199
  # render text
202
200
  pdf.fill_color "000000"
203
201
  vertical = options['text_on_top'] ? button_height : text_height
204
- text = (button['label'] || button['vocalization']).to_s
205
- if options['text_case'] == 'upper'
206
- text = text.upcase
207
- elsif options['text_case'] == 'lower'
208
- text = text.downcase
209
- end
210
- pdf.text_box text, :at => [0, vertical], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit
202
+ pdf.text_box text, :at => [0, vertical], :width => button_width, :height => text_height, :align => :center, :valign => :center, :overflow => :shrink_to_fit, :direction => direction
211
203
  end
212
204
  end
213
205
  index = col + (row * obj['grid']['columns'])
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.5
4
+ version: 0.8.6
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-11-30 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json