prawn-fillform 0.0.7 → 0.0.8

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.
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Prawn
3
3
  module Fillform
4
- VERSION = "0.0.7"
4
+ VERSION = "0.0.8"
5
5
  end
6
6
  end
7
7
 
@@ -51,14 +51,6 @@ module Prawn
51
51
  deref(@dictionary[:Ff])
52
52
  end
53
53
 
54
- def font_size
55
- deref(@dictionary[:DA]).split(" ")[1].to_f
56
- end
57
-
58
- def font_color
59
- Prawn::Graphics::Color.rgb2hex(deref(@dictionary[:DA]).split(" ")[3..5].collect { |e| e.to_f * 255 }).to_s
60
- end
61
-
62
54
  end
63
55
 
64
56
  class Text < Field
@@ -80,6 +72,26 @@ module Prawn
80
72
  deref(@dictionary[:MaxLen]).to_i
81
73
  end
82
74
 
75
+ def font_size
76
+ deref(@dictionary[:DA]).split(" ")[1].to_f
77
+ end
78
+
79
+ def font_style
80
+ style = case deref(@dictionary[:DA]).split(" ")[0].split(",").last.to_s.downcase
81
+ when "bold" then :bold
82
+ when "italic" then :italic
83
+ when "bold_italic" then :bold_italic
84
+ when "normal" then :normal
85
+ else
86
+ :normal
87
+ end
88
+ style
89
+ end
90
+
91
+ def font_color
92
+ Prawn::Graphics::Color.rgb2hex(deref(@dictionary[:DA]).split(" ")[3..5].collect { |e| e.to_f * 255 }).to_s
93
+ end
94
+
83
95
  def type
84
96
  :text
85
97
  end
@@ -167,17 +179,22 @@ module Prawn
167
179
  if value
168
180
  if field.type == :text
169
181
  fill_color options[:font_color] || field.font_color
182
+
170
183
  text_box value.to_s, :at => [field.x + 2, field.y - 1],
171
184
  :align => options[:align] || field.align,
172
185
  :width => options[:width] || field.width,
173
186
  :height => options[:height] || field.height,
174
187
  :valign => options[:valign] || :center,
175
- :size => options[:font_size] || field.font_size
188
+ :size => options[:font_size] || field.font_size,
189
+ :style => options[:font_style] || field.font_style
176
190
  elsif field.type == :button
177
- image value.to_s, :at => [field.x + 2, field.y - 1],
178
- :position => options[:position] || :center,
179
- :vposition => options[:vposition] || :center,
180
- :fit => options[:fit] || [field.width, field.height]
191
+
192
+ bounding_box([field.x, field.y], :width => field.width, :height => field.height) do
193
+
194
+ image value.to_s, :position => options[:position] || :center,
195
+ :vposition => options[:vposition] || :center,
196
+ :fit => options[:fit] || [field.width, field.height]
197
+ end
181
198
  end
182
199
  end
183
200
  end
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.7
4
+ version: 0.0.8
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: 2011-09-28 00:00:00.000000000Z
12
+ date: 2011-09-29 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: