Class: TTFunk::Encoding::MacRoman

### Home Classes Methods

### In Files

- lib/ttfunk/encoding/mac_roman.rb

### Parent

Object

### Methods

- ::covers?
- ::from_unicode
- ::from_unicode_codepoints
- ::from_utf8
- ::to_unicode
- ::to_unicode_codepoints
- ::to_utf8

### 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::Format06
- TTFunk::Table::Cmap::Format10
- TTFunk::Table::Cmap::Format12
- 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::Format30
- TTFunk::Table::Post::Format40
- TTFunk::Table::Sbix
- TTFunk::Table::Simple

No matching classes.

# TTFunk::Encoding::MacRoman

### Constants

FROM_UNICODE
POSTSCRIPT_GLYPH_MAPPING

  Maps MacRoman codes to their corresponding index in the Postscript glyph table (see TTFunk::Table::Post::Format10). If any entry in this array is a string, it is a postscript glyph that is not in the standard list, and which should be emitted specially in the TTF postscript table ('post', see format 2).

TO_UNICODE

  XXX: Ruby 1.9.2 on OS X Lion segfaults on range1.zip(range2)

### Public Class Methods

covers?(character) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 61
    def self.covers?(character)
      !FROM_UNICODE[character].nil?
    end

from_unicode(string) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 77
    def self.from_unicode(string)
      from_unicode_codepoints(string.unpack("n*")).pack("C*")
    end

from_unicode_codepoints(array) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 85
    def self.from_unicode_codepoints(array)
      array.map { |code| FROM_UNICODE[code] || 0 }
    end

from_utf8(string) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 73
    def self.from_utf8(string)
      from_unicode_codepoints(string.unpack("U*")).pack("C*")
    end

to_unicode(string) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 69
    def self.to_unicode(string)
      to_unicode_codepoints(string.unpack("C*")).pack("n*")
    end

to_unicode_codepoints(array) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 81
    def self.to_unicode_codepoints(array)
      array.map { |code| TO_UNICODE[code] }
    end

to_utf8(string) click to toggle source

    # File lib/ttfunk/encoding/mac_roman.rb, line 65
    def self.to_utf8(string)
      to_unicode_codepoints(string.unpack("C*")).pack("U*")
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.