class TTFunk::Subset::Unicode
Public Class Methods
new(original)
click to toggle source
Calls superclass method
TTFunk::Subset::Base.new
# File lib/ttfunk/subset/unicode.rb, line 7 def initialize(original) super @subset = Set.new end
Public Instance Methods
covers?(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 24 def covers?(character) true end
from_unicode(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 32 def from_unicode(character) character end
includes?(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 28 def includes?(character) @subset.includes(character) end
to_unicode_map()
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 16 def to_unicode_map @subset.inject({}) { |map, code| map[code] = code; map } end
unicode?()
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 12 def unicode? true end
use(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 20 def use(character) @subset << character end
Protected Instance Methods
new_cmap_table(options)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 38 def new_cmap_table(options) mapping = @subset.inject({}) { |map, code| map[code] = unicode_cmap[code]; map } TTFunk::Table::Cmap.encode(mapping, :unicode) end
original_glyph_ids()
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 43 def original_glyph_ids ([0] + @subset.map { |code| unicode_cmap[code] }).uniq.sort end