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-1.1.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-1.1.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-1.0.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-1.0.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-1.0.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-1.0.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.47.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.46.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.45.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.44.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.41.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.40.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.39.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.39.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.38.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.37.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.37.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.37.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.36.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.35.1 test/hexapdf/font/type1/test_pfb_parser.rb