Examples of KnuthPenalty


Examples of org.apache.fop.layoutmgr.KnuthPenalty

        if (commonBorderPaddingBackground != null) {
            int ipStart = commonBorderPaddingBackground.getBorderStartWidth(false)
                         + commonBorderPaddingBackground.getPaddingStart(false, this);
            if (ipStart > 0) {
                // Add a non breakable glue
                returnList.add(new KnuthPenalty(0, KnuthPenalty.INFINITE,
                                                false, new LeafPosition(this, -1), true));
                returnList.add(new KnuthGlue(ipStart, 0, 0, new LeafPosition(this, -1), true));
            }
        }
    }
View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

        if (commonBorderPaddingBackground != null) {
            int ipEnd = commonBorderPaddingBackground.getBorderEndWidth(false)
                        + commonBorderPaddingBackground.getPaddingEnd(false, this);
            if (ipEnd > 0) {
                // Add a non breakable glue
                returnList.add(new KnuthPenalty(0, KnuthPenalty.INFINITE,
                                                false, new LeafPosition(this, -1), true));
                returnList.add(new KnuthGlue(ipEnd, 0, 0, new LeafPosition(this, -1), true));
            }
        }
    }
View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

        nLastLines = 3;
        */

        if (nLastLines != 0
            && (nConditionalOptionalLines > 0 || nConditionalEliminableLines > 0)) {
            breaker.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
            breaker.add(new KnuthGlue(0, -nConditionalOptionalLines * constantLineHeight,
                                        -nConditionalEliminableLines * constantLineHeight,
                                        LINE_NUMBER_ADJUSTMENT, elementPosition, false));
            breaker.add(new KnuthPenalty(nConditionalOptionalLines * constantLineHeight,
                                           0, false, elementPosition, false));
            breaker.add(new KnuthGlue(0, nConditionalOptionalLines * constantLineHeight,
                                        nConditionalEliminableLines * constantLineHeight,
                                        LINE_NUMBER_ADJUSTMENT, elementPosition, false));
        } else if (nLastLines != 0) {
            breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false));
        }

        //log.debug("first=" + nFirstLines + " inner=" + nInnerLines
        //                   + " optional=" + nOptionalLines + " eliminable=" + nEliminableLines
        //                   + " last=" + nLastLines
        //                   + " (condOpt=" + nConditionalOptionalLines + " condEl=" + nConditionalEliminableLines + ")");

        // creation of the elements:
        // first group of lines
        list.add(new KnuthBox(nFirstLines * constantLineHeight, elementPosition,
                              (nLastLines == 0
                               && nConditionalOptionalLines == 0
                               && nConditionalEliminableLines == 0 ? true : false)));
        if (nConditionalOptionalLines > 0
            || nConditionalEliminableLines > 0) {
            list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
            list.add(new KnuthGlue(0, nConditionalOptionalLines * constantLineHeight,
                                   nConditionalEliminableLines * constantLineHeight,
                                   LINE_NUMBER_ADJUSTMENT, elementPosition, false));
            list.add(new KnuthBox(0, elementPosition,
                                  (nLastLines == 0 ? true : false)));
        }

        // optional lines
        for (int i = 0; i < nOptionalLines; i++) {
            list.addAll(breaker);
            list.add(new KnuthBox(0, elementPosition, false));
            list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
            list.add(new KnuthGlue(0, 1 * constantLineHeight, 0,
                                   LINE_NUMBER_ADJUSTMENT, elementPosition, false));
            list.add(new KnuthBox(0, elementPosition, false));
        }

        // eliminable lines
        for (int i = 0; i < nEliminableLines; i++) {
            list.addAll(breaker);
            list.add(new KnuthBox(1 * constantLineHeight, elementPosition, false));
            list.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, elementPosition, false));
            list.add(new KnuthGlue(0, 0, 1 * constantLineHeight,
                                   LINE_NUMBER_ADJUSTMENT, elementPosition, false));
            list.add(new KnuthBox(0, elementPosition, false));
        }

