Class: TTFunk::Subset::Unicode8Bit
- Defined in:
- lib/ttfunk/subset/unicode_8bit.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #covers?(character) ⇒ Boolean
- #from_unicode(character) ⇒ Object
- #includes?(character) ⇒ Boolean
-
#initialize(original) ⇒ Unicode8Bit
constructor
A new instance of Unicode8Bit.
- #to_unicode_map ⇒ Object
- #unicode? ⇒ Boolean
- #use(character) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(original) ⇒ Unicode8Bit
Returns a new instance of Unicode8Bit.
7 8 9 10 11 12 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 7 def initialize(original) super @subset = { 0x20 => 0x20 } @unicodes = { 0x20 => 0x20 } @next = 0x21 # apparently, PDF's don't like to use chars between 0-31 end |
Instance Method Details
#covers?(character) ⇒ Boolean
30 31 32 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 30 def covers?(character) @unicodes.key?(character) || @next < 256 end |
#from_unicode(character) ⇒ Object
38 39 40 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 38 def from_unicode(character) @unicodes[character] end |
#includes?(character) ⇒ Boolean
34 35 36 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 34 def includes?(character) @unicodes.key?(character) end |
#to_unicode_map ⇒ Object
18 19 20 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 18 def to_unicode_map @subset.dup end |
#unicode? ⇒ Boolean
14 15 16 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 14 def unicode? true end |
#use(character) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ttfunk/subset/unicode_8bit.rb', line 22 def use(character) if !@unicodes.key?(character) @subset[@next] = character @unicodes[character] = @next @next += 1 end end |