return fontBBox;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getFlags() {
return flags;
}
+
+ /** {@inheritDoc} */
+ public boolean isSymbolicFont() {
+ return ((getFlags() & 4) != 0) || "ZapfDingbatsEncoding".equals(getEncoding());
+ //Note: The check for ZapfDingbats is necessary as the PFM does not reliably indicate
+ //if a font is symbolic.
+ }
/**
* Returns the font weight (100, 200...800, 900). This value may be different from the
*/
int getFlags();
+ /**
+ * Indicates whether the font is a symbolic font.
+ * @return true if the font is a symbolic font (i.e. Symbol or ZapfDingbats)
+ */
+ boolean isSymbolicFont();
/**
* Returns the font's bounding box.
return realFontDescriptor.getAscender();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public int getFlags() {
load(true);
return realFontDescriptor.getFlags();
}
+ /** {@inheritDoc} */
+ public boolean isSymbolicFont() {
+ load(true);
+ return realFontDescriptor.isSymbolicFont();
+ }
+
/**
* {@inheritDoc}
*/
PDFFont font = null;
font = (PDFFont)PDFFont.createFont(fontname, fonttype,
- basefont, encoding);
+ basefont, null);
getDocument().registerObject(font);
if (fonttype == FontType.TYPE0) {
+ font.setEncoding(encoding);
CIDFont cidMetrics;
if (metrics instanceof LazyFont) {
cidMetrics = (CIDFont)((LazyFont) metrics).getRealFont();
//Handle encoding
CodePointMapping mapping = singleByteFont.getCodePointMapping();
- if (PDFEncoding.isPredefinedEncoding(mapping.getName())) {
+ if (singleByteFont.isSymbolicFont()) {
+ //no encoding, use the font's encoding
+ } else if (PDFEncoding.isPredefinedEncoding(mapping.getName())) {
font.setEncoding(mapping.getName());
} else {
CodePointMapping winansi = CodePointMapping.getMapping(
setEncoding((PDFEncoding)encoding);
} else if (encoding instanceof String) {
setEncoding((String)encoding);
- } else {
- throw new IllegalArgumentException("Illegal value for encoding");
}
}
import org.apache.fop.fonts.FontDescriptor;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.Typeface;
+import org.apache.fop.fonts.base14.Symbol;
+import org.apache.fop.fonts.base14.ZapfDingbats;
import org.apache.fop.util.ColorProfileUtil;
/**
if (font instanceof FontDescriptor) {
desc = (FontDescriptor)font;
}
+ String encoding = font.getEncoding();
+ if (font instanceof Symbol || font instanceof ZapfDingbats) {
+ encoding = null; //Symbolic fonts shouldn't specify an encoding value in PDF
+ }
addFont(doc.getFactory().makeFont(
- f, font.getEmbedFontName(), font.getEncoding(), font, desc));
+ f, font.getEmbedFontName(), encoding, font, desc));
}
}
}
-->
<!--/release-->
<release version="0.95" date="TBD">
+ <action context="Fonts" dev="JM" type="fix">
+ Fixed text extraction problem with ZapfDingbats and Symbol font in PDF output.
+ </action>
<action context="Fonts" dev="JM" type="fix">
Fixed NullPointerException when loading a TrueType font using XML font metric files.
</action>