public
Description: Fast, Nimble PDF Writer for Ruby
Homepage: http://prawn.majesticseacreature.com
Clone URL: git://github.com/sandal/prawn.git
This should fix the newline bug I introduced, but may be weird
sandal (author)
Fri Jul 18 13:23:44 -0700 2008
commit  0fcc3530603a8d3d05e112cff39883038a213ce5
tree    4db64b0b2d054581f77d3903109b1bfc71b8aefe
parent  c7e412ca43f4f522180235c0a64c5c9a7a5b781f
...
178
179
180
 
181
 
182
183
184
185
 
 
186
187
188
 
 
189
190
191
192
193
194
195
196
197
198
199
200
201
202
 
203
204
205
...
178
179
180
181
182
183
184
185
186
 
187
188
189
 
 
190
191
192
 
 
 
 
 
 
 
 
 
 
193
194
195
196
197
198
199
0
@@ -178,28 +178,22 @@ module Prawn
0
         @font_metrics.string_width(text,size)
0
       end
0
 
0
+      # TODO: Get kerning working with wrapped text
0
       def wrapped_text(text,options)
0
+        options[:kerning] = false
0
         font_size(options[:size] || current_font_size) do
0
           font_name = font_registry[fonts[@font]]
0
 
0
-          text = @font_metrics.naive_wrap(text, bounds.right, current_font_size, :kerning => options[:kerning])
0
+          text = @font_metrics.naive_wrap(text, bounds.right, current_font_size, 
0
+            :kerning => options[:kerning])
0
 
0
-          # THIS CODE JUST DID THE NASTY. FIXME!
0
-          lines = text.lines
0
+          lines = text.lines.map { |t| 
0
+            @font_metrics.convert_text(t, options) }
0
 
0
-          if fonts[@font].data[:Subtype] == :Type0
0
-            lines = lines.map do |line|
0
-              unicode_codepoints = line.chomp.unpack("U*")
0
-              glyph_codes = unicode_codepoints.map { |u| 
0
-                enctables[@font].get_glyph_id_for_unicode(u)
0
-              }
0
-              glyph_codes.pack("n*")
0
-            end
0
-          end
0
-          
0
           lines.each do |e|
0
             move_text_position(@font_metrics.font_height(current_font_size) +
0
                                @font_metrics.descender / 1000.0 * current_font_size)
0
+
0
             add_content %Q{
0
               BT
0
               /#{font_name} #{current_font_size} Tf
...
376
377
378
 
379
380
381
...
376
377
378
379
380
381
382
0
@@ -376,6 +376,7 @@ module Prawn
0
         end
0
 
0
         def convert_text(text,options)
0
+          text = text.chomp
0
           if options[:kerning]
0
             kern(text)
0
           else

Comments