aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2011-07-02 10:17:46 +0000
committerJeremias Maerki <jeremias@apache.org>2011-07-02 10:17:46 +0000
commit20dd19ff66999b69b40a3138d562287927deff66 (patch)
tree6ed059c89c19afd162e40c58b280756522f4f238 /src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
parent95960da762de8ca044971ed9aa42e53716293c88 (diff)
downloadxmlgraphics-fop-20dd19ff66999b69b40a3138d562287927deff66.tar.gz
xmlgraphics-fop-20dd19ff66999b69b40a3138d562287927deff66.zip
Removed fallback mechanism in AbstractCodePointMapping. This is superfluous now that SingleByteFont handles all substitutions. This actually fixes a bug: the glyph "minus" was painted using "hyphen" but used the width of "minus" due to this fallback mechanism.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1142188 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fonts/AbstractCodePointMapping.java')
-rw-r--r--src/java/org/apache/fop/fonts/AbstractCodePointMapping.java42
1 files changed, 2 insertions, 40 deletions
diff --git a/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java b/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
index 71415faa3..cc9909135 100644
--- a/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
+++ b/src/java/org/apache/fop/fonts/AbstractCodePointMapping.java
@@ -20,12 +20,11 @@
package org.apache.fop.fonts;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import org.apache.fop.util.CharUtilities;
import org.apache.xmlgraphics.fonts.Glyphs;
+import org.apache.fop.util.CharUtilities;
+
/**
* Abstract base class for code point mapping classes (1-byte character encodings).
*/
@@ -37,8 +36,6 @@ public class AbstractCodePointMapping implements SingleByteEncoding {
private char[] codepoints;
private char[] unicodeMap; //code point to Unicode char
private String[] charNameMap; //all character names in the encoding
- //Here we accumulate all mappings we have found through substitution
- private Map<Character, Character> fallbackMap;
/**
* Main constructor.
@@ -141,44 +138,9 @@ public class AbstractCodePointMapping implements SingleByteEncoding {
bot = mid + 1;
}
}
-
- //Fallback: using cache
- synchronized (this) {
- if (fallbackMap != null) {
- Character fallback = fallbackMap.get(new Character(c));
- if (fallback != null) {
- return fallback.charValue();
- }
- }
- }
- //Fallback: find alternatives (slow!)
- String glyphName = Glyphs.charToGlyphName(c);
- if (glyphName.length() > 0) {
- String[] alternatives = Glyphs.getCharNameAlternativesFor(glyphName);
- if (alternatives != null) {
- for (int i = 0, ic = alternatives.length; i < ic; i++) {
- int idx = getCodePointForGlyph(alternatives[i]);
- if (idx >= 0) {
- putFallbackCharacter(c, (char)idx);
- return (char)idx;
- }
- }
- }
- }
-
- putFallbackCharacter(c, NOT_FOUND_CODE_POINT);
return NOT_FOUND_CODE_POINT;
}
- private void putFallbackCharacter(char c, char mapTo) {
- synchronized (this) {
- if (this.fallbackMap == null) {
- this.fallbackMap = new HashMap<Character, Character>();
- }
- this.fallbackMap.put(new Character(c), new Character(mapTo));
- }
- }
-
/**
* Returns the main Unicode value that is associated with the given code point in the encoding.
* Note that multiple Unicode values can theoretically be mapped to one code point in the