glyph_imager 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.10
1
+ 0.0.11
data/glyph_imager.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{glyph_imager}
8
- s.version = "0.0.10"
8
+ s.version = "0.0.11"
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"]
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
- if @options[:code_point] == "0027"
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
@@ -9,11 +9,10 @@ class TestGlyphImager < Test::Unit::TestCase
9
9
  end
10
10
 
11
11
  def teardown
12
- if File.exists?("/tmp/0021-80x80.png")
13
- File.delete("/tmp/0021-80x80.png")
14
- end
15
- if File.exists?("/tmp/0027-80x80.png")
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/0021-80x80.png")
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 10
9
- version: 0.0.10
8
+ - 11
9
+ version: 0.0.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - William Melody