/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.fontbox.pfb;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.fontbox.encoding.BuiltInEncoding;
import org.apache.fontbox.type1.Type1Font;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
 *
 * @author Tilman Hausherr
 */
class PfbParserTest
{
    /**
     * Test parsing a PFB font.
     *
     * @throws IOException 
     */
    @Test
    void testPfb() throws IOException
    {
        InputStream is = new FileInputStream("target/fonts/OpenSans-Regular.pfb");
        Type1Font font = Type1Font.createWithPFB(is);
        is.close();
        Assertions.assertEquals("1.10", font.getVersion());
        Assertions.assertEquals("OpenSans-Regular", font.getFontName());
        Assertions.assertEquals("Open Sans Regular", font.getFullName());
        Assertions.assertTrue(font.getEncoding() instanceof BuiltInEncoding);
    }
}

@@ -1296,16 +1296,45 @@
         
+Type1Font font;%0A        try (
 InputStr
@@ -1402,27 +1402,31 @@
 fb%22)
-;%0A        Type1Font
+)%0A        %7B%0A           
  fon
@@ -1470,19 +1470,9 @@
     
-is.close();
+%7D
 %0A   
@@ -1704,60 +1704,883 @@
 sert
-True(font.getEncoding() instanceof BuiltInEncoding);
+Equals(%22Open Sans%22, font.getFamilyName());%0A        Assertions.assertEquals(%22Digitized data copyright (c) 2010-2011, Google Corporation.%22, font.getNotice());%0A        Assertions.assertEquals(false, font.isFixedPitch());%0A        Assertions.assertEquals(false, font.isForceBold());%0A        Assertions.assertEquals(0, font.getItalicAngle());%0A        Assertions.assertEquals(%22Book%22, font.getWeight());%0A        Assertions.assertTrue(font.getEncoding() instanceof BuiltInEncoding);%0A        Assertions.assertEquals(4498, font.getASCIISegment().length);%0A        Assertions.assertEquals(95911, font.getBinarySegment().length);%0A        Assertions.assertEquals(938, font.getCharStringsDict().size());%0A        for (String s : font.getCharStringsDict().keySet())%0A        %7B%0A            Assertions.assertNotNull(font.getPath(s));%0A            Assertions.assertTrue(font.hasGlyph(s));%0A        %7D
 %0A   

increase test coverage