aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/fop/fonts/MultiByteFont.java27
-rw-r--r--status.xml4
2 files changed, 29 insertions, 2 deletions
diff --git a/src/java/org/apache/fop/fonts/MultiByteFont.java b/src/java/org/apache/fop/fonts/MultiByteFont.java
index 2dd3846ed..1b9263d17 100644
--- a/src/java/org/apache/fop/fonts/MultiByteFont.java
+++ b/src/java/org/apache/fop/fonts/MultiByteFont.java
@@ -110,11 +110,34 @@ public class MultiByteFont extends CIDFont {
}
/**
+ * Removes all white space from a string (used primarily for font names)
+ * @param s the string
+ * @return the processed result
+ */
+ public static String stripWhiteSpace(String s) {
+ StringBuffer sb = new StringBuffer(s.length());
+ for (int i = 0, c = s.length(); i < c; i++) {
+ final char ch = s.charAt(i);
+ if (ch != ' '
+ && ch != '\r'
+ && ch != '\n'
+ && ch != '\t') {
+ sb.append(ch);
+ }
+ }
+ return sb.toString();
+ }
+
+ private String getPrefixedFontName() {
+ return namePrefix + stripWhiteSpace(super.getFontName());
+ }
+
+ /**
* @see org.apache.fop.fonts.CIDFont#getCidBaseFont()
*/
public String getCidBaseFont() {
if (isEmbeddable()) {
- return namePrefix + super.getFontName();
+ return getPrefixedFontName();
} else {
return super.getFontName();
}
@@ -139,7 +162,7 @@ public class MultiByteFont extends CIDFont {
*/
public String getFontName() {
if (isEmbeddable()) {
- return namePrefix + super.getFontName();
+ return getPrefixedFontName();
} else {
return super.getFontName();
}
diff --git a/status.xml b/status.xml
index 1527275c1..4117095fc 100644
--- a/status.xml
+++ b/status.xml
@@ -28,6 +28,10 @@
<changes>
<release version="FOP Trunk">
+ <action context="Code" dev="JM" type="fix">
+ Fix for PDF corruption when a TrueType font with spaces in its name is embedded and no
+ XML font metrics file for that font is used.
+ </action>
<action context="Code" dev="JM" type="fix" fixes-bug="41426" due-to="Adrian Cumiskey">
Fix for ClassCastException when fo:wrapper was used as direct child of fo:flow.
Note: "id" attributes are still not handled properly on fo:wrapper!