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.35.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.34.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.34.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.33.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.32.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.32.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.32.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.31.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.30.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.29.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.28.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.27.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.26.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.26.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.26.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.25.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.24.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.24.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.24.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.23.0 test/hexapdf/font/type1/test_pfb_parser.rb