View | Details | Raw Unified | Return to bug 47027
Collapse All | Expand All

(-)src/java/org/apache/fop/fo/expr/PropertyParser.java (-6 / +9 lines)
Lines 19-24 Link Here
19
19
20
package org.apache.fop.fo.expr;
20
package org.apache.fop.fo.expr;
21
21
22
import java.util.HashMap;
23
import java.util.LinkedList;
24
import java.util.List;
25
26
import org.apache.xmlgraphics.util.UnitConv;
27
22
import org.apache.fop.datatypes.Length;
28
import org.apache.fop.datatypes.Length;
23
import org.apache.fop.datatypes.LengthBase;
29
import org.apache.fop.datatypes.LengthBase;
24
import org.apache.fop.datatypes.Numeric;
30
import org.apache.fop.datatypes.Numeric;
Lines 31-40 Link Here
31
import org.apache.fop.fo.properties.Property;
37
import org.apache.fop.fo.properties.Property;
32
import org.apache.fop.fo.properties.StringProperty;
38
import org.apache.fop.fo.properties.StringProperty;
33
39
34
import java.util.HashMap;
35
import java.util.LinkedList;
36
import java.util.List;
37
38
/**
40
/**
39
 * Class to parse XSL-FO property expressions.
41
 * Class to parse XSL-FO property expressions.
40
 * This class is heavily based on the epxression parser in James Clark's
42
 * This class is heavily based on the epxression parser in James Clark's
Lines 312-321 Link Here
312
                if ("px".equals(unitPart)) {
314
                if ("px".equals(unitPart)) {
313
                    //pass the ratio between target-resolution and
315
                    //pass the ratio between target-resolution and
314
                    //the default resolution of 72dpi
316
                    //the default resolution of 72dpi
317
                    float resolution = propInfo.getPropertyList().getFObj()
318
                            .getUserAgent().getSourceResolution();
315
                    prop = FixedLength.getInstance(
319
                    prop = FixedLength.getInstance(
316
                            numPart, unitPart,
320
                            numPart, unitPart,
317
                            propInfo.getPropertyList().getFObj()
321
                             UnitConv.IN2PT / resolution);
318
                                    .getUserAgent().getTargetResolution() / 72.0f);
319
                } else {
322
                } else {
320
                    //use default resolution of 72dpi
323
                    //use default resolution of 72dpi
321
                    prop = FixedLength.getInstance(numPart, unitPart);
324
                    prop = FixedLength.getInstance(numPart, unitPart);
(-)src/java/org/apache/fop/fo/properties/LengthProperty.java (-1 / +4 lines)
Lines 19-24 Link Here
19
19
20
package org.apache.fop.fo.properties;
20
package org.apache.fop.fo.properties;
21
21
22
import org.apache.xmlgraphics.util.UnitConv;
23
22
import org.apache.fop.datatypes.Length;
24
import org.apache.fop.datatypes.Length;
23
import org.apache.fop.datatypes.Numeric;
25
import org.apache.fop.datatypes.Numeric;
24
import org.apache.fop.fo.FObj;
26
import org.apache.fop.fo.FObj;
Lines 57-65 Link Here
57
            }
59
            }
58
            if (p instanceof NumberProperty) {
60
            if (p instanceof NumberProperty) {
59
                //Assume pixels (like in HTML) when there's no unit
61
                //Assume pixels (like in HTML) when there's no unit
62
                float resolution = propertyList.getFObj().getUserAgent().getSourceResolution();
60
                return FixedLength.getInstance(
63
                return FixedLength.getInstance(
61
                        p.getNumeric().getNumericValue(), "px",
64
                        p.getNumeric().getNumericValue(), "px",
62
                        propertyList.getFObj().getUserAgent().getTargetResolution() / 72.0f);
65
                        UnitConv.IN2PT / resolution);
63
            }
66
            }
64
            Length val = p.getLength();
67
            Length val = p.getLength();
65
            if (val != null) {
68
            if (val != null) {
(-)test/fotree/testcases/pixel_length_96dpi.fo (+34 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!--
3
  Licensed to the Apache Software Foundation (ASF) under one or more
4
  contributor license agreements.  See the NOTICE file distributed with
5
  this work for additional information regarding copyright ownership.
6
  The ASF licenses this file to You under the Apache License, Version 2.0
7
  (the "License"); you may not use this file except in compliance with
8
  the License.  You may obtain a copy of the License at
9
10
       http://www.apache.org/licenses/LICENSE-2.0
11
12
  Unless required by applicable law or agreed to in writing, software
13
  distributed under the License is distributed on an "AS IS" BASIS,
14
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
  See the License for the specific language governing permissions and
16
  limitations under the License.
17
-->
18
<!-- $Id$ -->
19
<?fop-source-resolution 144?>
20
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:test="http://xmlgraphics.apache.org/fop/test">
21
  <fo:layout-master-set>
22
    <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
23
      <fo:region-body/>
24
    </fo:simple-page-master>
25
  </fo:layout-master-set>
26
  <fo:page-sequence master-reference="normal">
27
    <fo:flow flow-name="xsl-region-body">
28
      <fo:block-container inline-progression-dimension="144px">
29
        <test:assert property="inline-progression-dimension.optimum" expected="72000mpt" />
30
        <fo:block>Block 1</fo:block>
31
      </fo:block-container>
32
    </fo:flow>
33
  </fo:page-sequence>
34
</fo:root>
0
  + Id
35
  + Id
1
  + native
36
  + native
(-)test/java/org/apache/fop/fotreetest/FOTreeTester.java (+8 lines)
Lines 32-37 Link Here
32
import org.apache.fop.apps.FOUserAgent;
32
import org.apache.fop.apps.FOUserAgent;
33
import org.apache.fop.apps.Fop;
33
import org.apache.fop.apps.Fop;
34
import org.apache.fop.apps.FopFactory;
34
import org.apache.fop.apps.FopFactory;
35
import org.apache.fop.apps.FopFactoryConfigurator;
35
import org.apache.fop.fotreetest.ext.TestElementMapping;
36
import org.apache.fop.fotreetest.ext.TestElementMapping;
36
import org.apache.fop.util.ConsoleEventListenerForTests;
37
import org.apache.fop.util.ConsoleEventListenerForTests;
37
38
Lines 64-69 Link Here
64
        SAXParser parser = spf.newSAXParser();
65
        SAXParser parser = spf.newSAXParser();
65
        XMLReader reader = parser.getXMLReader();
66
        XMLReader reader = parser.getXMLReader();
66
67
68
        //Resetting values modified by processing instructions
69
        fopFactory.setBreakIndentInheritanceOnReferenceAreaBoundary(
70
                FopFactoryConfigurator.DEFAULT_BREAK_INDENT_INHERITANCE);
71
        fopFactory.setSourceResolution(FopFactoryConfigurator.DEFAULT_SOURCE_RESOLUTION);
72
67
        FOUserAgent ua = fopFactory.newFOUserAgent();
73
        FOUserAgent ua = fopFactory.newFOUserAgent();
68
        ua.setBaseURL(testFile.getParentFile().toURL().toString());
74
        ua.setBaseURL(testFile.getParentFile().toURL().toString());
69
        ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua));
75
        ua.setFOEventHandlerOverride(new DummyFOEventHandler(ua));
Lines 104-109 Link Here
104
            if ("fop-useragent-break-indent-inheritance".equals(target)) {
110
            if ("fop-useragent-break-indent-inheritance".equals(target)) {
105
                userAgent.getFactory().setBreakIndentInheritanceOnReferenceAreaBoundary(
111
                userAgent.getFactory().setBreakIndentInheritanceOnReferenceAreaBoundary(
106
                        Boolean.valueOf(data).booleanValue());
112
                        Boolean.valueOf(data).booleanValue());
113
            } else if ("fop-source-resolution".equals(target)) {
114
                userAgent.getFactory().setSourceResolution(Float.parseFloat(data));
107
            }
115
            }
108
            super.processingInstruction(target, data);
116
            super.processingInstruction(target, data);
109
        }
117
        }

Return to bug 47027