* @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
}
}
- /**
- * {@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;
}
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);
}
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int hashCode() {
return millipoints;
}
}
- /** {@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) {
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);