Permalink
Browse files

Reading the file in binary mode promotes world peace.

Or, at least, it makes it so all strings read from the file
are automatically encoded as BINARY. Which does a lot for
MY peace. It's even compatible between 1.8 and 1.9!
  • Loading branch information...
jamis committed Jan 5, 2009
1 parent 95d0109 commit 83139f386ee6ca7bc6f200f304af28f0cedb8d01
Showing with 1 addition and 3 deletions.
  1. +1 −1 lib/ttfunk.rb
  2. +0 −1 lib/ttfunk/subset/base.rb
  3. +0 −1 lib/ttfunk/table/name.rb
View
@@ -7,7 +7,7 @@ class File
attr_reader :directory
def self.open(file)
- new(IO.read(file))
+ new(::File.open(file, "rb") { |f| f.read })
end
def initialize(contents)
@@ -99,7 +99,6 @@ def encode(options={})
table_data = ""
head_offset = nil
tables.each do |tag, data|
- data.force_encoding('BINARY') if data.respond_to?(:force_encoding)
newfont << [tag, checksum(data), offset, data.length].pack("A4N*")
table_data << data
head_offset = offset if tag == 'head'
View
@@ -13,7 +13,6 @@ def initialize(text, platform_id, encoding_id, language_id)
@platform_id = platform_id
@encoding_id = encoding_id
@language_id = language_id
- force_encoding('BINARY') if respond_to?(:force_encoding)
end
end

0 comments on commit 83139f3

Please sign in to comment.