glyph_imager 0.0.10 → 0.0.11
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 +1 -1
- data/lib/glyph_imager.rb +4 -1
- data/test/test_glyph_imager.rb +14 -6
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.11
|
data/glyph_imager.gemspec
CHANGED
data/lib/glyph_imager.rb
CHANGED
@@ -91,8 +91,11 @@ module GlyphImager
|
|
91
91
|
|
92
92
|
def command_string
|
93
93
|
# need to escape apostrophe
|
94
|
-
|
94
|
+
case @options[:code_point]
|
95
|
+
when "0027"
|
95
96
|
"convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity center label:\\#{[@options[:code_point].hex].pack("U*")} #{output_path}"
|
97
|
+
when "005C"
|
98
|
+
"convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity center label:'\\#{[@options[:code_point].hex].pack("U*")}' #{output_path}"
|
96
99
|
else
|
97
100
|
"convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity center label:'#{[@options[:code_point].hex].pack("U*")}' #{output_path}"
|
98
101
|
end
|
data/test/test_glyph_imager.rb
CHANGED
@@ -9,11 +9,10 @@ class TestGlyphImager < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def teardown
|
12
|
-
|
13
|
-
File.
|
14
|
-
|
15
|
-
|
16
|
-
File.delete("/tmp/0027-80x80.png")
|
12
|
+
%w[0021 0027 005C].each do |code|
|
13
|
+
if File.exists?("/tmp/#{code}-80x80.png")
|
14
|
+
File.delete("/tmp/#{code}-80x80.png")
|
15
|
+
end
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
@@ -60,7 +59,16 @@ class TestGlyphImager < Test::Unit::TestCase
|
|
60
59
|
:font_path => @font_path,
|
61
60
|
:output_dir => "/tmp"
|
62
61
|
})
|
63
|
-
assert File.exists?("/tmp/
|
62
|
+
assert File.exists?("/tmp/0027-80x80.png")
|
63
|
+
end
|
64
|
+
|
65
|
+
should "create new image for 005C (reverse solidus aka backslash)" do
|
66
|
+
GlyphImager.image_character_for_font({
|
67
|
+
:code_point => "005C",
|
68
|
+
:font_path => @font_path,
|
69
|
+
:output_dir => "/tmp"
|
70
|
+
})
|
71
|
+
assert File.exists?("/tmp/005C-80x80.png")
|
64
72
|
end
|
65
73
|
|
66
74
|
should "not create new image for character not supported by font" do
|