class TTFunk::Encoding::MacRoman
Constants
- FROM_UNICODE
- POSTSCRIPT_GLYPH_MAPPING
Maps
MacRoman
codes to their corresponding index in the Postscript glyph table (seeTTFunk::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). rubocop: disable Metrics/LineLength,Style/AlignArray,Style/IndentArray- TO_UNICODE
rubocop: disable Style/ExtraSpacing
Public Class Methods
covers?(character)
click to toggle source
rubocop: enable Style/AlignArray,Metrics/LineLength,Style/ExtraSpacing,Style/IndentArray
# File lib/ttfunk/encoding/mac_roman.rb, line 71 def self.covers?(character) !FROM_UNICODE[character].nil? end
from_unicode(string)
click to toggle source
# File lib/ttfunk/encoding/mac_roman.rb, line 87 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 95 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 83 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 79 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 91 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 75 def self.to_utf8(string) to_unicode_codepoints(string.unpack('C*')).pack('U*') end