Examples of NormalBlockArea


Examples of org.axsl.area.NormalBlockArea

        if (addNonTextItemToLine(lineArea, nonText, foContext) == 1) {
            // It fit on the line.
            return Status.OK;
        }
        // It did not fit on the line. Create new line & try again.
        final NormalBlockArea blockArea
                = (NormalBlockArea) lineArea.ancestorArea();
        lineArea = blockArea.makeLineArea(false);
        final BlockPL blockPL = this.layout.getBlockPL(blockArea);
        blockPL.setCurrentLineArea(lineArea);

        if (lineArea == null) {
            return Status.AREA_FULL_SOME;
View Full Code Here

Examples of org.axsl.area.NormalBlockArea

    protected LineArea activeLineArea(final AreaNode areaNode)
            throws AreaTreeException {
        if (areaNode instanceof LineArea) {
            return (LineArea) areaNode;
        }
        NormalBlockArea blockArea = null;
        if (areaNode instanceof NormalBlockArea) {
            blockArea = (NormalBlockArea) areaNode;
        } else {
            blockArea = areaNode.ancestorNormalBlockArea();
        }
View Full Code Here

Examples of org.axsl.area.NormalBlockArea

            if (breakBeforeStatus != Status.OK) {
                return breakBeforeStatus;
            }
        }

        NormalBlockArea blockArea;

        if (! this.anythingLaidOut) {
            this.noLayoutCount++;
        }
        if (this.noLayoutCount > this.infLoopThreshhold) {
            throw new AreaTreeException(
                "No meaningful layout in block after many attempts.\n"
                    + "Infinite loop is assumed. Processing halted. Context:\n"
                    + this.node.getContextMessage());
        }

        if (getProgress() == FONodePL.BREAK_AFTER) {
            return Status.OK;
        }

        if (getProgress() == FONodePL.START) {
            // Reset the "loop counter".
            this.noLayoutCount = 0;

            if (areaNode instanceof NormalBlockArea) {
                getLayout().completeCurrentLineInBlock(
                        (NormalBlockArea) areaNode);
            }
            setProgress(0);
        }

        blockArea = bcArea.makeNormalBlockArea(this.node, graftingPoint);

        for (int i = getProgress(); i < this.node.getChildCount(); i++) {
            final Fo fo = this.node.getChildAt(i);
            final FONodePL nodePL = this.getLayoutProxy(fo);

            Status status = null;
            boolean doneProcessingItem = false;
            while (! doneProcessingItem) {
                status = nodePL.layout(blockArea, graftingPoint);
                if (! status.isIncomplete()
                        || status.isPageBreak()) {
                    doneProcessingItem = true;
                    break;
                }
                this.currentLineArea = blockArea.makeLineArea(false);
                if (this.currentLineArea == null) {
                    doneProcessingItem = true;
                }
            }
View Full Code Here

Examples of org.foray.area.NormalBlockArea

        assertEquals(1, firstNormalFlowArea.getChildCount());

        /* The block area. */
        AreaNode node = firstNormalFlowArea.getChildAt(0);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea blockArea = (NormalBlockArea) node;
        assertEquals(1, blockArea.getChildCount());

        /* The only child of the block area is a line area. */
        node = blockArea.getChildAt(0);
        assertTrue(node instanceof LineArea);
        final LineArea lineArea = (LineArea) node;
        assertEquals(3, lineArea.getChildCount());

        /* The first child of the line area is a text area. */
 
View Full Code Here

Examples of org.foray.area.NormalBlockArea

                areaTree);

        /* The block area. */
        AreaNode node = firstNormalFlowArea.getChildAt(0);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea blockArea = (NormalBlockArea) node;
        final FontUse font = blockArea.getPrimaryFont();
        assertEquals("Courier", font.getFont().getPostscriptName());
        assertEquals(12000, blockArea.traitFontSize());

        /* The first child of the block area is a line-area. */
        node = blockArea.getChildAt(0);
        assertTrue(node instanceof LineArea);
        final LineArea lineArea = (LineArea) node;
        final int lineY = lineArea.alignmentPointY();

        /* The second child of the line area is an inline-area. */
 
View Full Code Here

Examples of org.foray.area.NormalBlockArea

                areaTree);

        /* The outer block area. */
        AreaNode node = firstNormalFlowArea.getChildAt(0);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea outerBlockArea = (NormalBlockArea) node;
        /* 1 inch left margin. */
        assertEquals(72000, outerBlockArea.crOriginX());
        /* 10 inches from bottom (11 inches high, 1 inch top margin). */
        assertEquals(720000, outerBlockArea.crOriginY());
        /* Page is 8 inches wide, with 2 inches total margin.
         * 6 * 72,000 = 432,000. */
        assertEquals(432000, outerBlockArea.crIpd());

        /* The first child of the outer block area is a line-area. */
        node = outerBlockArea.getChildAt(0);
        assertTrue(node instanceof LineArea);
        LineArea lineArea = (LineArea) node;
        /* Should have anterior space of one half-leading, which comes from the
         * space-before of this line. */
        assertEquals(1200, lineArea.getAnteriorSpace());
        /* Same as parent. */
        assertEquals(72000, lineArea.crOriginX());
        /* Same as parent, but adjusted for a half-leading space-before.
         * Default leading is 20% of the font-size, which is 12 points.
         * 50% * 20% * 12,000 = 1,200.
         * 720,000 - 1,200 = 718,800. */
        assertEquals(718800, lineArea.crOriginY());
        /* Same as parent. */
        assertEquals(432000, lineArea.crIpd());
        /* Default font-size is 12 points. */
        assertEquals(12000, lineArea.crBpd());

        /* The second child of the outer block area is a block-area. */
        node = outerBlockArea.getChildAt(1);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea insideBlockArea = (NormalBlockArea) node;
        /* Should have anterior space of one half-leading, which comes from the
         * space-after of the previous line. */
        assertEquals(1200, insideBlockArea.getAnteriorSpace());
        /* Same as parent. */
        assertEquals(72000, insideBlockArea.crOriginX());
        /* Computed as that for the previous line, adjusted for one line,
         * including another half-leading, the space-after for that line.
         * 718,800 - 12,000 - 1,200 = 705,600. */
        assertEquals(705600, insideBlockArea.crOriginY());
        /* Same as parent. */
        assertEquals(432000, insideBlockArea.crIpd());
        /* Height of 0, as it has no content. */
        assertEquals(0, insideBlockArea.crBpd());

        /* The third child of the outer block area is another line-area. */
        node = outerBlockArea.getChildAt(2);
        assertTrue(node instanceof LineArea);
        lineArea = (LineArea) node;
