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.11.5 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.4 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.10.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.9.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.9.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.9.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.9.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.8.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.7.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.6.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.5.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.4.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.3.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.2.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.1.0 test/hexapdf/font/type1/test_pfb_parser.rb