diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-02-09 16:58:29 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-02-09 16:58:29 +0000 |
commit | 8af2c15dbdc188dcad675df1ce041c57f8a8b417 (patch) | |
tree | 3b5c02f21cb39abe2a4e59419b4314b3d0fedad9 /src/java/org/apache/fop | |
parent | 6ec55c961d72c3ac0950dd3a8189fd27c4965f25 (diff) | |
download | xmlgraphics-fop-8af2c15dbdc188dcad675df1ce041c57f8a8b417.tar.gz xmlgraphics-fop-8af2c15dbdc188dcad675df1ce041c57f8a8b417.zip |
Added code to detect when a Type 1 font is not configured to use its native encoding. In such a case it needs to be re-encoded in PostScript. That used to always happen in earlier FOP versions but since support was added for all glyphs in a font, this has become a problem. So this change restores the behaviour of before when XML font metrics files or just the PFM are used.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@742620 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop')
-rw-r--r-- | src/java/org/apache/fop/fonts/SingleByteFont.java | 20 | ||||
-rw-r--r-- | src/java/org/apache/fop/fonts/type1/Type1FontLoader.java | 1 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/ps/PSFontUtils.java | 6 |
3 files changed, 27 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fonts/SingleByteFont.java b/src/java/org/apache/fop/fonts/SingleByteFont.java index 3892e87e6..8739b42a4 100644 --- a/src/java/org/apache/fop/fonts/SingleByteFont.java +++ b/src/java/org/apache/fop/fonts/SingleByteFont.java @@ -36,6 +36,7 @@ public class SingleByteFont extends CustomFont { private static Log log = LogFactory.getLog(SingleByteFont.class); private SingleByteEncoding mapping; + private boolean useNativeEncoding = false; private int[] width = null; @@ -43,6 +44,7 @@ public class SingleByteFont extends CustomFont { //Map<Character, UnencodedCharacter> private List additionalEncodings; + /** * Main constructor. */ @@ -192,6 +194,24 @@ public class SingleByteFont extends CustomFont { } /** + * Controls whether the font is configured to use its native encoding or if it + * may need to be re-encoded for the target format. + * @param value true indicates that the configured encoding is the font's native encoding + */ + public void setUseNativeEncoding(boolean value) { + this.useNativeEncoding = value; + } + + /** + * Indicates whether this font is configured to use its native encoding. This + * method is used to determine whether the font needs to be re-encoded. + * @return true if the font uses its native encoding. + */ + public boolean isUsingNativeEncoding() { + return this.useNativeEncoding; + } + + /** * Sets a width for a character. * @param index index of the character * @param w the width of the character diff --git a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java index 981f3ad69..754c8c92d 100644 --- a/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java +++ b/src/java/org/apache/fop/fonts/type1/Type1FontLoader.java @@ -139,6 +139,7 @@ public class Type1FontLoader extends FontLoader { //Encoding if (afm != null) { String encoding = afm.getEncodingScheme(); + singleFont.setUseNativeEncoding(true); if ("AdobeStandardEncoding".equals(encoding)) { singleFont.setEncoding(CodePointMapping.STANDARD_ENCODING); } else { diff --git a/src/java/org/apache/fop/render/ps/PSFontUtils.java b/src/java/org/apache/fop/render/ps/PSFontUtils.java index c18e794e2..a29210b41 100644 --- a/src/java/org/apache/fop/render/ps/PSFontUtils.java +++ b/src/java/org/apache/fop/render/ps/PSFontUtils.java @@ -160,6 +160,12 @@ public class PSFontUtils extends org.apache.xmlgraphics.ps.PSFontUtils { if (tf instanceof Base14Font) { //Our Base 14 fonts don't use the default encoding redefineFontEncoding(gen, tf.getFontName(), tf.getEncodingName()); + } else if (tf instanceof SingleByteFont) { + SingleByteFont sbf = (SingleByteFont)tf; + if (!sbf.isUsingNativeEncoding()) { + //Font has been configured to use an encoding other than the default one + redefineFontEncoding(gen, tf.getFontName(), tf.getEncodingName()); + } } } } |