Browse Source

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
tags/fop-1_0
Jeremias Maerki 15 years ago
parent
commit
8af2c15dbd

+ 20
- 0
src/java/org/apache/fop/fonts/SingleByteFont.java View File

@@ -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.
*/
@@ -191,6 +193,24 @@ public class SingleByteFont extends CustomFont {
this.mapping = encoding;
}

/**
* 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

+ 1
- 0
src/java/org/apache/fop/fonts/type1/Type1FontLoader.java View File

@@ -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 {

+ 6
- 0
src/java/org/apache/fop/render/ps/PSFontUtils.java View File

@@ -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());
}
}
}
}

Loading…
Cancel
Save