Parent

TTFunk::Encoding::Windows1252

Constants

FROM_UNICODE
POSTSCRIPT_GLYPH_MAPPING

Maps Windows-1252 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/windows_1252.rb, line 41
def self.covers?(character)
  !FROM_UNICODE[character].nil?
end
from_unicode(string) click to toggle source
# File lib/ttfunk/encoding/windows_1252.rb, line 57
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/windows_1252.rb, line 65
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/windows_1252.rb, line 53
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/windows_1252.rb, line 49
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/windows_1252.rb, line 61
def self.to_unicode_codepoints(array)
  array.map { |code| TO_UNICODE[code] }
end
to_utf8(string) click to toggle source
# File lib/ttfunk/encoding/windows_1252.rb, line 45
def self.to_utf8(string)
  to_unicode_codepoints(string.unpack("C*")).pack("U*")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.