Package org.foray.font

Examples of org.foray.font.FreeStandingFont


    /**
     * {@inheritDoc}
     */
    public int[] getFontBoundingBox() {
        final FreeStandingFont font = getFreeStandingFont();
        if (font == null) {
            return null;
        }
        return font.getFontBBox();
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    public int getFlags() {
        final FreeStandingFont font = getFreeStandingFont();
        if (font == null) {
            return 0;
        }
        return font.getFlags();
    }
View Full Code Here

            return null;
        }
        if (! (getFOrayFont() instanceof FreeStandingFont)) {
            return null;
        }
        final FreeStandingFont fsf = (FreeStandingFont) getFOrayFont();
        byte[] embeddableFont = null;
        try {
            embeddableFont = fsf.getRawFontFile(this.fontUse);
        } catch (final IOException e) {
            this.getLogger().fatal("Failed to get contents for "
                    + fsf.getPostscriptName() + ": " + e.getMessage());
        }
        return embeddableFont;
    }
View Full Code Here

     * For fonts that have been subsetted, only the characters that are
     * included in the subset are returned.
     * @see FontPdf#getWidths()
     */
    public short[] getWidths() {
        final FreeStandingFont fsf = this.getFreeStandingFont();
        if (fsf == null) {
            return null;
        }
        if (fsf.getFontComplexity() != Font.Complexity.SIMPLE) {
            final Subset subset = this.fontUse.getSubset();
            if (subset == null) {
                return fsf.getWidths();
            }
            return getSubsetWidths();
        }
        final Encoding encoding = this.fontUse.getEncoding();
        final CharSet charSet = fsf.getCharSet();
        final int firstIndex = encoding.getFirstIndex();
        final int lastIndex = encoding.getLastIndex();
        final int size = lastIndex - firstIndex + 1;
        final short[] widthsByFontIndex = new short[size];
        for (int i = firstIndex; i <= lastIndex; i++) {
            // Decode the character for this index
            final int codePoint = encoding.decodeCharacter(i);
            // Find the charSet index for that character.
            final int charSetIndex = charSet.getIndex(codePoint);
            if (charSetIndex < 0) {
                continue;
            }
            // Find the width for that charSet index.
            final short width = fsf.getWidths()[charSetIndex];
            // Set the current array element to that width
            widthsByFontIndex[i - firstIndex] = width;
        }
        return widthsByFontIndex;
    }
View Full Code Here

    protected FreeStandingFont getHelveticaFont() throws FontException {
        final FontServer4a fontServer = getFontServer();
        assertNotNull(fontServer);
        final RegisteredFont rf = fontServer.getRegisteredFont("Base14-Helvetica");
        assertNotNull(rf);
        final FreeStandingFont fsf = rf.getFreeStandingFont();
        assertNotNull(fsf);
        return fsf;
    }
View Full Code Here

         * testing here is that IT IS CENTERED. */
        node = lineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea = (TextArea) node;

        final FreeStandingFont fsf = getHelveticaFont();
        /* The following computation is tested in {@link TestFont4a#testWidth()}. */
        final int textWidth = fsf.width("Test of Centering", 12000, 0, 0, true);
        assertEquals(textWidth, textArea.crIpd());

        /* The x value of the text area content rectangle should be at the x
         * location of the parent line area + 1/2 of the unused area in the
         * line. Total line area ipd = 468,000. Unused line area ipd =
View Full Code Here

         * testing here is that IT IS CENTERED. */
        node = lineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea = (TextArea) node;

        final FreeStandingFont fsf = getHelveticaFont();
        /* The following computation is tested in {@link TestFont4a#testWidth()}.
         * The extra word spacing is .3em = .3 * 12000 = 3600. */
        final int textWidth = fsf.width("Centered with Word Spacing", 12000, 0, 3600, true);
        assertEquals(textWidth, textArea.crIpd());

        /* The x value of the text area content rectangle should be at the x
         * location of the parent line area + 1/2 of the unused area in the
         * line. Total line area ipd = 468,000. Unused line area ipd =
View Full Code Here

TOP

Related Classes of org.foray.font.FreeStandingFont

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.