glyph_imager 0.0.11 → 0.0.12

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.11
1
+ 0.0.12
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.11"
8
+ s.version = "0.0.12"
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-30}
12
+ s.date = %q{2010-05-04}
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
@@ -64,14 +64,22 @@ module GlyphImager
64
64
 
65
65
  def get_encoding_table4
66
66
  @enc_tbl ||= @font.get_table(:cmap).encoding_tables.find do |t|
67
- t.class == TTFFont::TTF::Table::Cmap::EncodingTable4
67
+ t.class == TTFFont::TTF::Table::Cmap::EncodingTable4
68
68
  end
69
69
  end
70
70
 
71
71
  def has_glyph_for_unicode_char?(code_point)
72
+ return false if control_character_points.include?(code_point)
72
73
  get_encoding_table4.get_glyph_id_for_unicode(code_point.hex) != 0
73
74
  end
74
75
 
76
+ def control_character_points
77
+ return @control_character_points if @control_character_points
78
+ @control_character_points = 0.upto(31).collect {|i| ("%04x" % i).upcase }
79
+ @control_character_points << "007F"
80
+ @control_character_points += 128.upto(159).collect { |i| ("%04x" % i).upcase }
81
+ end
82
+
75
83
  end
76
84
 
77
85
  class Imager
@@ -29,6 +29,11 @@ class TestGlyphImager < Test::Unit::TestCase
29
29
  should "return true when glyph exists for character" do
30
30
  assert @font.has_glyph_for_unicode_char?("0021")
31
31
  end
32
+
33
+ should "return false when glyph is control char" do
34
+ assert !@font.has_glyph_for_unicode_char?("0000")
35
+ assert !@font.has_glyph_for_unicode_char?("009F")
36
+ end
32
37
 
33
38
  should "return false when glyph doesn't exist for character" do
34
39
  assert !@font.has_glyph_for_unicode_char?("11B14")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 11
9
- version: 0.0.11
8
+ - 12
9
+ version: 0.0.12
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-30 00:00:00 -05:00
17
+ date: 2010-05-04 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency