Examples of MacRomanEncoding


Examples of org.apache.fontbox.encoding.MacRomanEncoding

        isFixedPitch = data.readUnsignedInt();
        minMemType42 = data.readUnsignedInt();
        maxMemType42 = data.readUnsignedInt();
        mimMemType1 = data.readUnsignedInt();
        maxMemType1 = data.readUnsignedInt();
        MacRomanEncoding encoding = new MacRomanEncoding();
       
       
        if( formatType == 1.0f )
        {
            /*
             * This TrueType font file contains exactly the 258 glyphs in the standard
             * Macintosh TrueType.
             */
            glyphNames = new String[258];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( i );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
        }
        else if( formatType == 2.0f )
        {
            int numGlyphs = data.readUnsignedShort();
            int[] glyphNameIndex = new int[numGlyphs];
            glyphNames = new String[ numGlyphs ];
            int maxIndex = Integer.MIN_VALUE;
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = data.readUnsignedShort();
                glyphNameIndex[i] = index;
                // PDFBOX-808: Index numbers between 32768 and 65535 are
                // reserved for future use, so we should just ignore them
                if (index <= 32767) {
                    maxIndex = Math.max( maxIndex, index );
                }
            }
            String[] nameArray = null;
            if( maxIndex >= 258 )
            {
                nameArray = new String[ maxIndex-258 +1 ];
                for( int i=0; i<maxIndex-258+1; i++ )
                {
                    int numberOfChars = data.read();
                    nameArray[i]=data.readString( numberOfChars );
                }
            }
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = glyphNameIndex[i];
                if( index < 258 )
                {
                    glyphNames[i] = encoding.getName( index );
                }
                else if( index >= 258 && index <= 32767 )
                {
                    glyphNames[i] = nameArray[index-258];
                }
                else
                {
                    // PDFBOX-808: Index numbers between 32768 and 65535 are
                    // reserved for future use, so we should just ignore them
                    glyphNames[i] = ".undefined";
                }
            }
        }
        else if( formatType == 2.5f )
        {
            int[] glyphNameIndex = new int[maxp.getNumGlyphs()];
            for( int i=0; i<glyphNameIndex.length; i++)
            {
                int offset = data.readSignedByte();
                glyphNameIndex[i] = i+1+offset;
            }
            glyphNames = new String[glyphNameIndex.length];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( glyphNameIndex[i] );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
View Full Code Here

Examples of org.apache.fontbox.encoding.MacRomanEncoding

        isFixedPitch = data.readUnsignedInt();
        minMemType42 = data.readUnsignedInt();
        maxMemType42 = data.readUnsignedInt();
        mimMemType1 = data.readUnsignedInt();
        maxMemType1 = data.readUnsignedInt();
        MacRomanEncoding encoding = new MacRomanEncoding();
       
       
        if( formatType == 1.0f )
        {
            /*
             * This TrueType font file contains exactly the 258 glyphs in the standard
             * Macintosh TrueType.
             */
            glyphNames = new String[258];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( i );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
        }
        else if( formatType == 2.0f )
        {
            int numGlyphs = data.readUnsignedShort();
            int[] glyphNameIndex = new int[numGlyphs];
            glyphNames = new String[ numGlyphs ];
            int maxIndex = Integer.MIN_VALUE;
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = data.readUnsignedShort();
                glyphNameIndex[i] = index;
                maxIndex = Math.max( maxIndex, index );
            }
            String[] nameArray = null;
            if( maxIndex >= 258 )
            {
                nameArray = new String[ maxIndex-258 +1 ];
                for( int i=0; i<maxIndex-258+1; i++ )
                {
                    int numberOfChars = data.read();
                    nameArray[i]=data.readString( numberOfChars );
                }
            }
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = glyphNameIndex[i];
                if( index < 258 )
                {
                    glyphNames[i] = encoding.getName( index );
                }
                else if( index >= 258 && index <= 32767 )
                {
                    glyphNames[i] = nameArray[index-258];
                }
                else
                {
                    throw new IOException( "Unknown glyph name index:" + index );
                }
            }
        }
        else if( formatType == 2.5f )
        {
            int[] glyphNameIndex = new int[maxp.getNumGlyphs()];
            for( int i=0; i<glyphNameIndex.length; i++)
            {
                int offset = data.readSignedByte();
                glyphNameIndex[i] = i+1+offset;
            }
            glyphNames = new String[glyphNameIndex.length];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( glyphNameIndex[i] );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
View Full Code Here

Examples of org.apache.pdfbox.encoding.MacRomanEncoding

    private static Encoding getEncodingObject(String encodingName)
    {
        Encoding encoding = new StandardEncoding();
        if (FONT_DICTIONARY_VALUE_ENCODING_MAC.equals(encodingName))
        {
            encoding = new MacRomanEncoding();
        }
        else if (FONT_DICTIONARY_VALUE_ENCODING_MAC_EXP.equals(encodingName))
        {
            encoding = new MacRomanEncoding();
        }
        else if (FONT_DICTIONARY_VALUE_ENCODING_WIN.equals(encodingName))
        {
            encoding = new WinAnsiEncoding();
        }
View Full Code Here

Examples of org.apache.pdfbox.encoding.MacRomanEncoding

    this.labelToCid.put(NOTDEF, -1);
   
   
    // ---- Instantiate the Encoding Map
    if (FONT_DICTIONARY_VALUE_ENCODING_MAC.equals(encodingName)) {
      this.encoding = new MacRomanEncoding();
    } else if (FONT_DICTIONARY_VALUE_ENCODING_MAC_EXP.equals(encodingName)) {
      this.encoding = new MacRomanEncoding();
    } else if (FONT_DICTIONARY_VALUE_ENCODING_WIN.equals(encodingName)) {
      this.encoding = new WinAnsiEncoding();
    } else if (FONT_DICTIONARY_VALUE_ENCODING_PDFDOC.equals(encodingName)) {
      this.encoding = new PdfDocEncoding();
    } else {
View Full Code Here

Examples of org.apache.pdfbox.encoding.MacRomanEncoding

  }

  private static Encoding getEncodingObject(String encodingName) {
    Encoding encoding = new StandardEncoding();
    if (FONT_DICTIONARY_VALUE_ENCODING_MAC.equals(encodingName)) {
      encoding = new MacRomanEncoding();
    } else if (FONT_DICTIONARY_VALUE_ENCODING_MAC_EXP.equals(encodingName)) {
      encoding = new MacRomanEncoding();
    } else if (FONT_DICTIONARY_VALUE_ENCODING_WIN.equals(encodingName)) {
      encoding = new WinAnsiEncoding();
    } else if (FONT_DICTIONARY_VALUE_ENCODING_PDFDOC.equals(encodingName)) {
      encoding = new PdfDocEncoding();
    }
View Full Code Here

Examples of org.apache.pdfbox.encoding.MacRomanEncoding

    private static Encoding getEncodingObject(String encodingName)
    {
        Encoding encoding = new StandardEncoding();
        if (FONT_DICTIONARY_VALUE_ENCODING_MAC.equals(encodingName))
        {
            encoding = new MacRomanEncoding();
        }
        else if (FONT_DICTIONARY_VALUE_ENCODING_MAC_EXP.equals(encodingName))
        {
            encoding = new MacRomanEncoding();
        }
        else if (FONT_DICTIONARY_VALUE_ENCODING_WIN.equals(encodingName))
        {
            encoding = new WinAnsiEncoding();
        }
View Full Code Here

Examples of org.fontbox.encoding.MacRomanEncoding

        isFixedPitch = data.readUnsignedInt();
        minMemType42 = data.readUnsignedInt();
        maxMemType42 = data.readUnsignedInt();
        mimMemType1 = data.readUnsignedInt();
        maxMemType1 = data.readUnsignedInt();
        MacRomanEncoding encoding = new MacRomanEncoding();
       
       
        if( formatType == 1.0f )
        {
            /*
             * This TrueType font file contains exactly the 258 glyphs in the standard
             * Macintosh TrueType.
             */
            glyphNames = new String[258];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( i );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
        }
        else if( formatType == 2.0f )
        {
            int numGlyphs = data.readUnsignedShort();
            int[] glyphNameIndex = new int[numGlyphs];
            glyphNames = new String[ numGlyphs ];
            int maxIndex = Integer.MIN_VALUE;
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = data.readUnsignedShort();
                glyphNameIndex[i] = index;
                maxIndex = Math.max( maxIndex, index );
            }
            String[] nameArray = null;
            if( maxIndex >= 258 )
            {
                nameArray = new String[ maxIndex-258 +1 ];
                for( int i=0; i<maxIndex-258+1; i++ )
                {
                    int numberOfChars = data.read();
                    nameArray[i]=data.readString( numberOfChars );
                }
            }
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = glyphNameIndex[i];
                if( index < 258 )
                {
                    glyphNames[i] = encoding.getName( index );
                }
                else if( index >= 258 && index <= 32767 )
                {
                    glyphNames[i] = nameArray[index-258];
                }
                else
                {
                    throw new IOException( "Unknown glyph name index:" + index );
                }
            }
        }
        else if( formatType == 2.5f )
        {
            int[] glyphNameIndex = new int[maxp.getNumGlyphs()];
            for( int i=0; i<glyphNameIndex.length; i++)
            {
                int offset = data.readSignedByte();
                glyphNameIndex[i] = i+1+offset;
            }
            glyphNames = new String[glyphNameIndex.length];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( glyphNameIndex[i] );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
View Full Code Here

Examples of org.fontbox.encoding.MacRomanEncoding

        isFixedPitch = data.readUnsignedInt();
        minMemType42 = data.readUnsignedInt();
        maxMemType42 = data.readUnsignedInt();
        mimMemType1 = data.readUnsignedInt();
        maxMemType1 = data.readUnsignedInt();
        MacRomanEncoding encoding = new MacRomanEncoding();
       
       
        if( formatType == 1.0f )
        {
            /*
             * This TrueType font file contains exactly the 258 glyphs in the standard
             * Macintosh TrueType.
             */
            glyphNames = new String[258];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( i );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
        }
        else if( formatType == 2.0f )
        {
            int numGlyphs = data.readUnsignedShort();
            int[] glyphNameIndex = new int[numGlyphs];
            glyphNames = new String[ numGlyphs ];
            int maxIndex = Integer.MIN_VALUE;
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = data.readUnsignedShort();
                glyphNameIndex[i] = index;
                maxIndex = Math.max( maxIndex, index );
            }
            String[] nameArray = null;
            if( maxIndex >= 258 )
            {
                nameArray = new String[ maxIndex-258 +1 ];
                for( int i=0; i<maxIndex-258+1; i++ )
                {
                    int numberOfChars = data.read();
                    nameArray[i]=data.readString( numberOfChars );
                }
            }
            for( int i=0; i<numGlyphs; i++ )
            {
                int index = glyphNameIndex[i];
                if( index < 258 )
                {
                    glyphNames[i] = encoding.getName( index );
                }
                else if( index >= 258 && index <= 32767 )
                {
                    glyphNames[i] = nameArray[index-258];
                }
                else
                {
                    throw new IOException( "Unknown glyph name index:" + index );
                }
            }
        }
        else if( formatType == 2.5f )
        {
            int[] glyphNameIndex = new int[maxp.getNumGlyphs()];
            for( int i=0; i<glyphNameIndex.length; i++)
            {
                int offset = data.readSignedByte();
                glyphNameIndex[i] = i+1+offset;
            }
            glyphNames = new String[glyphNameIndex.length];
            for( int i=0; i<glyphNames.length; i++)
            {
                String name = encoding.getName( glyphNameIndex[i] );
                if( name != null )
                {
                    glyphNames[i] = name;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.