Sha256: f662233e8522c3b75c55846492d453238279621806fd2456ff79d843437531b9
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true require 'set' require_relative 'base' module TTFunk module Subset class Unicode < Base SPACE_CHAR = 0x20 def initialize(original) super @subset = Set.new use(SPACE_CHAR) end def unicode? true end def to_unicode_map @subset.each_with_object({}) { |code, map| map[code] = code } end def use(character) @subset << character end def covers?(_character) true end def includes?(character) @subset.include?(character) end def from_unicode(character) character end 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 def original_glyph_ids ([0] + @subset.map { |code| unicode_cmap[code] }).uniq.sort end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ttfunk-1.6.2.1 | lib/ttfunk/subset/unicode.rb |
ttfunk-1.6.2 | lib/ttfunk/subset/unicode.rb |
ttfunk-1.6.1 | lib/ttfunk/subset/unicode.rb |
ttfunk-1.6.0 | lib/ttfunk/subset/unicode.rb |