Sha256: 5418c4f6c22c732ceebb6240bac89b2182c6e3336484dfdba57d9215ba6a441c

Contents?: true

Size: 1.11 KB

Versions: 100

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

100 entries across 100 versions & 1 rubygems

Version Path
hexapdf-0.15.6 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.5 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.4 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.15.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.14.4 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.14.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.14.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.14.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.14.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.13.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.12.3 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.12.2 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.12.1 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.12.0 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.9 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.8 test/hexapdf/font/type1/test_pfb_parser.rb
hexapdf-0.11.7 test/hexapdf/font/type1/test_pfb_parser.rb