You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2008/02/02 01:06:34 UTC
svn commit: r617716 - in
/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties:
FixedLength.java FontSizePropertyMaker.java
Author: adelmelle
Date: Fri Feb 1 16:06:29 2008
New Revision: 617716
URL: http://svn.apache.org/viewvc?rev=617716&view=rev
Log:
Minor cleanup/improvement:
- FontSizePropertyMaker: remove redundant casts (FixedLength already casts the doubles internally)
- FixedLength: reduce visibility of 'fishy' convert() method (not used anywhere else)
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java?rev=617716&r1=617715&r2=617716&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FixedLength.java Fri Feb 1 16:06:29 2008
@@ -69,7 +69,7 @@
* @param dvalue quantity of input units
* @param unit input unit specifier (in, cm, etc.)
*/
- protected void convert(double dvalue, String unit) {
+ private void convert(double dvalue, String unit) {
// TODO: the whole routine smells fishy.
int assumedResolution = 1; // points/pixel = 72dpi
@@ -107,30 +107,22 @@
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getValue() {
return millipoints;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getValue(PercentBaseContext context) {
return millipoints;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public double getNumericValue() {
return millipoints;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public double getNumericValue(PercentBaseContext context) {
return millipoints;
}
@@ -143,16 +135,12 @@
return true;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public String toString() {
return millipoints + "mpt";
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean equals(Object obj) {
if (obj instanceof FixedLength) {
return (((FixedLength)obj).millipoints == this.millipoints);
@@ -161,9 +149,7 @@
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int hashCode() {
return millipoints;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java?rev=617716&r1=617715&r2=617716&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java Fri Feb 1 16:06:29 2008
@@ -44,7 +44,12 @@
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ * Contrary to basic lengths, percentages for font-size can be resolved
+ * here already: if the property evaluates to a {@link PercentLength},
+ * it is immediately replaced by the resolved {@link FixedLength}.
+ */
public Property make(PropertyList propertyList, String value, FObj fo) throws PropertyException {
Property p = super.make(propertyList, value, fo);
if (p instanceof PercentLength) {
@@ -68,9 +73,11 @@
Property pp = propertyList.getFromParent(this.propId);
int baseFontSize = computeClosestAbsoluteFontSize(pp.getLength().getValue());
if (p.getEnum() == EN_LARGER) {
- return FixedLength.getInstance((int)Math.round((baseFontSize * FONT_SIZE_GROWTH_FACTOR)), "mpt");
+ return FixedLength.getInstance(
+ Math.round(baseFontSize * FONT_SIZE_GROWTH_FACTOR), "mpt");
} else {
- return FixedLength.getInstance((int)Math.round((baseFontSize / FONT_SIZE_GROWTH_FACTOR)), "mpt");
+ return FixedLength.getInstance(
+ Math.round(baseFontSize / FONT_SIZE_GROWTH_FACTOR), "mpt");
}
}
return super.convertProperty(p, propertyList, fo);
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org