View Full Code Here

Examples of org.foray.area.NormalBlockArea

                areaTree);

        /* Test location and dimensions of the block area. */
        AreaNode node = firstNormalFlowArea.getChildAt(0);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea blockArea = (NormalBlockArea) node;
        /* 1 inch left margin. */
        assertEquals(72000, blockArea.crOriginX());
        /* 10 inches from bottom (11 inches high, 1 inch top margin). */
        assertEquals(720000, blockArea.crOriginY());
        /* Page is 8.5 inches wide, with 2 inches total margin.
         * 6.5 * 72,000 = 468,000. */
        assertEquals(468000, blockArea.crIpd());

        /* Test location and dimensions of the line area. */
        node = blockArea.getChildAt(0);
        assertTrue(node instanceof LineArea);
        final LineArea lineArea = (LineArea) node;
        /* x same as the parent block. */
        assertEquals(72000, lineArea.crOriginX());
        /* y adjusted for half-leading = 12,000 * .2 * .5 = 1200. */
 
View Full Code Here

Examples of org.foray.area.NormalBlockArea

                areaTree);

        /* Test location and dimensions of the block area. */
        AreaNode node = firstNormalFlowArea.getChildAt(0);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea blockArea = (NormalBlockArea) node;
        /* 1 inch left margin. */
        assertEquals(72000, blockArea.crOriginX());
        /* 10 inches from bottom (11 inches high, 1 inch top margin). */
        assertEquals(720000, blockArea.crOriginY());
        /* Page is 8.5 inches wide, with 2 inches total margin.
         * 6.5 * 72,000 = 468,000. */
        assertEquals(468000, blockArea.crIpd());

        /* Test location and dimensions of the line area. */
        node = blockArea.getChildAt(0);
        assertTrue(node instanceof LineArea);
        final LineArea lineArea = (LineArea) node;
        /* x same as the parent block. */
        assertEquals(72000, lineArea.crOriginX());
        /* y adjusted for half-leading = 12,000 * .2 * .5 = 1200. */
 
View Full Code Here

Examples of org.foray.area.NormalBlockArea

        final NormalFlowRA firstNormalFlowArea = this.getFirstNormalFlowArea(
                areaTree);

        final AreaNode node = firstNormalFlowArea.getChildAt(0);
        assertTrue(node instanceof NormalBlockArea);
        final NormalBlockArea blockArea = (NormalBlockArea) node;
        assertEquals(72000, blockArea.brOriginX());
        assertEquals(720000, blockArea.brOriginY());
        assertEquals(432000, blockArea.brIpd());

        assertEquals(72500, blockArea.prOriginX());
        assertEquals(719500, blockArea.prOriginY());
        assertEquals(431000, blockArea.prIpd());

        assertEquals(72500, blockArea.crOriginX());
        assertEquals(719500, blockArea.crOriginY());
        assertEquals(431000, blockArea.crIpd());
    }
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.