Class: TTFunk::Subset::MacRoman

Inherits:
Base
  • Object
show all
Defined in:
lib/ttfunk/subset/mac_roman.rb

Instance Attribute Summary

Attributes inherited from Base

#original

Instance Method Summary collapse

Methods inherited from Base

#encode, #unicode?

Constructor Details

#initialize(original) ⇒ MacRoman

Returns a new instance of MacRoman.



9
10
11
12
# File 'lib/ttfunk/subset/mac_roman.rb', line 9

def initialize(original)
  super
  @subset = Array.new(256)
end

Instance Method Details

#covers?(character) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/ttfunk/subset/mac_roman.rb', line 22

def covers?(character)
  Encoding::MacRoman.covers?(character)
end

#from_unicode(character) ⇒ Object



31
32
33
# File 'lib/ttfunk/subset/mac_roman.rb', line 31

def from_unicode(character)
  Encoding::MacRoman::FROM_UNICODE[character]
end

#includes?(character) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
# File 'lib/ttfunk/subset/mac_roman.rb', line 26

def includes?(character)
  code = Encoding::MacRoman::FROM_UNICODE[character]
  code && @subset[code]
end

#to_unicode_mapObject



14
15
16
# File 'lib/ttfunk/subset/mac_roman.rb', line 14

def to_unicode_map
  Encoding::MacRoman::TO_UNICODE
end

#use(character) ⇒ Object



18
19
20
# File 'lib/ttfunk/subset/mac_roman.rb', line 18

def use(character)
  @subset[Encoding::MacRoman::FROM_UNICODE[character]] = character
end