Class: PDF::Reader::Encoding
- Inherits:
-
Object
- Object
- PDF::Reader::Encoding
- Defined in:
- lib/pdf/reader/encoding.rb
Direct Known Subclasses
IdentityH, MacExpertEncoding, MacRomanEncoding, StandardEncoding, SymbolEncoding, WinAnsiEncoding, ZapfDingbatsEncoding
Defined Under Namespace
Classes: IdentityH, MacExpertEncoding, MacRomanEncoding, StandardEncoding, SymbolEncoding, WinAnsiEncoding, ZapfDingbatsEncoding
Constant Summary collapse
- UNKNOWN_CHAR =
▯
0x25AF
Instance Attribute Summary collapse
-
#differences ⇒ Object
Returns the value of attribute differences.
Class Method Summary collapse
-
.factory(enc) ⇒ Object
Takes the “Encoding” value of a Font dictionary and builds a PDF::Reader::Encoding object.
Instance Method Summary collapse
Instance Attribute Details
#differences ⇒ Object
Returns the value of attribute differences.
33 34 35 |
# File 'lib/pdf/reader/encoding.rb', line 33 def differences @differences end |
Class Method Details
.factory(enc) ⇒ Object
Takes the “Encoding” value of a Font dictionary and builds a PDF::Reader::Encoding object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/pdf/reader/encoding.rb', line 61 def self.factory(enc) if enc.kind_of?(Hash) diff = enc['Differences'] enc = enc['Encoding'] || enc['BaseEncoding'] elsif enc != nil enc = enc.to_s end case enc when nil then enc = PDF::Reader::Encoding::StandardEncoding.new when "Identity-H" then enc = PDF::Reader::Encoding::IdentityH.new when "MacRomanEncoding" then enc = PDF::Reader::Encoding::MacRomanEncoding.new when "MacExpertEncoding" then enc = PDF::Reader::Encoding::MacExpertEncoding.new when "StandardEncoding" then enc = PDF::Reader::Encoding::StandardEncoding.new when "SymbolEncoding" then enc = PDF::Reader::Encoding::SymbolEncoding.new when "WinAnsiEncoding" then enc = PDF::Reader::Encoding::WinAnsiEncoding.new when "ZapfDingbatsEncoding" then enc = PDF::Reader::Encoding::ZapfDingbatsEncoding.new else raise UnsupportedFeatureError, "#{enc} is not currently a supported encoding" end enc.differences = diff if enc && diff return enc end |
Instance Method Details
#to_utf8(str, tounicode = nil) ⇒ Object
86 87 88 89 |
# File 'lib/pdf/reader/encoding.rb', line 86 def to_utf8(str, tounicode = nil) # abstract method, of sorts raise RuntimeError, "Called abstract method" end |