<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>examples/chinese_text_wrapping.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -88,11 +88,10 @@ module Prawn
       # TODO: Get kerning working with wrapped text
       def wrapped_text(text,options) 
         options[:align] ||= :left      
-        @text_x_pos ||= 0 
-        
+
         font.size(options[:size]) do
           text = font.metrics.naive_wrap(text, bounds.right, font.size, 
-            :kerning =&gt; options[:kerning], :offset =&gt; @text_x_pos ) 
+            :kerning =&gt; options[:kerning], :mode =&gt; options[:wrap]) 
 
           lines = text.lines
                                                        
@@ -103,18 +102,17 @@ module Prawn
             line_width = font.width_of(e)
             case(options[:align]) 
             when :left
-              x = @bounding_box.absolute_left + @text_x_pos
+              x = @bounding_box.absolute_left
             when :center
-              x = @bounding_box.absolute_left + @text_x_pos +
+              x = @bounding_box.absolute_left
                 (@bounding_box.width - line_width) / 2.0
             when :right
-              x = @bounding_box.absolute_right - line_width - @text_x_pos
+              x = @bounding_box.absolute_right - line_width 
             end
                                
             add_text_content(e,x,y,options)
             ds = -font.metrics.descender / 1000.0 * font.size 
             move_text_position(options[:spacing] || ds )     
-            @text_x_pos = 0
           end 
         end
       end  </diff>
      <filename>lib/prawn/document/text.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,14 +7,17 @@
 # This is free software. Please see the LICENSE and COPYING files for details.
 module Prawn
   class Font #:nodoc:
-    module Wrapping #:nodoc:
+    module Wrapping #:nodoc:                
+      $KCODE=&quot;U&quot;
       
       # TODO: Replace with TeX optimal algorithm
       def naive_wrap(string, line_width, font_size, options = {})
+        accumulated_width = 0
+        scan_pattern = options[:mode] == :character ? /./ : /\S+|\s+/                                    
+        
         output = &quot;&quot;                
-        accumulated_width = options[:offset] || 0 
-        string.lines.each do |line|
-          segments = line.scan(/\S+|\s+/)
+        string.lines.each do |line|         
+          segments = line.scan(scan_pattern)
                                         
           segments.each do |segment|    
             segment_width = string_width(segment, font_size, 
@@ -34,8 +37,6 @@ module Prawn
               accumulated_width += segment_width
             end
           end    
-          
-          accumulated_width = 0
         end
   
         output</diff>
      <filename>lib/prawn/font/wrapping.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c1736bc413ebe9a233de0ebecaff9bf967ae8765</id>
    </parent>
  </parents>
  <author>
    <name>Gregory Brown</name>
    <email>gregory.t.brown@gmail.com</email>
  </author>
  <url>http://github.com/sandal/prawn/commit/120aad1401ec1d51f655b4ca71af7621428d86b8</url>
  <id>120aad1401ec1d51f655b4ca71af7621428d86b8</id>
  <committed-date>2008-08-20T14:45:18-07:00</committed-date>
  <authored-date>2008-08-20T14:45:18-07:00</authored-date>
  <message>Minimal changes to support character based wrapping and removal of offset x position artifacts [#67]</message>
  <tree>0a693832aab482d96e9ea77300a8239c6dd5bdb8</tree>
  <committer>
    <name>Gregory Brown</name>
    <email>gregory.t.brown@gmail.com</email>
  </committer>
</commit>
