Class: TTFunk::Table::Name

### Home Classes Methods

### In Files

- lib/ttfunk/table/name.rb

### Parent

TTFunk::Table

### Namespace

- CLASS TTFunk::Table::Name::String

### Methods

- ::encode
- #postscript_name

### 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::Name

### Attributes

compatible_full[R]
copyright[R]
description[R]
designer[R]
designer_url[R]
font_family[R]
font_name[R]
font_subfamily[R]
license[R]
license_url[R]
manufacturer[R]
preferred_family[R]
preferred_subfamily[R]
sample_text[R]
strings[R]
trademark[R]
unique_subfamily[R]
vendor_url[R]
version[R]

### Public Class Methods

encode(names) click to toggle source

    # File lib/ttfunk/table/name.rb, line 48
    def self.encode(names)
      tag = @@subset_tag.dup
      @@subset_tag.succ!

      postscript_name = Name::String.new("#{tag}+#{names.postscript_name}", 1, 0, 0)

      strings = names.strings.dup
      strings[6] = [postscript_name]
      str_count = strings.inject(0) { |sum, (id, list)| sum + list.length }

      table = [0, str_count, 6 + 12 * str_count].pack("n*")
      strtable = ""

      strings.each do |id, list|
        list.each do |string|
          table << [string.platform_id, string.encoding_id, string.language_id, id, string.length, strtable.length].pack("n*")
          strtable << string
        end
      end

      table << strtable
    end

### Public Instance Methods

postscript_name() click to toggle source

    # File lib/ttfunk/table/name.rb, line 71
    def postscript_name
      return @postscript_name if @postscript_name
      font_family.first || "unnamed"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.