diff options
Diffstat (limited to 'src/java/org/apache/fop/fonts/SingleByteFont.java')
-rw-r--r-- | src/java/org/apache/fop/fonts/SingleByteFont.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fonts/SingleByteFont.java b/src/java/org/apache/fop/fonts/SingleByteFont.java index 92e7c0547..8739b42a4 100644 --- a/src/java/org/apache/fop/fonts/SingleByteFont.java +++ b/src/java/org/apache/fop/fonts/SingleByteFont.java @@ -19,8 +19,10 @@ package org.apache.fop.fonts; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,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; @@ -41,6 +44,7 @@ public class SingleByteFont extends CustomFont { //Map<Character, UnencodedCharacter> private List additionalEncodings; + /** * Main constructor. */ @@ -190,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 @@ -219,6 +241,24 @@ public class SingleByteFont extends CustomFont { } /** + * Makes all unencoded characters available through additional encodings. This method + * is used in cases where the fonts need to be encoded in the target format before + * all text of the document is processed (for example in PostScript when resource optimization + * is disabled). + */ + public void encodeAllUnencodedCharacters() { + if (this.unencodedCharacters != null) { + Set sortedKeys = new java.util.TreeSet(this.unencodedCharacters.keySet()); + Iterator iter = sortedKeys.iterator(); + while (iter.hasNext()) { + Character ch = (Character)iter.next(); + char mapped = mapChar(ch.charValue()); + assert mapped != Typeface.NOT_FOUND; + } + } + } + + /** * Indicates whether the encoding has additional encodings besides the primary encoding. * @return true if there are additional encodings. */ |