Package org.pdfbox.afmtypes

Examples of org.pdfbox.afmtypes.KernPair


            else if( START_KERN_PAIRS.equals( nextCommand ) )
            {
                int count = readInt();
                for( int i=0; i<count; i++ )
                {
                    KernPair pair = parseKernPair();
                    fontMetrics.addKernPair( pair );
                }
                String end = readString();
                if( !end.equals( END_KERN_PAIRS ) )
                {
                    throw new IOException( "Error: Expected '" + END_KERN_PAIRS + "' actual '" +
                                                end + "'" );
                }
            }
            else if( START_KERN_PAIRS0.equals( nextCommand ) )
            {
                int count = readInt();
                for( int i=0; i<count; i++ )
                {
                    KernPair pair = parseKernPair();
                    fontMetrics.addKernPair0( pair );
                }
                String end = readString();
                if( !end.equals( END_KERN_PAIRS ) )
                {
                    throw new IOException( "Error: Expected '" + END_KERN_PAIRS + "' actual '" +
                                                end + "'" );
                }
            }
            else if( START_KERN_PAIRS1.equals( nextCommand ) )
            {
                int count = readInt();
                for( int i=0; i<count; i++ )
                {
                    KernPair pair = parseKernPair();
                    fontMetrics.addKernPair1( pair );
                }
                String end = readString();
                if( !end.equals( END_KERN_PAIRS ) )
                {
View Full Code Here


     *
     * @throws IOException If there is an error reading from the stream.
     */
    private KernPair parseKernPair() throws IOException
    {
        KernPair result = new KernPair();
        String cmd = readString();
        if( KERN_PAIR_KP.equals( cmd ) )
        {
            String first = readString();
            String second = readString();
            float x = readFloat();
            float y = readFloat();
            result.setFirstKernCharacter( first );
            result.setSecondKernCharacter( second );
            result.setX( x );
            result.setY( y );
        }
        else if( KERN_PAIR_KPH.equals( cmd ) )
        {
            String first = hexToString( readString() );
            String second = hexToString( readString() );
            float x = readFloat();
            float y = readFloat();
            result.setFirstKernCharacter( first );
            result.setSecondKernCharacter( second );
            result.setX( x );
            result.setY( y );
        }
        else if( KERN_PAIR_KPX.equals( cmd ) )
        {
            String first = readString();
            String second = readString();
            float x = readFloat();
            result.setFirstKernCharacter( first );
            result.setSecondKernCharacter( second );
            result.setX( x );
            result.setY( 0 );
        }
        else if( KERN_PAIR_KPY.equals( cmd ) )
        {
            String first = readString();
            String second = readString();
            float y = readFloat();
            result.setFirstKernCharacter( first );
            result.setSecondKernCharacter( second );
            result.setX( 0 );
            result.setY( y );
        }
        else
        {
            throw new IOException( "Error expected kern pair command actual='" + cmd + "'" );
        }
View Full Code Here

TOP

Related Classes of org.pdfbox.afmtypes.KernPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.