Class: EideticPDF::AFM::Codepoints
- Inherits:
-
Object
- Object
- EideticPDF::AFM::Codepoints
- Defined in:
- lib/epdfafm.rb
Class Method Summary collapse
Class Method Details
.for_encoding(encoding) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/epdfafm.rb', line 18 def self.for_encoding(encoding) require 'iconv' encoding = 'CP1252' if encoding == 'WinAnsiEncoding' @@codepoints_by_encoding ||= {} @@codepoints_by_encoding[encoding] ||= Iconv.open("UCS-2BE//IGNORE", encoding) do |ic| (0..255).map { |c| ic.iconv(c.chr) }.map { |s| s.unpack('n') }.map { |a| a.first } end end |