Package org.apache.fop.datatypes

Examples of org.apache.fop.datatypes.Length


                return p;
            }
           
            if (this.propId == PR_BLOCK_PROGRESSION_DIMENSION
                    || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
                Length len = p.getLength();
                if (len != null) {
                    if (isNegativeLength(len)) {
                        log.warn(FObj.decorateWithContextInfo(
                                "Replaced negative value (" + len + ") for " + getName()
                                + " with 0mpt", fo));
View Full Code Here


        protected Property setSubprop(Property baseProperty, int subpropertyId,
                                        Property subproperty) {
            CompoundDatatype val = (CompoundDatatype) baseProperty.getObject();
            if (this.propId == PR_BLOCK_PROGRESSION_DIMENSION
                    || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
                Length len = subproperty.getLength();
                if (len != null) {
                    if (isNegativeLength(len)) {
                        log.warn("Replaced negative value (" + len + ") for " + getName()
                                + " with 0mpt");
                        val.setComponent(subpropertyId,
View Full Code Here

                    break;
                case FO_TABLE_CELL:
                    TableCell cell = (TableCell) child;
                    int colNr = cell.getColumnNumber();
                    int colSpan = cell.getNumberColumnsSpanned();
                    Length colWidth = null;

                    if (cell.getWidth().getEnum() != EN_AUTO
                            && colSpan == 1) {
                        colWidth = cell.getWidth();
                    }
View Full Code Here

        EnumProperty fontStretch = (EnumProperty) pList.get(Constants.PR_FONT_STRETCH);
        EnumProperty fontStyle = (EnumProperty) pList.get(Constants.PR_FONT_STYLE);
        EnumProperty fontVariant = (EnumProperty) pList.get(Constants.PR_FONT_VARIANT);
        EnumProperty fontWeight = (EnumProperty) pList.get(Constants.PR_FONT_WEIGHT);
        Numeric fontSizeAdjust = pList.get(Constants.PR_FONT_SIZE_ADJUST).getNumeric();
        Length fontSize = pList.get(Constants.PR_FONT_SIZE).getLength();

        CommonFont commonFont = new CommonFont(fontFamily,
                                               fontSelectionStrategy,
                                               fontStretch,
                                               fontStyle,
View Full Code Here

            PropertyList propertyList,
            FObj fo) throws PropertyException {
        Numeric numval = p.getNumeric();
        if (numval != null && numval.getDimension() == 0) {
            if (getPercentBase(propertyList) instanceof LengthBase) {
                Length base = ((LengthBase)getPercentBase(propertyList)).getBaseLength();
                if (base != null && base.isAbsolute()) {
                    p = FixedLength.getInstance(
                            numval.getNumericValue() * base.getNumericValue());
                } else {
                    p = new PercentLength(
                            numval.getNumericValue(), getPercentBase(propertyList));
                }
            }
View Full Code Here

        t.getRowGroupBuilder().addTableCell(cell);
    }

    private void handleCellWidth(TableCell cell, int colNumber, int colSpan) throws FOPException {
        Table t = getTable();
        Length colWidth = null;

        if (cell.getWidth().getEnum() != EN_AUTO
                && colSpan == 1) {
            colWidth = cell.getWidth();
        }
View Full Code Here

    /**
     * Does the actual calculations for the image.
     */
    protected void doLayout() {
        Length len;

        int bpd = -1;
        int ipd = -1;

        len = props.getBlockProgressionDimension().getOptimum(percentBaseContext).getLength();
        if (len.getEnum() != EN_AUTO) {
            bpd = len.getValue(percentBaseContext);
        }
        len = props.getBlockProgressionDimension().getMinimum(percentBaseContext).getLength();
        if (bpd == -1 && len.getEnum() != EN_AUTO) {
            //Establish minimum viewport size
            bpd = len.getValue(percentBaseContext);
        }

        len = props.getInlineProgressionDimension().getOptimum(percentBaseContext).getLength();
        if (len.getEnum() != EN_AUTO) {
            ipd = len.getValue(percentBaseContext);
        }
        len = props.getInlineProgressionDimension().getMinimum(percentBaseContext).getLength();
        if (ipd == -1 && len.getEnum() != EN_AUTO) {
            //Establish minimum viewport size
            ipd = len.getValue(percentBaseContext);
        }

        // if auto then use the intrinsic size of the content scaled
        // to the content-height and content-width
        boolean constrainIntrinsicSize = false;
        int cwidth = -1;
        int cheight = -1;
        len = props.getContentWidth();
        if (len.getEnum() != EN_AUTO) {
            switch (len.getEnum()) {
            case EN_SCALE_TO_FIT:
                if (ipd != -1) {
                    cwidth = ipd;
                }
                constrainIntrinsicSize = true;
                break;
            case EN_SCALE_DOWN_TO_FIT:
                if (ipd != -1 && intrinsicSize.width > ipd) {
                    cwidth = ipd;
                }
                constrainIntrinsicSize = true;
                break;
            case EN_SCALE_UP_TO_FIT:
                if (ipd != -1 && intrinsicSize.width < ipd) {
                    cwidth = ipd;
                }
                constrainIntrinsicSize = true;
                break;
            default:
                cwidth = len.getValue(percentBaseContext);
            }
        }
        len = props.getContentHeight();
        if (len.getEnum() != EN_AUTO) {
            switch (len.getEnum()) {
            case EN_SCALE_TO_FIT:
                if (bpd != -1) {
                    cheight = bpd;
                }
                constrainIntrinsicSize = true;
                break;
            case EN_SCALE_DOWN_TO_FIT:
                if (bpd != -1 && intrinsicSize.height > bpd) {
                    cheight = bpd;
                }
                constrainIntrinsicSize = true;
                break;
            case EN_SCALE_UP_TO_FIT:
                if (bpd != -1 && intrinsicSize.height < bpd) {
                    cheight = bpd;
                }
                constrainIntrinsicSize = true;
                break;
            default:
                cheight = len.getValue(percentBaseContext);
            }
        }

        Dimension constrainedIntrinsicSize;
        if (constrainIntrinsicSize) {
View Full Code Here

    }

    private int constrainExtent(int extent, LengthRangeProperty range, Length contextExtent) {
        boolean mayScaleUp = (contextExtent.getEnum() != EN_SCALE_DOWN_TO_FIT);
        boolean mayScaleDown = (contextExtent.getEnum() != EN_SCALE_UP_TO_FIT);
        Length len;
        len = range.getMaximum(percentBaseContext).getLength();
        if (len.getEnum() != EN_AUTO) {
            int max = len.getValue(percentBaseContext);
            if (max != -1 && mayScaleDown) {
                extent = Math.min(extent, max);
            }
        }
        len = range.getMinimum(percentBaseContext).getLength();
        if (len.getEnum() != EN_AUTO) {
            int min = len.getValue(percentBaseContext);
            if (min != -1 && mayScaleUp) {
                extent = Math.max(extent, min);
            }
        }
        return extent;
View Full Code Here

                float resolution = propertyList.getFObj().getUserAgent().getSourceResolution();
                return FixedLength.getInstance(
                        p.getNumeric().getNumericValue(), "px",
                        UnitConv.IN2PT / resolution);
            }
            Length val = p.getLength();
            if (val != null) {
                return (Property) val;
            }
            /* always null ?? */
            return convertPropertyDatatype(p, propertyList, fo);
View Full Code Here

    }

    /** @return the "alignment-adjust" property */
    public Length getAlignmentAdjust() {
        if (alignmentAdjust.getEnum() == EN_AUTO) {
            final Length intrinsicAlignmentAdjust = this.getIntrinsicAlignmentAdjust();
            if (intrinsicAlignmentAdjust != null) {
                return intrinsicAlignmentAdjust;
            }
        }
        return alignmentAdjust;
View Full Code Here

TOP

Related Classes of org.apache.fop.datatypes.Length

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.