Class: TTFunk::Subset::Unicode

### Home Classes Methods

### In Files

- lib/ttfunk/subset/unicode.rb

### Parent

TTFunk::Subset::Base

### Methods

- ::new
- #covers?
- #from_unicode
- #includes?
- #new_cmap_table
- #original_glyph_ids
- #to_unicode_map
- #unicode?
- #use

### Class/Module Index

Quicksearch

- TTFunk
- TTFunk::Directory
- TTFunk::Encoding
- TTFunk::Encoding::MacRoman
- TTFunk::Encoding::Windows1252
- TTFunk::File
- TTFunk::Reader
- TTFunk::ResourceFile
- TTFunk::Subset
- TTFunk::Subset::Base
- TTFunk::Subset::MacRoman
- TTFunk::Subset::Unicode
- TTFunk::Subset::Unicode8Bit
- TTFunk::Subset::Windows1252
- TTFunk::SubsetCollection
- TTFunk::Table
- TTFunk::Table::Cmap
- TTFunk::Table::Cmap::Format00
- TTFunk::Table::Cmap::Format04
- TTFunk::Table::Cmap::Subtable
- TTFunk::Table::Glyf
- TTFunk::Table::Glyf::Compound
- TTFunk::Table::Glyf::Simple
- TTFunk::Table::Head
- TTFunk::Table::Hhea
- TTFunk::Table::Hmtx
- TTFunk::Table::Kern
- TTFunk::Table::Kern::Format0
- TTFunk::Table::Loca
- TTFunk::Table::Maxp
- TTFunk::Table::Name
- TTFunk::Table::Name::String
- TTFunk::Table::OS2
- TTFunk::Table::Post
- TTFunk::Table::Post::Format10
- TTFunk::Table::Post::Format20
- TTFunk::Table::Post::Format25
- TTFunk::Table::Post::Format30
- TTFunk::Table::Post::Format40
- TTFunk::Table::Simple

No matching classes.

# TTFunk::Subset::Unicode

### Public Class Methods

new(original) click to toggle source

    # 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.