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 +3 -0
- data/lib/txt2img.rb +4 -4
- data/lib/txt2img/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
data/lib/txt2img.rb
CHANGED
@@ -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
|
12
|
-
@width
|
13
|
-
@pointsize
|
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 =
|
20
|
+
image.pointsize = pointsize
|
21
21
|
image.draw_text(0, 0, txt, :gravity => "center")
|
22
22
|
image.save(path)
|
23
23
|
end
|
data/lib/txt2img/version.rb
CHANGED
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.
|
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: &
|
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: *
|
24
|
+
version_requirements: *16623540
|
25
25
|
description: generate image from txt
|
26
26
|
email:
|
27
27
|
- hoooopo@gmail.com
|