class TTFunk::Subset::MacRoman
Public Class Methods
new(original)
click to toggle source
Calls superclass method
TTFunk::Subset::Base::new
# File lib/ttfunk/subset/mac_roman.rb, line 9 def initialize(original) super @subset = Array.new(256) end
Public Instance Methods
covers?(character)
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 22 def covers?(character) Encoding::MacRoman.covers?(character) end
from_unicode(character)
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 31 def from_unicode(character) Encoding::MacRoman::FROM_UNICODE[character] end
includes?(character)
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 26 def includes?(character) code = Encoding::MacRoman::FROM_UNICODE[character] code && @subset[code] end
to_unicode_map()
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 14 def to_unicode_map Encoding::MacRoman::TO_UNICODE end
use(character)
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 18 def use(character) @subset[Encoding::MacRoman::FROM_UNICODE[character]] = character end
Protected Instance Methods
new_cmap_table(_options)
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 37 def new_cmap_table(_options) mapping = {} @subset.each_with_index do |unicode, roman| mapping[roman] = unicode_cmap[unicode] if roman end TTFunk::Table::Cmap.encode(mapping, :mac_roman) end
original_glyph_ids()
click to toggle source
# File lib/ttfunk/subset/mac_roman.rb, line 46 def original_glyph_ids ([0] + @subset.map { |unicode| unicode && unicode_cmap[unicode] }) .compact.uniq.sort end