class TTFunk::Subset::Unicode
Constants
- SPACE_CHAR
Public Class Methods
new(original)
click to toggle source
Calls superclass method
TTFunk::Subset::Base::new
# File lib/ttfunk/subset/unicode.rb, line 11 def initialize(original) super @subset = Set.new use(SPACE_CHAR) end
Public Instance Methods
covers?(_character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 29 def covers?(_character) true end
from_unicode(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 37 def from_unicode(character) character end
includes?(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 33 def includes?(character) @subset.include?(character) end
new_cmap_table()
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 41 def new_cmap_table @new_cmap_table ||= begin mapping = @subset.each_with_object({}) do |code, map| map[code] = unicode_cmap[code] end TTFunk::Table::Cmap.encode(mapping, :unicode) end end
original_glyph_ids()
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 53 def original_glyph_ids ([0] + @subset.map { |code| unicode_cmap[code] }).uniq.sort end
to_unicode_map()
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 21 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 17 def unicode? true end
use(character)
click to toggle source
# File lib/ttfunk/subset/unicode.rb, line 25 def use(character) @subset << character end