View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

            for (int i = 0; i < llPoss.getChosenLineCount(); i++) {
                if (!((BlockLevelLayoutManager) parentLM).mustKeepTogether()
                    && i >= fobj.getOrphans()
                    && i <= llPoss.getChosenLineCount() - fobj.getWidows()) {
                    // null penalty allowing a page break between lines
                    returnList.add(new KnuthPenalty(0, 0, false, new Position(this), false));
                }
                LineBreakPosition lbp = (LineBreakPosition) llPoss.getChosenPosition(i);
                //log.debug("LLM.getChangedKnuthElements> lineWidth= " + lbp.lineWidth + " difference= " + lbp.difference);
                //log.debug("                             shrink= " + lbp.availableShrink + " stretch= " + lbp.availableStretch);
View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

            if (this.size() > ignoreAtStart) {
                if (textAlignment == EN_CENTER
                    && textAlignmentLast != EN_JUSTIFY) {
                    this.add(new KnuthGlue(0, 3 * DEFAULT_SPACE_WIDTH, 0,
                                           null, false));
                    this.add(new KnuthPenalty(lineFiller.opt, -KnuthElement.INFINITE,
                                              false, null, false));
                    ignoreAtEnd = 2;
                } else if (textAlignmentLast != EN_JUSTIFY) {
                    // add the elements representing the space
                    // at the end of the last line
                    // and the forced break
                    this.add(new KnuthPenalty(0, KnuthElement.INFINITE,
                                              false, null, false));
                    this.add(new KnuthGlue(0,
                            lineFiller.max - lineFiller.opt,
                            lineFiller.opt - lineFiller.min, null, false));
                    this.add(new KnuthPenalty(lineFiller.opt, -KnuthElement.INFINITE,
                                              false, null, false));
                    ignoreAtEnd = 3;
                } else {
                    // add only the element representing the forced break
                    this.add(new KnuthPenalty(lineFiller.opt, -KnuthElement.INFINITE,
                                              false, null, false));
                    ignoreAtEnd = 1;
                }
                return this;
            } else {
View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

     * @throws Exception if the test fails
     */
    public void testRemoveElementPenalty1() throws Exception {
        LinkedList lst = new LinkedList();
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 0, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 200, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 0, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
        lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
        lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
       
        boolean res = ElementListUtils.removeLegalBreaks(lst, 9000);
       
        assertFalse(res);

View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthGlue(0, 0, 0, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthGlue(0, 0, 0, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
        lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
        lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
       
        boolean res = ElementListUtils.removeLegalBreaks(lst, 9000);
       
        assertFalse(res);
       
View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

     * @throws Exception if the test fails
     */
    public void testRemoveElementFromEndPenalty1() throws Exception {
        LinkedList lst = new LinkedList();
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 0, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 200, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 0, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
        lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
        lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
       
        boolean res = ElementListUtils.removeLegalBreaksFromEnd(lst, 9000);
       
        assertFalse(res);

View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

     * @throws Exception if the test fails
     */
    public void testRemoveElementFromEndPenalty2() throws Exception {
        LinkedList lst = new LinkedList();
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 0, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, 200, false, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthGlue(0, 0, 0, null, false));
        lst.add(new KnuthBox(4000, null, false));
        lst.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, null, false));
        lst.add(new KnuthGlue(0, Integer.MAX_VALUE, 0, null, false));
        lst.add(new KnuthPenalty(0, -KnuthElement.INFINITE, false, null, false));
       
        boolean res = ElementListUtils.removeLegalBreaksFromEnd(lst, 9000);
       
        assertFalse(res);

View Full Code Here

Examples of org.apache.fop.layoutmgr.KnuthPenalty

            primaryGridUnit.setBreakBefore(((KnuthPenalty) returnList.getFirst()).getBreakClass());
            returnList.removeFirst();
            assert !returnList.isEmpty();
        }
        if (((KnuthElement) returnList.getLast()).isForcedBreak()) {
            KnuthPenalty p = (KnuthPenalty) returnList.getLast();
            primaryGridUnit.setBreakAfter(p.getBreakClass());
            p.setP(0);
        }

        getPSLM().notifyEndOfLayout(((TableCell)getFObj()).getId());

        setFinished(true);
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.