<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>fonts/basket.ttf</filename>
    </added>
    <added>
      <filename>lib/saucy_helper.rb</filename>
    </added>
    <added>
      <filename>lib/saucy_render.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,12 +1,90 @@
 Saucy
 =====
 
-Dynamic Text Rendering Plugin.
-
-It uses jQuery to replace innerHTML of elements with an image.
-
-The filename of the image contains all necessary information to allow Imagemagick to render the text.
+Dynamic Text Rendering Plugin for Rails. Like sIFR but without the hassle/flash/javascript.
 
 * Automatic cacheing
 * SEO friendly
+* render any TTF font
+* Shadows, outlines, rotation.
+
+Use
+---
+
+In a view:
+
+&lt;%= saucy_tag tag, text, style, options  %&gt;
+
+* tag: the type of tag to output, eg. &quot;h1&quot;
+* text: your own text. Note it can contain newlines which will be interpreted as multiline text.
+* style: a style hash
+* options: html attributes to be inserted
+
+Styles
+------
+
+The style has has several options and the default style is: 
+
+    DEFAULT_STYLE = { 
+      :background =&gt; &quot;transparent&quot;,
+      :font =&gt; {:size=&gt;18, :color =&gt; &quot;#000&quot;, :font =&gt; &quot;arial&quot;, :stretch =&gt; &quot;normal&quot;},
+      :stroke =&gt; {:width =&gt; 0, :color =&gt; &quot;#000&quot;, :inner =&gt; true },
+      :shadow =&gt; {:color =&gt; &quot;#000&quot;, :opacity =&gt; 0.6, :top =&gt; 2, :left =&gt; 2, :blur =&gt; 5.0, :render =&gt; false },
+      :rotate =&gt; 0,
+      :spacing =&gt; {:letter =&gt; 0, :word =&gt; 0}
+    }
+
+The style that's passed in will be merged over the top of this. 
+
+Internet Explorer
+-----
+
+If the background is transparent, Saucy will automatically output a tag with CSS that IE will interpret and use it's AlphaFilter properly.
+
+* Bonus: you can output any pngs as transparent with the following helper, no javascript needed! :
+
+&lt;%= transparent_png(filename) %&gt;
+
+
+Fonts
+-----
+
+Fonts are loaded from the /plugins/saucy/fonts directory.
+
+
+Try out
+-------
+
+* In your controller
+
+&lt;pre&gt;
+def saucy
+    @stroked = { :stroke =&gt; { :color =&gt; &quot;red&quot;, :width =&gt; 1 }, :font =&gt; { :size =&gt; 100, :color =&gt; &quot;#fff&quot; }, :spacing =&gt; {:letter =&gt; 100 }  }
+    @thick_stroked = { :stroke =&gt; { :color =&gt; &quot;red&quot;, :width =&gt; 20, :inner =&gt; 1 }, :font =&gt; { :size =&gt; 100, :color =&gt; &quot;#fff&quot; }  }
+    @bauhaus = { :font =&gt; { :size =&gt; 100, :font =&gt; &quot;bauhausl.ttf&quot;  }  }
+    @shadow = { :background =&gt; &quot;transparent&quot;, :font =&gt; { :size =&gt; 100, :font =&gt; &quot;basket.ttf&quot;, :color =&gt; &quot;#fff&quot; }, :shadow =&gt; { :render =&gt; true, :top =&gt; 5, :left =&gt; 5 }  }
+    @rotate = { :rotate =&gt; -15, :font =&gt; { :size =&gt; 100, :font =&gt; &quot;bauhausl.ttf&quot;, :color =&gt; &quot;red&quot;, :stretch =&gt; &quot;condensed&quot; } }
+end
+&lt;/pre&gt;
+
+* In saucy.html.erb
+
+&lt;pre&gt;
+  &lt;style&gt;
+    body {background: url(http://www.parkerfox.co.uk/images/bg.png) }
+  &lt;/style&gt;
+  &lt;%= saucy_tag &quot;p&quot;, &quot;default - no style&quot;, {} %&gt;
+  &lt;%= saucy_tag &quot;p&quot;, &quot;mutli\nline\nbauhaus&quot;, @bauhaus  %&gt;
+  &lt;%= saucy_tag &quot;p&quot;, &quot;stroked!!&quot;, @stroked, {:class=&gt;&quot;myclass&quot;} %&gt;
+  &lt;%= saucy_tag &quot;p&quot;, &quot;stroked!!&quot;, @thick_stroked, {:class=&gt;&quot;myclass&quot;} %&gt;
+  &lt;p&gt;Lorem ispsum&lt;/p&gt;
+
+  &lt;%= saucy_tag &quot;h2&quot;, &quot;h2 tag&quot;, @bauhaus, {:id=&gt;&quot;myid&quot;} %&gt;
+  &lt;p&gt;Lorem ispsum&lt;/p&gt;
+  &lt;%= saucy_tag &quot;p&quot;, &quot;lets rotate!&quot;, @rotate %&gt;
+  &lt;%= saucy_tag &quot;p&quot;, &quot;shadow&quot;, @shadow %&gt;
 
+  &lt;a href='/'&gt;
+    &lt;%= saucy_tag &quot;p&quot;, &quot;rotate the lettters&quot;, {:font =&gt; { :rotate =&gt; -90, :size =&gt; 40}, :rotate =&gt; 90 } %&gt;
+  &lt;/a&gt;
+&lt;/pre&gt;</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,5 @@
-::ActionController::Routing::RouteSet::Mapper.send(:include, Saucy::Routing)
-require &quot;RMagick&quot; 
-Mime::Type.register &quot;image/png&quot;, :png
\ No newline at end of file
+require &quot;saucy&quot;
+ActionView::Base.send(:include, Saucy::SaucyHelper)
+
+Saucy.cache_image_sizes
+</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,8 +6,8 @@ rails_root = defined?(RAILS_ROOT) ? RAILS_ROOT : &quot;#{here}/../../..&quot;
 STDOUT.puts &quot;*********&quot;
 STDOUT.puts &quot;* Saucy *&quot;
 STDOUT.puts &quot;*********&quot;
-STDOUT.puts &quot;Copying Saucy assets to Rails public Directory&quot;
-FileUtils.cp_r &quot;#{rails_root}/vendor/plugins/saucy/assets/saucy&quot;, &quot;#{rails_root}/public&quot;
+STDOUT.puts &quot;Creating /public/saucy Directory&quot;
+FileUtils.mkdir &quot;#{rails_root}/public/saucy&quot;
 STDOUT.puts &quot;... done&quot;
-STDOUT.puts &quot;* add `map.saucy` in the your routes.rb&quot;
-STDOUT.puts &quot;* start server and visit http://localhost:3000/saucy/saucy.html to test it is working&quot;
\ No newline at end of file
+STDOUT.puts &quot;See README for more information&quot;
+</diff>
      <filename>install.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,155 +1,29 @@
-require 'rvg/rvg'
-include Magick
-require &quot;json&quot;
-require &quot;base64&quot;
 
 module Saucy
+  OUTPUT_DIR = &quot;/saucy&quot;
+  ABS_OUTPUT_DIR = &quot;#{RAILS_ROOT}/public/#{OUTPUT_DIR}&quot;      
   
-class RenderTTF
-
-  @@font_store = &quot;#{RAILS_ROOT}/vendor/plugins/saucy/fonts/&quot;
-  @@output = &quot;#{RAILS_ROOT}/public/saucy/images/&quot;
-  
-  
-  def self.render file
-    attrs = self.parse(file)
-    attrs[&quot;size&quot;] = attrs[&quot;size&quot;].to_i
-    attrs[&quot;stroke_width&quot;] = attrs[&quot;stroke_width&quot;].to_i
-
-    attrs[&quot;stroke_color&quot;].gsub!('HX','#') if attrs[&quot;stroke_color&quot;]
-    attrs[&quot;color&quot;].gsub!('HX','#') if attrs[&quot;color&quot;]
-    attrs[&quot;shadow_color&quot;].gsub!('HX','#') if attrs[&quot;shadow_color&quot;]
-    
-    image = self.draw(attrs)
-    image = shadow_render image, attrs if attrs[&quot;shadow_color&quot;] 
-    
-    image.write(@@output + file + &quot;.png&quot;)
-    return image
+  def self.png_dimensions file
+    IO.read(file)[0x10..0x18].unpack('NN')
   end
-  
-  def self.draw attrs
-    
-    attrs = {&quot;size&quot;=&gt;10, &quot;stroke_width&quot; =&gt; 0, &quot;background&quot; =&gt; &quot;transparent&quot;, &quot;color&quot; =&gt; &quot;#000&quot;, &quot;text&quot; =&gt; &quot;no text!&quot;, &quot;stroke_color&quot; =&gt; &quot;#000&quot;}.merge(attrs)
-    
-    
-    width = attrs[&quot;size&quot;]*attrs[&quot;text&quot;].length + attrs[&quot;stroke_width&quot;]*2
-    height = attrs[&quot;size&quot;]*2+ attrs[&quot;stroke_width&quot;]*2
-    
-    #throw attrs.inspect
-    rvg = RVG.new(width, height) do |canvas|
-      canvas.background_fill = attrs[&quot;background&quot;] if attrs[&quot;background&quot;] != 'transparent'
-      
-      font_file = @@font_store + attrs[&quot;font&quot;]+&quot;.ttf&quot;
-      sw = attrs[&quot;stroke_width&quot;]
 
-      if attrs[&quot;stroke_width&quot;] == 0 
-        canvas.text(0+sw,attrs[&quot;size&quot;]+sw, attrs[&quot;text&quot;]).styles(:font =&gt; '&quot;' + font_file + '&quot;', :font_size=&gt;attrs[&quot;size&quot;], :fill=&gt;attrs[&quot;color&quot;])
-	    else
-		    canvas.text(0+sw,attrs[&quot;size&quot;]+sw, attrs[&quot;text&quot;]).styles(:font =&gt; '&quot;' + font_file + '&quot;', :font_size=&gt;attrs[&quot;size&quot;], :fill=&gt;attrs[&quot;color&quot;], :stroke =&gt; attrs[&quot;stroke_color&quot;], :stroke_width =&gt; attrs[&quot;stroke_width&quot;])
-  	  end
+  def self.get_png_size filename
+    size = Rails.cache.read(&quot;Saucy:&quot; + filename)
       
-#      if stroke_inside &gt; 0
-#         canvas.text(0+sw,font_size+sw, text).styles(:font =&gt; '&quot;' + font_file +'&quot;', :font_size =&gt; font_size, :fill=&gt; color, :stroke_width =&gt; stroke_inside, :stroke =&gt; color )
-#      end
+    if(!size)
+      size = Saucy.png_dimensions(&quot;#{RAILS_ROOT}/public&quot; + filename)
+      Rails.cache.write(&quot;Saucy:&quot; + filename, size)
     end
-    img = rvg.draw
-    return img.trim
+    size
   end
-  
-  def self.shadow_render input, attrs
-   
-    shadow_color = (attrs['shadow_color'] || 'black')
-    shadow_opacity = 255 - ((attrs['shadow_opacity'] || '0.6').to_f * 255).to_i
-    shadow_top = (attrs['shadow_top'] || '2').to_i 
-    shadow_left = (attrs['shadow_left'] || '2').to_i 
-    blur_radius = (attrs['shadow_blur'] || '5').to_f
-    
-    w=input.columns+ blur_radius*4+shadow_left.abs*2
-    h=input.rows+ blur_radius*4+shadow_top.abs*2
-   
-    input.matte = true
-    
-    opacity_color = &quot;rgb(#{shadow_opacity},#{shadow_opacity},#{shadow_opacity})&quot;
-    input_colorized= input.copy.colorize(1.0, 1.0, 1.0, opacity_color)
-    
-    shadow_mask =  Image.new(w,h ){self.background_color = '#fff'}
-    
-    zero=[shadow_left.abs+blur_radius,shadow_top.abs+blur_radius]
-    
-    shadow_mask.composite!(input_colorized, blur_radius, blur_radius, OverCompositeOp)
-
-    shadow_mask.matte=true
-    shadow_mask = shadow_mask.blur_image(blur_radius,blur_radius)
- 
-    output = Image.new(w,h){self.background_color = shadow_color}
-    inverse_shadow_mask = shadow_mask.negate
-    inverse_shadow_mask.matte = false
-
-    output.matte = true
-    output.composite!(inverse_shadow_mask, zero[0]+shadow_left,zero[1]+shadow_top, CopyOpacityCompositeOp)
-    output.composite!(input, zero[0]+blur_radius,zero[1]+blur_radius, OverCompositeOp)
-
-  
-    return output.trim
-  end
-  
 
-  @@keys = {
-    &quot;b&quot; =&gt; &quot;background&quot;,
-    &quot;t&quot; =&gt; &quot;text&quot;,
-    &quot;s&quot; =&gt; &quot;size&quot;,
-    &quot;c&quot; =&gt; &quot;color&quot;,
-    &quot;f&quot; =&gt; &quot;font&quot;,
-    &quot;sw&quot; =&gt; &quot;stroke_width&quot;,
-    &quot;sc&quot; =&gt; &quot;stroke_color&quot;,
-    &quot;shc&quot; =&gt; &quot;shadow_color&quot;,
-    &quot;sho&quot; =&gt; &quot;shadow_opacity&quot;,
-    &quot;shl&quot; =&gt; &quot;shadow_left&quot;,
-    &quot;sht&quot; =&gt; &quot;shadow_top&quot;,
-    &quot;shb&quot; =&gt; &quot;shadow_blur&quot;
-  }
-  
-  def self.parse file
-    params = file.gsub(&quot;.png&quot;,&quot;&quot;).split(&quot;__&quot;)
-    
-    attrs = {}
-    
-    params.each do |param|
-      p = param.split(&quot;==&quot;)
-      key = p[0]
-      val = p[1]
-      attrs[@@keys[key]] = val
+  def self.cache_image_sizes 
+    Dir.entries(ABS_OUTPUT_DIR).select {|f| f.match(/.png$/)}.each do |image|
+       get_png_size(&quot;#{OUTPUT_DIR}/#{image}&quot;)
     end
-    
-    attrs
-  end
-
-=begin
-  def rotate_render input, attrs
-    angle=attrs['pr'].to_i
-    input.matte = true
-    input.rotate!(angle)
-    return input
-  end
-
-
-  def guassian_blur_render input, attrs
-    blur_radius = (attrs['pg'] || '10').to_f
-    w=input.columns#+ blur_radius*2
-    h=input.rows#+ blur_radius*2
-    output = Image.new(w,h) {self.background_color = 'transparent'}
-    
-    blur = input.blur_image(blur_radius/2,blur_radius/2)
-    output.composite!(blur, 0,0, OverCompositeOp)
-    output
   end
-=end
-
-end
-
 end
 
-  
-
-
+require &quot;saucy_render&quot;
+require &quot;saucy_helper&quot;
 </diff>
      <filename>lib/saucy.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>772d09ae54535a52db09855ac0cdb163d8959fb5</id>
    </parent>
  </parents>
  <author>
    <name>weepy</name>
    <email>jonahfox@gmail.com</email>
  </author>
  <url>http://github.com/weepy/saucy/commit/d1bae5b8d3f9b9fd40da49d69d9571b93754b4bd</url>
  <id>d1bae5b8d3f9b9fd40da49d69d9571b93754b4bd</id>
  <committed-date>2008-11-27T15:00:39-08:00</committed-date>
  <authored-date>2008-11-27T15:00:39-08:00</authored-date>
  <message>updating</message>
  <tree>a8fd31de784c04e26279db2d6d732cc40ccfa0a2</tree>
  <committer>
    <name>weepy</name>
    <email>jonahfox@gmail.com</email>
  </committer>
</commit>
