<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,10 +3,25 @@ require &quot;prawn&quot;
 
 Prawn::Document.generate &quot;kerning.pdf&quot; do
   text &quot;To kern?&quot;, :at =&gt; [200,720], :size =&gt; 24, :kerning =&gt; true
-  text &quot;To not kern?&quot;, :at =&gt; [200,690], :size =&gt; 24, :kerning =&gt; false
+  text &quot;To not kern?&quot;, :at =&gt; [200,690], :size =&gt; 24, :kerning =&gt; false 
   
-  font &quot;#{Prawn::BASEDIR}/data/fonts/Dustismo_Roman.ttf&quot;
+  move_down 100
+                                                                     
+  pad(30) do
+    text &quot;To kern and wrap. &quot; * 5, :size =&gt; 24, :kerning =&gt; true   
+  end
+  
+  text &quot;To not kern and wrap. &quot; * 5, :size =&gt; 24, :kerning =&gt; false
+
+  font &quot;#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf&quot;
   
   text &quot;To kern?&quot;, :at =&gt; [200,660], :size =&gt; 24, :kerning =&gt; true
-  text &quot;To not kern?&quot;, :at =&gt; [200,630], :size =&gt; 24, :kerning =&gt; false
+  text &quot;To not kern?&quot;, :at =&gt; [200,630], :size =&gt; 24, :kerning =&gt; false     
+  
+  pad(30) do
+    text &quot;To kern and wrap. &quot; * 5, :size =&gt; 24, :kerning =&gt; true   
+  end
+  
+  text &quot;To not kern and wrap. &quot; * 5, :size =&gt; 24, :kerning =&gt; false
+  
 end</diff>
      <filename>examples/kerning.rb</filename>
    </modified>
    <modified>
      <diff>@@ -81,9 +81,8 @@ module Prawn
         x,y = translate(options[:at])
         font_size(options[:size] || current_font_size) do
           font_name = font_registry[fonts[@font]]          
-
-
-          text = @font_metrics.convert_text(text,options)
+          
+          text = @font_metrics.convert_text(text,options)    
 
           add_content %Q{
             BT
@@ -180,27 +179,31 @@ module Prawn
 
       # TODO: Get kerning working with wrapped text
       def wrapped_text(text,options)
-        options[:kerning] = false
         font_size(options[:size] || current_font_size) do
           font_name = font_registry[fonts[@font]]
 
           text = @font_metrics.naive_wrap(text, bounds.right, current_font_size, 
-            :kerning =&gt; options[:kerning])
+            :kerning =&gt; options[:kerning]) 
 
-          lines = text.lines.map { |t| 
-            @font_metrics.convert_text(t, options) }
+          lines = text.lines
 
           lines.each do |e|
             move_text_position(@font_metrics.font_height(current_font_size) +
-                               @font_metrics.descender / 1000.0 * current_font_size)
-
+                               @font_metrics.descender / 1000.0 * current_font_size)  
+                               
+                               
             add_content %Q{
               BT
               /#{font_name} #{current_font_size} Tf
               #{@bounding_box.absolute_left} #{y} Td
-              #{Prawn::PdfObject(e.to_s.chomp)} Tj
+            }    
+             
+           add_content Prawn::PdfObject(@font_metrics.convert_text(e,options)) &lt;&lt; 
+             &quot; #{options[:kerning] ? 'TJ' : 'Tj'}\n&quot;   
+
+            add_content %Q{
               ET
-            }
+            }                
 
             move_text_position(-@font_metrics.descender / 1000.0 * current_font_size)
           end
@@ -297,7 +300,8 @@ module Prawn
 
       def enctables #:nodoc
         @enctables ||= {}
-      end
+      end 
+      
       def font_registry #:nodoc:
         @font_registry ||= {}
       end</diff>
      <filename>lib/prawn/document/text.rb</filename>
    </modified>
    <modified>
      <diff>@@ -107,7 +107,7 @@ module Prawn
           end
         end
         
-        def kern(string)
+        def kern(string) 
           kerned = string.unpack(&quot;U*&quot;).inject([]) do |a,r|
             if a.last.is_a? Array
               if kern = latin_kern_pairs_table[[a.last.last, r]]
