public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
Eating my own dogfood from my book
sandal (author)
Thu Jul 24 11:06:39 -0700 2008
commit  c9b31cbf847268af540ad76e603922eaca347d10
tree    ae659d2720bc809ea8e903eddfb7febc459ff33f
parent  de0db796081899dc0b6cb24393f3414196734d39
...
124
125
126
127
 
 
128
129
130
...
135
136
137
138
139
 
 
 
 
 
 
140
141
142
143
144
145
146
147
148
149
150
...
124
125
126
 
127
128
129
130
131
...
136
137
138
 
 
139
140
141
142
143
144
145
146
147
148
149
150
 
 
151
152
153
0
@@ -124,7 +124,8 @@ module Prawn
0
       #   text "At size 16"
0
       #  end
0
       #
0
-      def font_size(size)
0
+      def font_size(size=nil)
0
+        return current_font_size unless size
0
         font_size_before_block = @font_size || DEFAULT_FONT_SIZE
0
         font_size!(size)
0
         yield
0
@@ -135,16 +136,18 @@ module Prawn
0
       #
0
       def font_size!(size)
0
         @font_size = size unless size == nil
0
-      end
0
-     
0
+      end     
0
+      
0
+      alias_method :font_size=, :font_size!
0
+
0
+      private 
0
+      
0
       # The current font_size being used in the document.
0
       #
0
       def current_font_size
0
         @font_size || DEFAULT_FONT_SIZE
0
       end
0
 
0
-      private
0
-
0
       def move_text_position(dy)
0
          (y - dy) < @margin_box.absolute_bottom ? start_new_page : self.y -= dy       
0
       end
...
71
72
73
74
 
75
76
77
...
84
85
86
87
 
88
89
90
...
71
72
73
 
74
75
76
77
...
84
85
86
 
87
88
89
90
0
@@ -71,7 +71,7 @@ module Prawn
0
       #
0
       def width
0
         @width || (@document.font_metrics.string_width(@text,
0
-          @document.current_font_size)) + 2*@horizontal_padding
0
+          @document.font_size)) + 2*@horizontal_padding
0
       end
0
 
0
       # The height of the cell in PDF points
0
@@ -84,7 +84,7 @@ module Prawn
0
       #
0
       def text_area_height
0
         @document.font_metrics.string_height(@text, 
0
-         :font_size  => @document.current_font_size, 
0
+         :font_size  => @document.font_size, 
0
          :line_width => text_area_width) 
0
       end
0
 

Comments