this.cidType = cidType;
}
+ /**
+ * 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();
}
*/
public String getFontName() {
if (isEmbeddable()) {
- return namePrefix + super.getFontName();
+ return getPrefixedFontName();
} else {
return super.getFontName();
}
<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!