Sha256: 5418c4f6c22c732ceebb6240bac89b2182c6e3336484dfdba57d9215ba6a441c

Contents?: true

Size: 1.11 KB

Versions: 99

Compression:

Stored size: 1.11 KB

Contents

# -*- encoding: utf-8 -*-

require 'test_helper'
require 'hexapdf/font/type1'

describe HexaPDF::Font::Type1::PFBParser do
  describe "::encoding" do
    it "can extract the encoding specified as StandardEncoding" do
      data = "bla bla bla /Encoding StandardEncoding def bla bla"
      assert_same(HexaPDF::Font::Encoding.for_name(:StandardEncoding),
                  HexaPDF::Font::Type1::PFBParser.encoding(data))
    end

    it "can extract the encoding specified as array" do
      data = <<-EOF
      bla bla bla
      /Encoding 256 array
      0 1 255 {1 index exch /.notdef put} for
      dup 32 /space put
      dup 33 /exclam put
      dup 34 /universal put
      dup 35 /numbersign put
      dup 36 /existential put
      readonly def
      bla bla bla
      EOF
      enc = HexaPDF::Font::Type1::PFBParser.encoding(data)
      assert_equal(:space, enc.name(32))
      assert_equal(:existential, enc.name(36))
    end

    it "fails if the encoding can't be extracted" do
      data = "something without an encoding"
      assert_raises(HexaPDF::Error) { HexaPDF::Font::Type1::PFBParser.encoding(data) }
    end
  end
end

Version data entries

99 entries across 99 versions & 1 rubygems

Version Path
hexapdf-0.22.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.21.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.21.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.20.4 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.20.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.20.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.20.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.20.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.19.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.19.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.19.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.19.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.18.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.17.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.17.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.16.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.9 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.8 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.7 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.6 test/hexapdf/font/type1/test_pfb_parser.rb