Package org.foray.area

Examples of org.foray.area.LineArea


        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. */
        node = lineArea.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea1 = (TextArea) node;
        assertEquals("Lighter(1), ", textArea1.getText().toString());

        /* The second child of the line area is the outside inline area. */
        node = lineArea.getChildAt(1);
        assertTrue(node instanceof InlineArea);
        final InlineArea inlineArea1 = (InlineArea) node;
        assertEquals(3, inlineArea1.getChildCount());

        /* The first child of the outside inline area is a text area. */
        node = inlineArea1.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea2 = (TextArea) node;
        assertEquals("Bolder(1), ", textArea2.getText().toString());

        /* The second child of the outside inline area is the inside inline area. */
        node = inlineArea1.getChildAt(1);
        assertTrue(node instanceof InlineArea);
        final InlineArea inlineArea2 = (InlineArea) node;
        assertEquals(1, inlineArea2.getChildCount());

        /* The first and only child of the inside inline area is a text area. */
        node = inlineArea2.getChildAt(0);
        assertTrue(node instanceof TextArea);
        final TextArea textArea3 = (TextArea) node;
        final String textArea3Text = textArea3.getText().toString();
        assertEquals("Lighter(2), ", textArea3Text);

        /* The third child of the outside inline area is another text area. */
        node = inlineArea1.getChildAt(2);
        assertTrue(node instanceof TextArea);
        final TextArea textArea4 = (TextArea) node;
        assertEquals("Bolder(2), ", textArea4.getText().toString());

        /* The third child of the line area is another text area. */
        node = lineArea.getChildAt(2);
        assertTrue(node instanceof TextArea);
        final TextArea textArea5 = (TextArea) node;
        assertEquals("Lighter(3).", textArea5.getText().toString());

    }
View Full Code Here


        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. */
        node = lineArea.getChildAt(1);
        assertTrue(node instanceof InlineArea);
        final InlineArea inlineArea = (InlineArea) node;
        final int inlineY = inlineArea.baselineY();

        /* The current algorithm for computing the "super" baseline shift for the Base14-Courier
View Full Code Here

        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;
        /* 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 the previous block, adjusted for an additional half-leading.
         * 705,600 - 1,200 = 704,400. */
        assertEquals(704400, lineArea.crOriginY());
        /* Same as parent. */
        assertEquals(432000, lineArea.crIpd());
        /* Same as the first line. */
        assertEquals(12000, lineArea.crBpd());

        /* The fourth child of the outer block area is another line-area. */
        node = outerBlockArea.getChildAt(3);
        assertTrue(node instanceof LineArea);
        lineArea = (LineArea) node;
        /* Should have anterior space of two half-leadings, one from the space-
         * after of the previous line, one from the space-before of this
         * line. */
        assertEquals(2400, lineArea.getAnteriorSpace());
        /* Same as parent. */
        assertEquals(72000, lineArea.crOriginX());
        /* Same as the previous line, adjusted for one line and two
         * half-leadings.
         * 704,400 - 12,000 - 1,200 - 1,200 = 690,000. */
        assertEquals(690000, lineArea.crOriginY());
        /* Same as parent. */
        assertEquals(432000, lineArea.crIpd());
        /* Same as the other lines. */
        assertEquals(12000, lineArea.crBpd());
    }
View Full Code Here

        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. */
        assertEquals(718800, lineArea.crOriginY());
        /* ipd same as parent block. */
        assertEquals(468000, lineArea.crIpd());

        /* Test location and dimensions of the text area. The key thing we are
         * 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()}. */
 
View Full Code Here

        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. */
        assertEquals(718800, lineArea.crOriginY());
        /* ipd same as parent block. */
        assertEquals(468000, lineArea.crIpd());

        /* Test location and dimensions of the text area. The key thing we are
         * 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()}.
View Full Code Here

TOP

Related Classes of org.foray.area.LineArea

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.