Pārlūkot izejas kodu

Bugzilla 44343:

Fixed a bug when using relative (smaller/larger) font-sizes in combination with percentages.
Percentages now resolved as per the spec (XSL-FO 1.1 7.9.4):
"A percentage value specifies an absolute font size relative to the parent element's font-size."


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@617708 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_95beta
Andreas L. Delmelle pirms 16 gadiem
vecāks
revīzija
af652eedd4

+ 16
- 3
src/java/org/apache/fop/fo/properties/FontSizePropertyMaker.java Parādīt failu

@@ -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);

+ 4
- 0
status.xml Parādīt failu

@@ -28,6 +28,10 @@

<changes>
<release version="FOP Trunk">
<action context="Code" dev="AD" type="fix" fixes-bug="44343">
Fixed a bug when using relative font-size (smaller/larger) in combination
with percentages.
</action>
<action context="Fonts" dev="JM" type="fix">
Bugfix for handling of optional tables in subset TrueType fonts. This bug caused errors
in various PDF viewers.

Notiek ielāde…
Atcelt
Saglabāt