txt2img 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,6 +23,9 @@ require 'txt2img'
23
23
  txt = Txt2img::Txt.new("你好世界" * 100)
24
24
  txt.write("hello.gif")
25
25
  ```
26
+
27
+ ![hello.gif](http://dl.iteye.com/upload/attachment/0063/4250/34a1f8b8-2532-3c42-a0ed-fe49db580bca.gif)
28
+
26
29
  ## Contributing
27
30
 
28
31
  1. Fork it
@@ -8,16 +8,16 @@ module Txt2img
8
8
 
9
9
  def initialize(txt, font = nil, width = 20, pointsize = 30)
10
10
  @txt = txt
11
- @font ||= File.expand_path("../../fonts/microhei.ttc", __FILE__)
12
- @width ||= 20
13
- @pointsize ||= 30
11
+ @font = font || File.expand_path("../../fonts/microhei.ttc", __FILE__)
12
+ @width = width || 20
13
+ @pointsize = pointsize || 30
14
14
  end
15
15
 
16
16
  def write(path)
17
17
  wrap!
18
18
  image = QuickMagick::Image::solid(width * pointsize + 100, ((height * pointsize) * 1.3).to_i, :white)
19
19
  image.font = font
20
- image.pointsize = 40
20
+ image.pointsize = pointsize
21
21
  image.draw_text(0, 0, txt, :gravity => "center")
22
22
  image.save(path)
23
23
  end
@@ -1,3 +1,3 @@
1
1
  module Txt2img
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: txt2img
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: quick_magick_hooopo
16
- requirement: &9882540 !ruby/object:Gem::Requirement
16
+ requirement: &16623540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0.8'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *9882540
24
+ version_requirements: *16623540
25
25
  description: generate image from txt
26
26
  email:
27
27
  - hoooopo@gmail.com