From 637c844c8a6130f1c804afa7f3e2b3bd884e1bee Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Fri, 25 Apr 2008 15:13:28 +0000 Subject: Merged revisions 651577,651591,651613,651622-651623 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r651577 | adelmelle | 2008-04-25 12:37:11 +0100 (Fri, 25 Apr 2008) | 1 line Correction: remove unfinished sentence... ........ r651591 | jeremias | 2008-04-25 13:31:44 +0100 (Fri, 25 Apr 2008) | 1 line Update for advanced keeps. ........ r651613 | adelmelle | 2008-04-25 15:13:08 +0100 (Fri, 25 Apr 2008) | 1 line Added missing file from r651575 ........ r651622 | acumiskey | 2008-04-25 15:59:49 +0100 (Fri, 25 Apr 2008) | 1 line Renamed method. ........ r651623 | jeremias | 2008-04-25 16:03:17 +0100 (Fri, 25 Apr 2008) | 3 lines Restored Java 1.4 compatibility (Boolean.parseBoolean() is a Java 5 method). Simplified the ExternalLink's string representation to follow the pattern used by Trait.Background. Added a check to test for the effect of the show-destination property. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@651625 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/area/Area.java | 12 -------- src/java/org/apache/fop/area/Trait.java | 32 ++++++++++------------ .../fop/fonts/autodetect/FontInfoFinder.java | 6 ++-- 3 files changed, 18 insertions(+), 32 deletions(-) (limited to 'src/java/org/apache') diff --git a/src/java/org/apache/fop/area/Area.java b/src/java/org/apache/fop/area/Area.java index 73b167b99..ff9f5c7d0 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/java/org/apache/fop/area/Area.java @@ -367,18 +367,6 @@ public class Area extends AreaTreeObject implements Serializable { public void addChildArea(Area child) { } - /** - * Add a trait property to this area. - * - * @param prop the Trait to add - */ - public void addTrait(Trait prop) { - if (props == null) { - props = new java.util.HashMap(20); - } - props.put(prop.getPropType(), prop.getData()); - } - /** * Add a trait to this area. * diff --git a/src/java/org/apache/fop/area/Trait.java b/src/java/org/apache/fop/area/Trait.java index 9599d8833..e7b39ad2b 100644 --- a/src/java/org/apache/fop/area/Trait.java +++ b/src/java/org/apache/fop/area/Trait.java @@ -461,21 +461,20 @@ public class Trait implements Serializable { * @return an ExternalLink instance corresponding to the given value */ protected static ExternalLink makeFromTraitValue(String traitValue) { - if (traitValue.indexOf(ExternalLink.class.getName()) == -1 - || traitValue.indexOf("dest=") == -1) { - throw new IllegalArgumentException( - "Malformed trait value for Trait.ExternalLink: " + traitValue); - } - int startIndex = traitValue.indexOf("dest=") + 5; - int endIndex = traitValue.indexOf(',', startIndex); - if (endIndex == -1) { - endIndex = traitValue.indexOf(']'); + String dest = null; + boolean newWindow = false; + String[] values = traitValue.split(","); + for (int i = 0, c = values.length; i < c; i++) { + String v = values[i]; + if (v.startsWith("dest=")) { + dest = v.substring(5); + } else if (v.startsWith("newWindow=")) { + newWindow = Boolean.valueOf(v.substring(10)).booleanValue(); + } else { + throw new IllegalArgumentException( + "Malformed trait value for Trait.ExternalLink: " + traitValue); + } } - String dest = traitValue.substring(startIndex, endIndex); - startIndex = traitValue.indexOf("newWindow=", endIndex) + 10; - endIndex = traitValue.indexOf(']', startIndex); - boolean newWindow = Boolean.parseBoolean( - traitValue.substring(startIndex, endIndex)); return new ExternalLink(dest, newWindow); } @@ -502,9 +501,8 @@ public class Trait implements Serializable { */ public String toString() { StringBuffer sb = new StringBuffer(64); - sb.append(super.toString()); - sb.append("[dest=").append(this.destination); - sb.append(",newWindow=").append(newWindow).append("]"); + sb.append("newWindow=").append(newWindow); + sb.append(",dest=").append(this.destination); return sb.toString(); } } diff --git a/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java b/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java index ce33bc5b6..484710d1a 100644 --- a/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java +++ b/src/java/org/apache/fop/fonts/autodetect/FontInfoFinder.java @@ -139,7 +139,7 @@ public class FontInfoFinder { * @param fontCache font cache (may be null) * @return */ - private EmbedFontInfo fontInfoFromCustomFont( + private EmbedFontInfo getFontInfoFromCustomFont( URL fontUrl, CustomFont customFont, FontCache fontCache) { List fontTripletList = new java.util.ArrayList(); generateTripletsFromFont(customFont, fontTripletList); @@ -237,7 +237,7 @@ public class FontInfoFinder { } continue; } - EmbedFontInfo fi = fontInfoFromCustomFont(fontUrl, customFont, fontCache); + EmbedFontInfo fi = getFontInfoFromCustomFont(fontUrl, customFont, fontCache); if (fi != null) { embedFontInfoList.add(fi); } @@ -260,7 +260,7 @@ public class FontInfoFinder { } return null; } - EmbedFontInfo fi = fontInfoFromCustomFont(fontUrl, customFont, fontCache); + EmbedFontInfo fi = getFontInfoFromCustomFont(fontUrl, customFont, fontCache); if (fi != null) { return new EmbedFontInfo[] {fi}; } else { -- cgit v1.2.3