glyph_imager 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/glyph_imager.gemspec +4 -4
- data/lib/glyph_imager.rb +7 -2
- data/test/test_glyph_imager.rb +22 -0
- metadata +11 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/glyph_imager.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{glyph_imager}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["William Melody"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-14}
|
13
13
|
s.description = %q{Generate images of glyphs for a specified character in a specified font}
|
14
14
|
s.email = %q{hi@williammelody.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -75,7 +75,7 @@ Gem::Specification.new do |s|
|
|
75
75
|
s.homepage = %q{http://github.com/alphabetum/glyph_imager}
|
76
76
|
s.rdoc_options = ["--charset=UTF-8"]
|
77
77
|
s.require_paths = ["lib"]
|
78
|
-
s.rubygems_version = %q{1.3.
|
78
|
+
s.rubygems_version = %q{1.3.7}
|
79
79
|
s.summary = %q{Generate images of glyphs for a specified character in a specified font}
|
80
80
|
s.test_files = [
|
81
81
|
"test/helper.rb",
|
@@ -86,7 +86,7 @@ Gem::Specification.new do |s|
|
|
86
86
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
87
87
|
s.specification_version = 3
|
88
88
|
|
89
|
-
if Gem::Version.new(Gem::
|
89
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
90
90
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
91
91
|
else
|
92
92
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
data/lib/glyph_imager.rb
CHANGED
@@ -77,7 +77,12 @@ module GlyphImager
|
|
77
77
|
class Imager
|
78
78
|
|
79
79
|
def initialize(opts = {})
|
80
|
-
@options = {
|
80
|
+
@options = {
|
81
|
+
:size => "80x80",
|
82
|
+
:pointsize_percentage => 100,
|
83
|
+
:gravity => "center",
|
84
|
+
:background => "none"
|
85
|
+
}.merge(opts)
|
81
86
|
%w[code_point font_path output_dir].each do |k|
|
82
87
|
if @options[k.to_sym].nil?
|
83
88
|
raise ArgumentError, "missing value for :#{k}"
|
@@ -105,7 +110,7 @@ module GlyphImager
|
|
105
110
|
end
|
106
111
|
|
107
112
|
def command_string
|
108
|
-
"convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity #{@options[:gravity]} -pointsize #{pointsize} #{label} #{output_path}"
|
113
|
+
"convert -font #{@options[:font_path]} -background #{@options[:background]} -size #{@options[:size]} -gravity #{@options[:gravity]} -pointsize #{pointsize} #{label} #{output_path}"
|
109
114
|
end
|
110
115
|
|
111
116
|
def create_image
|
data/test/test_glyph_imager.rb
CHANGED
@@ -10,6 +10,7 @@ class TestGlyphImager < Test::Unit::TestCase
|
|
10
10
|
@musica = GlyphImager::FontRecord.new(File.join(@fonts_dir, 'Musica.ttf'))
|
11
11
|
|
12
12
|
@output_dir = "/tmp"
|
13
|
+
|
13
14
|
end
|
14
15
|
|
15
16
|
def teardown
|
@@ -93,4 +94,25 @@ class TestGlyphImager < Test::Unit::TestCase
|
|
93
94
|
assert !File.exists?("/tmp/11B14-80x80.png")
|
94
95
|
end
|
95
96
|
|
97
|
+
should "generate command string with default background" do
|
98
|
+
@imager = GlyphImager::Imager.new({
|
99
|
+
:code_point => "0021",
|
100
|
+
:font_path => @font_path,
|
101
|
+
:output_dir => @output_dir
|
102
|
+
})
|
103
|
+
assert_match "-background none", @imager.command_string
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
should "generate command string with background from param" do
|
108
|
+
@imager = GlyphImager::Imager.new({
|
109
|
+
:code_point => "0021",
|
110
|
+
:font_path => @font_path,
|
111
|
+
:output_dir => @output_dir,
|
112
|
+
:background => "white"
|
113
|
+
})
|
114
|
+
assert_match "-background white", @imager.command_string
|
115
|
+
|
116
|
+
end
|
117
|
+
|
96
118
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glyph_imager
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 25
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- William Melody
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-09-14 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: thoughtbot-shoulda
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -103,23 +106,27 @@ rdoc_options:
|
|
103
106
|
require_paths:
|
104
107
|
- lib
|
105
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
106
110
|
requirements:
|
107
111
|
- - ">="
|
108
112
|
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
109
114
|
segments:
|
110
115
|
- 0
|
111
116
|
version: "0"
|
112
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
113
119
|
requirements:
|
114
120
|
- - ">="
|
115
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 3
|
116
123
|
segments:
|
117
124
|
- 0
|
118
125
|
version: "0"
|
119
126
|
requirements: []
|
120
127
|
|
121
128
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.3.
|
129
|
+
rubygems_version: 1.3.7
|
123
130
|
signing_key:
|
124
131
|
specification_version: 3
|
125
132
|
summary: Generate images of glyphs for a specified character in a specified font
|