Class: TTFunk::Table::Post

### Home Classes Methods

### In Files

- lib/ttfunk/table/post.rb
- lib/ttfunk/table/post/format40.rb
- lib/ttfunk/table/post/format20.rb
- lib/ttfunk/table/post/format10.rb
- lib/ttfunk/table/post/format30.rb
- lib/ttfunk/table/post/format25.rb

### Parent

TTFunk::Table

### Namespace

- MODULE TTFunk::Table::Post::Format10
- MODULE TTFunk::Table::Post::Format20
- MODULE TTFunk::Table::Post::Format25
- MODULE TTFunk::Table::Post::Format30
- MODULE TTFunk::Table::Post::Format40

### Methods

- ::encode
- #fixed_pitch?
- #glyph_for
- #recode

### 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::Table::Post

### Attributes

fixed_pitch[R]
format[R]
italic_angle[R]
max_mem_type1[R]
max_mem_type42[R]
min_mem_type1[R]
min_mem_type42[R]
subtable[R]
underline_position[R]
underline_thickness[R]

### Public Class Methods

encode(post, mapping) click to toggle source

    # File lib/ttfunk/table/post.rb, line 18
    def self.encode(post, mapping)
      return nil unless post.exists?
      post.recode(mapping)
    end

### Public Instance Methods

fixed_pitch?() click to toggle source

    # File lib/ttfunk/table/post.rb, line 23
    def fixed_pitch?
      @fixed_pitch != 0
    end

glyph_for(code) click to toggle source

    # File lib/ttfunk/table/post.rb, line 27
    def glyph_for(code)
      ".notdef"
    end

recode(mapping) click to toggle source

    # File lib/ttfunk/table/post.rb, line 31
    def recode(mapping)
      return raw if format == 0x00030000

      table = raw[0,32]
      table[0,4] = [0x00020000].pack("N")

      index = []
      strings = []

      mapping.keys.sort.each do |new_id|
        post_glyph = glyph_for(mapping[new_id])
        position = Format10::POSTSCRIPT_GLYPHS.index(post_glyph)
        if position
          index << position
        else
          index << 257 + strings.length
          strings << post_glyph
        end
      end

      table << [mapping.length, *index].pack("n*")
      strings.each do |string|
        table << [string.length, string].pack("CA*")
      end

      return table
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.