@@ -243,10 +243,10 @@ module Prawn
         def string_width(string, font_size, options = {})
           scale = font_size / 1000.0
           if options[:kerning]
-            kern(string).inject(0) do |s,r|
-              if r.is_a? String
+            kern(string,:skip_conversion =&gt; true).inject(0) do |s,r|
+              if r.is_a? String  
                 s + string_width(r, font_size, :kerning =&gt; false)
-              else
+              else 
                 s + r * scale
               end
             end
@@ -255,10 +255,10 @@ module Prawn
               s + character_width_by_code(r)
             end * scale
           end
-        end
+        end   
         
         # TODO: NASTY. 
-        def kern(string)
+        def kern(string,options={})   
           string.unpack(&quot;U*&quot;).inject([]) do |a,r|
             if a.last.is_a? Array
               if kern = kern_pairs_table[[cmap[a.last.last], cmap[r]]] 
@@ -272,17 +272,21 @@ module Prawn
             end
             a
           end.map { |r| 
-            i = r.is_a?(Array) ? r.pack(&quot;U*&quot;) : r 
-            x = if i.is_a?(String)
-              unicode_codepoints = i.unpack(&quot;U*&quot;)
-              glyph_codes = unicode_codepoints.map { |u| 
-                enc_table.get_glyph_id_for_unicode(u)
-              }
-              glyph_codes.pack(&quot;n*&quot;)
+            if options[:skip_conversion]
+              r.is_a?(Array) ? r.pack(&quot;U*&quot;) : r
             else
-              i
+              i = r.is_a?(Array) ? r.pack(&quot;U*&quot;) : r 
+              x = if i.is_a?(String)
+                unicode_codepoints = i.unpack(&quot;U*&quot;)
+                glyph_codes = unicode_codepoints.map { |u| 
+                  enc_table.get_glyph_id_for_unicode(u)
+                }
+                glyph_codes.pack(&quot;n*&quot;)
+              else
+                i
+              end
+              x.is_a?(Numeric) ? -x : x 
             end
-            x.is_a?(Numeric) ? -x : x
           }
         end
 </diff>
      <filename>lib/prawn/font/metrics.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,9 +15,9 @@ module Prawn
         string.lines.each do |line|
           accumulated_width = 0
           segments = line.scan(/\S+|\s+/)
-          
-          segments.each do |segment|
-            segment_width = string_width(segment, font_size, :kerning =&gt; options[:kerning])
+                                        
+          segments.each do |segment|    
+            segment_width = string_width(segment, font_size, :kerning =&gt; options[:kerning]) 
       
             if (accumulated_width + segment_width).round &gt; line_width.round
               output &lt;&lt; &quot;\n&quot;</diff>
      <filename>lib/prawn/font/wrapping.rb</filename>
    </modified>
    <modified>
      <diff>@@ -97,6 +97,11 @@ class TableTextObserver
   def show_text(*params)
     @strings &lt;&lt; params[0]
   end
+  
+  def show_text_with_positioning(*params)      
+    # ignore kerning information
+    @strings &lt;&lt; params[0].reject { |e| Numeric === e }.join
+  end
 end
 
 </diff>
      <filename>spec/table_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5b085020154b07cd031951b877b14858900ca90e</id>
    </parent>
  </parents>
  <author>
    <name>Gregory Brown</name>
    <email>gregory.t.brown@gmail.com</email>
  </author>
  <url>http://github.com/sandal/prawn/commit/77dba18246fd9008bc841b9ebda8df409b38d68b</url>
  <id>77dba18246fd9008bc841b9ebda8df409b38d68b</id>
  <committed-date>2008-07-21T12:08:34-07:00</committed-date>
  <authored-date>2008-07-21T12:08:34-07:00</authored-date>
  <message>Now I think the kerning stuff is all patched up.  But we're looking at some pure evil here</message>
  <tree>a9163c8809e228bf18b913596af172eb7cf151a1</tree>
  <committer>
    <name>Gregory Brown</name>
    <email>gregory.t.brown@gmail.com</email>
  </committer>
</commit>
