Package org.foray.fotree.fo.obj

Examples of org.foray.fotree.fo.obj.Block


                "fo/font-family-001.fo");
        final Flow flow = this.getFlow(foTree);

        FObj node = flow.getChildAt(0);
        assertTrue(node instanceof Block);
        Block block = (Block) node;
        String[] fontFamilies = block.traitFontFamily(null);
        assertEquals(1, fontFamilies.length);
        /* The default font-family is "serif". */
        assertEquals("serif", fontFamilies[0]);

        node = flow.getChildAt(1);
        assertTrue(node instanceof Block);
        block = (Block) node;
        fontFamilies = block.traitFontFamily(null);
        assertEquals(1, fontFamilies.length);
        assertEquals("Base14-Courier", fontFamilies[0]);

        final Font font = block.getPrimaryFont(null).getFont();
        assertEquals("Courier", font.getFontName());
    }
View Full Code Here


        final FOTreeBuilder foTree = reader.buildFoTree("fo/font-size-001.fo");
        final Flow flow = this.getFlow(foTree);

        FObj node = flow.getChildAt(0);
        assertTrue(node instanceof Block);
        Block block = (Block) node;
        int fontSize = block.traitFontSize(null);
        /* The default font size is 12 points. */
        assertEquals(12000, fontSize);

        node = flow.getChildAt(1);
        assertTrue(node instanceof Block);
        block = (Block) node;
        fontSize = block.traitFontSize(null);
        assertEquals(8000, fontSize);

        node = flow.getChildAt(2);
        assertTrue(node instanceof Block);
        block = (Block) node;
        final Font font = node.getPrimaryFont(null).getFont();
        assertEquals("Courier", font.getFamilyName());
        assertEquals(426, font.getXHeight(1000));
        final int nominalFontSize = block.traitFontSize(null);
        /* The nominal font-size is 10 pts. */
        assertEquals(10000, nominalFontSize);
        /* The font-size-adjust is .6. */
        final double fontSizeAdjust = block.traitFontSizeAdjust(null);
        assertEquals(.6, fontSizeAdjust, .001);
        /* Actual font size computation, using a basis factor of 1000.
         * 600 / 426 * 10000 = 14085. */
        fontSize = block.traitFontSizeActual(null, font);
        assertEquals(14085, fontSize);
    }
View Full Code Here

        final Flow flow = this.getFlow(foTree);

        /* The second child should be a block ... */
        FObj node = flow.getChildAt(1);
        assertTrue(node instanceof Block);
        final Block block = (Block) node;

        /* ... which contains an InstreamForeignObject ... */
        node = block.getChildAt(0);
        assertTrue(node instanceof InstreamForeignObject);
        final InstreamForeignObject ifo = (InstreamForeignObject) node;

        /* ... which contains an SVGElement ... */
        node = ifo.getChildAt(0);
View Full Code Here

        }
        case BIDI_OVERRIDE: {
            return new BidiOverride(parent, propertyList);
        }
        case BLOCK: {
            return new Block(parent, propertyList);
        }
        case BLOCK_CONTAINER: {
            return new BlockContainer(parent, propertyList);
        }
        case BOOKMARK: {
View Full Code Here

     * @return The initial value for this property.
     */
    public static DtTextDeco getValueNoInstance(final FoContext context,
            final FObj fobj) {
        if (! (fobj instanceof Block)) {
            final Block nearestBlock = fobj.getContainingBlock(context);
            if (nearestBlock == null) {
                return null;
            }
            return nearestBlock.getPropertyList().getTextDecoration(
                    nearestBlock, context);
        }
        return null;
    }
View Full Code Here

        final Leader testLeader = leafToTest.effectiveParent(context)
                .getNearestLeader(context);
        if (thisLeader != testLeader) {
            return null;
        }
        final Block thisBlock =
                this.effectiveParent(context).getContainingBlock(context);
        final Block testBlock = leafToTest.effectiveParent(context)
                .getContainingBlock(context);
        if (thisBlock != testBlock) {
            return null;
        }
        return (CharacterSequence4a) leafToTest;
View Full Code Here

TOP

Related Classes of org.foray.fotree.fo.obj.Block

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.