|
|
@@ -43,6 +43,19 @@ public class FontSizePropertyMaker |
|
|
|
super(propId); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** {@inheritDoc} */ |
|
|
|
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); |
|
|
|
p = FixedLength.getInstance( |
|
|
|
pp.getLength().getValue() * ((PercentLength)p).getPercentage() / 100, "mpt"); |
|
|
|
} |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* {@inheritDoc} |
|
|
|
* Implements the parts of 7.8.4 relevant to relative font sizes |
|
|
@@ -52,12 +65,12 @@ public class FontSizePropertyMaker |
|
|
|
FObj fo) throws PropertyException { |
|
|
|
if (p.getEnum() == EN_LARGER || p.getEnum() == EN_SMALLER) { |
|
|
|
// get the corresponding property from parent |
|
|
|
Property pp = propertyList.getFromParent(this.getPropId()); |
|
|
|
Property pp = propertyList.getFromParent(this.propId); |
|
|
|
int baseFontSize = computeClosestAbsoluteFontSize(pp.getLength().getValue()); |
|
|
|
if (p.getEnum() == EN_LARGER) { |
|
|
|
return new FixedLength((int)Math.round((baseFontSize * FONT_SIZE_GROWTH_FACTOR))); |
|
|
|
return FixedLength.getInstance((int)Math.round((baseFontSize * FONT_SIZE_GROWTH_FACTOR)), "mpt"); |
|
|
|
} else { |
|
|
|
return new FixedLength((int)Math.round((baseFontSize / FONT_SIZE_GROWTH_FACTOR))); |
|
|
|
return FixedLength.getInstance((int)Math.round((baseFontSize / FONT_SIZE_GROWTH_FACTOR)), "mpt"); |
|
|
|
} |
|
|
|
} |
|
|
|
return super.convertProperty(p, propertyList, fo); |