<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>vendor/ttfunk</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,6 @@
 [submodule &quot;vendor/pdf-inspector&quot;]
 	path = vendor/pdf-inspector
 	url = git://github.com/sandal/pdf-inspector.git
+[submodule &quot;vendor/ttfunk&quot;]
+	path = vendor/ttfunk
+	url = git://github.com/sandal/ttfunk.git</diff>
      <filename>.gitmodules</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ require &quot;prawn&quot;
 Prawn::Document.generate &quot;hello-ttf.pdf&quot; do       
   fill_color &quot;0000ff&quot;
   font &quot;#{Prawn::BASEDIR}/data/fonts/comicsans.ttf&quot; 
-  text &quot;Hello World&quot;, :at =&gt; [200,720], :size =&gt; 32           
+  text &quot;Hello World&quot;, :at =&gt; [200,720], :size =&gt; 32         
 
   font &quot;#{Prawn::BASEDIR}/data/fonts/Chalkboard.ttf&quot;
 </diff>
      <filename>examples/simple_text_ttf.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,11 +6,11 @@
 #
 # This is free software. Please see the LICENSE and COPYING files for details.
            
-%w[font_ttf].each do |dep|
+%w[ttfunk/lib].each do |dep|
   $LOAD_PATH.unshift(File.dirname(__FILE__) + &quot;/../vendor/#{dep}&quot;)
 end
 
-require 'ttf'
+require 'ttfunk'
 
 module Prawn 
   file = __FILE__</diff>
      <filename>lib/prawn.rb</filename>
    </modified>
    <modified>
      <diff>@@ -297,7 +297,7 @@ module Prawn
 
       raise &quot;Can't detect a postscript name for #{file}&quot; if basename.nil?
 
-      @encodings = @metrics.enc_table
+      @encodings = @metrics.cmap
 
       if @encodings.nil?
         raise &quot;#{file} missing the required encoding table&quot;</diff>
      <filename>lib/prawn/font.rb</filename>
    </modified>
    <modified>
      <diff>@@ -245,16 +245,16 @@ module Prawn
         attr_accessor :ttf
         
         def initialize(font)
-          @ttf = ::Font::TTF::File.open(font,&quot;rb&quot;)
+          @ttf = TTFunk::File.new(font)
           @attributes       = {}
           @glyph_widths     = {}
           @bounding_boxes   = {} 
           @char_widths      = {}   
-          @has_kerning_data = !kern_pairs_table.empty?    
+          @has_kerning_data = !! @ttf.kern? &amp;&amp; @ttf.kern.sub_tables[0]
         end
 
         def cmap
-          @cmap ||= enc_table.charmaps
+          @ttf.cmap.formats[4]
         end
 
         def string_width(string, font_size, options = {})
@@ -300,7 +300,8 @@ module Prawn
               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)
+                  cmap[u]
+                  #enc_table.get_glyph_id_for_unicode(u)
                 }
                 glyph_codes.pack(&quot;n*&quot;)
               else
@@ -314,7 +315,7 @@ module Prawn
         def glyph_widths
           glyphs = cmap.values.uniq.sort
           first_glyph = glyphs.shift
-          widths = [first_glyph, [Integer(hmtx[first_glyph][0] * scale_factor)]]
+          widths = [first_glyph, [Integer(hmtx[first_glyph][0] * scale_factor)]] 
           prev_glyph = first_glyph
           glyphs.each do |glyph|
             unless glyph == prev_glyph + 1
@@ -328,38 +329,26 @@ module Prawn
         end
 
         def bbox
-          head = @ttf.get_table(:head)
           [:x_min, :y_min, :x_max, :y_max].map do |atr| 
-            Integer(head.send(atr)) * scale_factor
+            Integer(@ttf.head.send(atr)) * scale_factor
           end
         end
 
         def ascender
-          Integer(@ttf.get_table(:hhea).ascender * scale_factor)
+          Integer(@ttf.hhea.ascent * scale_factor)
         end
 
         def descender
-          Integer(@ttf.get_table(:hhea).descender * scale_factor)
+          Integer(@ttf.hhea.descent * scale_factor)
         end      
         
         def line_gap
-          Integer(@ttf.get_table(:hhea).line_gap * scale_factor)   
+          Integer(@ttf.hhea.line_gap * scale_factor)   
         end
 
         def basename
           return @basename if @basename
-          ps_name = ::Font::TTF::Table::Name::NameRecord::POSTSCRIPT_NAME
-
-          @ttf.get_table(:name).name_records.each do |rec|
-            @basename = rec.utf8_str.to_sym if rec.name_id == ps_name            
-          end
-          @basename
-        end
-
-        def enc_table
-          @enc_table ||= @ttf.get_table(:cmap).encoding_tables.find do |t|
-            t.class == ::Font::TTF::Table::Cmap::EncodingTable4
-          end
+          @basename = @ttf.name.postscript_name
         end
 
         # TODO: instead of creating a map that contains every glyph in the font,
@@ -376,20 +365,7 @@ module Prawn
         end
         
         def kern_pairs_table
-          return @kern_pairs_table if @kern_pairs_table
-          
-          table = @ttf.get_table(:kern).subtables.find { |s| 
-            s.is_a? ::Font::TTF::Table::Kern::KerningSubtable0 }
-          
-          if table
-            @kern_pairs_table = table.kerning_pairs.inject({}) do |h,p|
-              h[[p.left, p.right]] = p.value; h
-            end
-          else
-            @kern_pairs_table = {}
-          end               
-        rescue ::Font::TTF::TableMissing
-          @kern_pairs_table = {}
+          has_kerning_data? ? @ttf.kern.sub_tables[0] : {}
         end
 
         def has_kerning_data?
@@ -407,16 +383,16 @@ module Prawn
           else     
            unicode_codepoints = text.unpack(&quot;U*&quot;)
             glyph_codes = unicode_codepoints.map { |u| 
-              enc_table.get_glyph_id_for_unicode(u)
+              cmap[u]
             }
             text = glyph_codes.pack(&quot;n*&quot;)
           end
         end
-
+        
         private
 
         def hmtx
-          @hmtx ||= @ttf.get_table(:hmtx).metrics
+          @hmtx ||= @ttf.hmtx.values
         end         
         
         def character_width_by_code(code)    
@@ -425,7 +401,7 @@ module Prawn
         end                   
 
         def scale_factor
-          @scale ||= 1000 * Float(@ttf.get_table(:head).units_per_em)**-1
+          @scale ||= 1000 * Float(@ttf.head.units_per_em)**-1
         end
 
       end</diff>
      <filename>lib/prawn/font/metrics.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>603a38c65686245a74845b2b23b0eacfbdb681f8</id>
    </parent>
  </parents>
  <author>
    <name>Gregory Brown</name>
    <email>gregory.t.brown@gmail.com</email>
  </author>
  <url>http://github.com/yob/prawn/commit/9b30c14b431ccab5eca68d1a342e5a07d3d31a19</url>
  <id>9b30c14b431ccab5eca68d1a342e5a07d3d31a19</id>
  <committed-date>2008-11-30T20:19:02-08:00</committed-date>
  <authored-date>2008-11-30T20:19:02-08:00</authored-date>
  <message>TTFunk mega hack</message>
  <tree>0ec209d997c2bd28faf64e70c9fd1954967dd457</tree>
  <committer>
    <name>Gregory Brown</name>
    <email>gregory.t.brown@gmail.com</email>
  </committer>
</commit>
