glyph_imager 0.0.9 → 0.0.10

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.9
1
+ 0.0.10
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.0.9"
8
+ s.version = "0.0.10"
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-04-29}
12
+ s.date = %q{2010-04-30}
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 = [
data/lib/glyph_imager.rb CHANGED
@@ -89,9 +89,17 @@ module GlyphImager
89
89
  "#{@options[:output_dir]}/#{@options[:code_point]}-#{@options[:size]}.png"
90
90
  end
91
91
 
92
+ def command_string
93
+ # need to escape apostrophe
94
+ if @options[:code_point] == "0027"
95
+ "convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity center label:\\#{[@options[:code_point].hex].pack("U*")} #{output_path}"
96
+ else
97
+ "convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity center label:'#{[@options[:code_point].hex].pack("U*")}' #{output_path}"
98
+ end
99
+ end
92
100
 
93
101
  def create_image
94
- %x[convert -font #{@options[:font_path]} -size #{@options[:size]} -gravity center label:#{["#{@options[:code_point]}".hex].pack("U*")} #{output_path}]
102
+ %x[#{command_string}]
95
103
  return self
96
104
  end
97
105
 
@@ -12,6 +12,9 @@ class TestGlyphImager < Test::Unit::TestCase
12
12
  if File.exists?("/tmp/0021-80x80.png")
13
13
  File.delete("/tmp/0021-80x80.png")
14
14
  end
15
+ if File.exists?("/tmp/0027-80x80.png")
16
+ File.delete("/tmp/0027-80x80.png")
17
+ end
15
18
  end
16
19
 
17
20
  should "read font" do
@@ -51,6 +54,15 @@ class TestGlyphImager < Test::Unit::TestCase
51
54
  assert File.exists?("/tmp/0021-80x80.png")
52
55
  end
53
56
 
57
+ should "create new image for 0027 (apostrophe)" do
58
+ GlyphImager.image_character_for_font({
59
+ :code_point => "0027",
60
+ :font_path => @font_path,
61
+ :output_dir => "/tmp"
62
+ })
63
+ assert File.exists?("/tmp/0021-80x80.png")
64
+ end
65
+
54
66
  should "not create new image for character not supported by font" do
55
67
  GlyphImager.image_character_for_font({
56
68
  :code_point => "11B14",
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 9
9
- version: 0.0.9
8
+ - 10
9
+ version: 0.0.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - William Melody
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-29 00:00:00 -05:00
17
+ date: 2010-04-30 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency