Package org.foray.font.format

Examples of org.foray.font.format.FontFileReader


     */
    public Type1File getType1File() {
        if (this.type1File != null) {
            return this.type1File;
        }
        final FontFileReader reader = getRegisteredFont().getFontFileReader();
        if (reader.getFileFormat() == FontFileReader.FILEFORMAT_TYPE1_PFB) {
            this.type1File = new Type1PFBFile(getRegisteredFont()
                    .getFontFileReader());
        } else if (reader.getFileFormat() ==
                FontFileReader.FILEFORMAT_TYPE1_PFA) {
            this.type1File = new Type1PFAFile(getRegisteredFont()
                    .getFontFileReader());
        } else {
            final String message = "Attempted to parse unknown Type1 font "
                + "type.\n" + reader.getDescription();
            this.getLogger().fatal(message);
        }
        return this.type1File;
    }
View Full Code Here


        if (url == null) {
            getLogger().error("Unable to create URL:\n  " + file.getAbsolutePath());
            this.failureCount ++;
            return;
        }
        FontFileReader reader = null;
        try {
            reader = new FontFileReader(this.fontServer, url);
        } catch (final IOException e) {
            getLogger().error(e.getMessage());
            this.failureCount ++;
            return;
        } catch (final FontException e) {
            getLogger().error(e.getMessage());
            this.failureCount ++;
            return;
        }
        this.successCount ++;
        final FontFile fontFile = reader.createFontFile();
        if (! (fontFile == null)) {
            processFontFile(file, fontFile);
            return;
        }
        /* TODO: See if it is metrics file & try to match it up with a Type1
View Full Code Here

    /**
     * Returns the font content as a stream.
     * @return The font content as a stream.
     */
    protected InputStream getFontInputStream() {
        final FontFileReader fontFileReader =
                this.getRegisteredFont().getFontFileReader();
        if (fontFileReader == null) {
            return null;
        }
        InputStream instream = null;
        try {
            instream = fontFileReader.getInputStream();
        } catch (final IOException e1) {
            this.getLogger().fatal("Unable to embed: "
                    + fontFileReader.getDescription());
        }
        return instream;
    }
View Full Code Here

            final URL metricsFileURL, final String collectionID,
            final String embed, final String systemName) throws FontException {
        if (! isUsableFont(systemName, fontFileURL, metricsFileURL)) {
            return;
        }
        FontFileReader fontFileReader = null;
        if (fontFileURL != null) {
            try {
                fontFileReader = new FontFileReader(this, fontFileURL);
            } catch (final IOException e) {
                throw new FontException(e);
            }
        }
        MetricsFileReader metricsFileReader = null;
View Full Code Here

            final byte[] metricsFileContents, final String collectionID,
            final String embed, final String systemName) throws FontException {
        if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) {
            return;
        }
        FontFileReader fontFileReader = null;
        if (fontFileContents != null) {
            try {
                fontFileReader = new FontFileReader(this, fontFileDescription, fontFileContents);
            } catch (final IOException e) {
                throw new FontException(e);
            }
        }
        MetricsFileReader metricsFileReader = null;
View Full Code Here

        final int fontFormat = fsf.getAWTFontFormat();
        if (fontFormat < 0) {
            /* An AWT font cannot be created from this font file. */
            return null;
        }
        final FontFileReader fontFileReader =
            this.getRegisteredFont().getFontFileReader();
        Font newFont = null;
        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Create AWT font from: \n  "
                    + fontFileReader.getDescription());
        }
        InputStream fontStream = null;
        try {
            fontStream = fontFileReader.getInputStream();
            newFont = Font.createFont(fontFormat, fontStream);
        } catch (final IOException e) {
            throw new FontException("Error reading input stream for: \n  "
                    + fontFileReader.getDescription(), e);
        } catch (final IllegalArgumentException iae) {
            /* Ignore this. This just means that the fontFormat is not one that
             * java recognizes, probably because the runtime is lower than
             * java 1.5. The proper things to do is just return null.*/
        } catch (final FontFormatException ffe) {
View Full Code Here

TOP

Related Classes of org.foray.font.format.FontFileReader

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.