aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-03-16 16:53:21 +0000
committerJeremias Maerki <jeremias@apache.org>2006-03-16 16:53:21 +0000
commit97a13831e8fce797ad4d321b778ba0af69d6eddf (patch)
tree33c259769bcde3047cabdac360d2d4bc722ffa04 /src
parented32d52d2a09979c49e5c83dbe21d2bd11a91b32 (diff)
downloadxmlgraphics-fop-97a13831e8fce797ad4d321b778ba0af69d6eddf.tar.gz
xmlgraphics-fop-97a13831e8fce797ad4d321b778ba0af69d6eddf.zip
Changed the way that text-align-last is calculated. Hopefully, this is it, now. Should fix a bug reported last week on fop-users.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@386379 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/FOPropertyMapping.java50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java
index 75d3b6f08..06d83a37f 100644
--- a/src/java/org/apache/fop/fo/FOPropertyMapping.java
+++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java
@@ -1688,33 +1688,39 @@ public class FOPropertyMapping implements Constants {
// text-align-last
m = new EnumProperty.Maker(PR_TEXT_ALIGN_LAST) {
- public Property convertProperty(Property p,
- PropertyList propertyList,
- FObj fo) throws PropertyException {
- int en = p.getEnum();
- if (en == EN_RELATIVE) {
- Property corresponding = propertyList.get(PR_TEXT_ALIGN);
- if (corresponding == null) {
- return p;
- }
- int correspondingValue = corresponding.getEnum();
- if (correspondingValue == EN_JUSTIFY) {
- return getEnumProperty(EN_START, "START");
- } else if (correspondingValue == EN_END) {
- return getEnumProperty(EN_END, "END");
- } else if (correspondingValue == EN_START) {
- return getEnumProperty(EN_START, "START");
- } else if (correspondingValue == EN_CENTER) {
- return getEnumProperty(EN_CENTER, "CENTER");
- } else {
- return p;
+ public Property get(int subpropId, PropertyList propertyList,
+ boolean bTryInherit, boolean bTryDefault) throws PropertyException {
+ Property p = super.get(subpropId, propertyList, bTryInherit, bTryDefault);
+ if (p != null && p.getEnum() == EN_RELATIVE) {
+ //The default may have been returned, so check inherited value
+ p = propertyList.getNearestSpecified(PR_TEXT_ALIGN_LAST);
+ if (p.getEnum() == EN_RELATIVE) {
+ return calcRelative(propertyList);
}
+ }
+ return p;
+ }
+
+ private Property calcRelative(PropertyList propertyList) throws PropertyException {
+ Property corresponding = propertyList.get(PR_TEXT_ALIGN);
+ if (corresponding == null) {
+ return null;
+ }
+ int correspondingValue = corresponding.getEnum();
+ if (correspondingValue == EN_JUSTIFY) {
+ return getEnumProperty(EN_START, "START");
+ } else if (correspondingValue == EN_END) {
+ return getEnumProperty(EN_END, "END");
+ } else if (correspondingValue == EN_START) {
+ return getEnumProperty(EN_START, "START");
+ } else if (correspondingValue == EN_CENTER) {
+ return getEnumProperty(EN_CENTER, "CENTER");
} else {
- return p;
+ return null;
}
}
};
- m.setInherited(true);
+ m.setInherited(false); //Actually it's "true" but the special PropertyMaker compensates
// Note: both 'end', 'right' and 'outside' are mapped to END
// both 'start', 'left' and 'inside' are mapped to START
m.addEnum("relative", getEnumProperty(EN_RELATIVE, "RELATIVE"));