prawn-fillform 0.0.15 → 0.0.16
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.
- data/lib/prawn-fillform.rb +12 -3
- data/lib/prawn-fillform/version.rb +1 -1
- metadata +2 -2
data/lib/prawn-fillform.rb
CHANGED
@@ -77,10 +77,13 @@ module Prawn
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def font_size
|
80
|
+
return 12.0 unless deref(@dictionary[:DA])
|
80
81
|
deref(@dictionary[:DA]).split(" ")[1].to_f
|
81
82
|
end
|
82
83
|
|
83
84
|
def font_style
|
85
|
+
return :normal unless deref(@dictionary[:DA])
|
86
|
+
|
84
87
|
style = case deref(@dictionary[:DA]).split(" ")[0].split(",").last.to_s.downcase
|
85
88
|
when "bold" then :bold
|
86
89
|
when "italic" then :italic
|
@@ -93,6 +96,7 @@ module Prawn
|
|
93
96
|
end
|
94
97
|
|
95
98
|
def font_color
|
99
|
+
return "0000" unless deref(@dictionary[:DA])
|
96
100
|
Prawn::Graphics::Color.rgb2hex(deref(@dictionary[:DA]).split(" ")[3..5].collect { |e| e.to_f * 255 }).to_s
|
97
101
|
end
|
98
102
|
|
@@ -214,8 +218,11 @@ module Prawn
|
|
214
218
|
fields.each do |field|
|
215
219
|
number = page.to_s.split("_").last.to_i
|
216
220
|
go_to_page(number)
|
217
|
-
|
218
|
-
|
221
|
+
|
222
|
+
field_hash = data[page].try(:[], field.name) || data[field.name]
|
223
|
+
|
224
|
+
value = field_hash.fetch(:value) rescue nil
|
225
|
+
options = field_hash.fetch(:options) rescue nil
|
219
226
|
options ||= {}
|
220
227
|
|
221
228
|
if value
|
@@ -231,7 +238,9 @@ module Prawn
|
|
231
238
|
:width => options[:width] || field.width,
|
232
239
|
:height => options[:height] || field.height,
|
233
240
|
:valign => options[:valign] || :center,
|
234
|
-
|
241
|
+
|
242
|
+
# Default to the document font size if the field size is 0
|
243
|
+
:size => options[:font_size] || ((size = field.font_size) > 0.0 ? size : font_size),
|
235
244
|
:style => options[:font_style] || field.font_style
|
236
245
|
elsif field.type == :button
|
237
246
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-fillform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: prawn
|