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.each_with_object({}) { |code, map| map[code] = code }
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.each_with_object({}) do |code, map|
    map[code] = unicode_cmap[code]
  end
  TTFunk::Table::Cmap.encode(mapping, :unicode)
end
original_glyph_ids() click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 45
def original_glyph_ids
  ([0] + @subset.map { |code| unicode_cmap[code] }).uniq.sort
end