< prev index next >

src/java.desktop/share/classes/sun/font/TrueTypeGlyphMapper.java

Print this page
rev 59106 : imported patch client

*** 36,46 **** /* if running on Solaris and default Locale is ja_JP then * we map need to remap reverse solidus (backslash) to Yen as * apparently expected there. */ static final boolean isJAlocale = Locale.JAPAN.equals(Locale.getDefault()); - private final boolean needsJAremapping; TrueTypeFont font; CMap cmap; int numGlyphs; --- 36,45 ----
*** 59,73 **** if (buffer != null && buffer.capacity() >= 6) { numGlyphs = buffer.getChar(4); // offset 4 bytes in MAXP table. } else { handleBadCMAP(); } - if (FontUtilities.isSolaris && isJAlocale && font.supportsJA()) { - needsJAremapping = true; - } else { - needsJAremapping = false; - } } public int getNumGlyphs() { return numGlyphs; } --- 58,67 ----
*** 139,204 **** private int remapJAIntChar(int unicode) { return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode; } public int charToGlyph(char unicode) { - if (needsJAremapping) { - unicode = remapJAChar(unicode); - } int glyph = getGlyphFromCMAP(unicode); - if (font.checkUseNatives() && glyph < font.glyphToCharMap.length) { - font.glyphToCharMap[glyph] = unicode; - } return glyph; } public int charToGlyph(int unicode) { - if (needsJAremapping) { - unicode = remapJAIntChar(unicode); - } int glyph = getGlyphFromCMAP(unicode); - if (font.checkUseNatives() && glyph < font.glyphToCharMap.length) { - font.glyphToCharMap[glyph] = (char)unicode; - } return glyph; } @Override public int charToVariationGlyph(int unicode, int variationSelector) { - if (needsJAremapping) { - unicode = remapJAIntChar(unicode); - } int glyph = getGlyphFromCMAP(unicode, variationSelector); - if (font.checkUseNatives() && glyph < font.glyphToCharMap.length) { - font.glyphToCharMap[glyph] = (char)unicode; - } return glyph; } public void charsToGlyphs(int count, int[] unicodes, int[] glyphs) { for (int i=0;i<count;i++) { - if (needsJAremapping) { - glyphs[i] = getGlyphFromCMAP(remapJAIntChar(unicodes[i])); - } else { glyphs[i] = getGlyphFromCMAP(unicodes[i]); } - if (font.checkUseNatives() && - glyphs[i] < font.glyphToCharMap.length) { - font.glyphToCharMap[glyphs[i]] = (char)unicodes[i]; - } - } } public void charsToGlyphs(int count, char[] unicodes, int[] glyphs) { for (int i=0; i<count; i++) { ! int code; ! if (needsJAremapping) { ! code = remapJAChar(unicodes[i]); ! } else { ! code = unicodes[i]; // char is unsigned. ! } if (code >= HI_SURROGATE_START && code <= HI_SURROGATE_END && i < count - 1) { char low = unicodes[i + 1]; --- 133,167 ---- private int remapJAIntChar(int unicode) { return (unicode == REVERSE_SOLIDUS) ? JA_YEN : unicode; } public int charToGlyph(char unicode) { int glyph = getGlyphFromCMAP(unicode); return glyph; } public int charToGlyph(int unicode) { int glyph = getGlyphFromCMAP(unicode); return glyph; } @Override public int charToVariationGlyph(int unicode, int variationSelector) { int glyph = getGlyphFromCMAP(unicode, variationSelector); return glyph; } public void charsToGlyphs(int count, int[] unicodes, int[] glyphs) { for (int i=0;i<count;i++) { glyphs[i] = getGlyphFromCMAP(unicodes[i]); } } public void charsToGlyphs(int count, char[] unicodes, int[] glyphs) { for (int i=0; i<count; i++) { ! int code = unicodes[i]; // char is unsigned. if (code >= HI_SURROGATE_START && code <= HI_SURROGATE_END && i < count - 1) { char low = unicodes[i + 1];
*** 213,227 **** continue; } } glyphs[i] = getGlyphFromCMAP(code); - if (font.checkUseNatives() && - glyphs[i] < font.glyphToCharMap.length) { - font.glyphToCharMap[glyphs[i]] = (char)code; - } - } } /* This variant checks if shaping is needed and immediately * returns true if it does. A caller of this method should be expecting --- 176,185 ----
*** 229,244 **** * the character data for display. */ public boolean charsToGlyphsNS(int count, char[] unicodes, int[] glyphs) { for (int i=0; i<count; i++) { ! int code; ! if (needsJAremapping) { ! code = remapJAChar(unicodes[i]); ! } else { ! code = unicodes[i]; // char is unsigned. ! } if (code >= HI_SURROGATE_START && code <= HI_SURROGATE_END && i < count - 1) { char low = unicodes[i + 1]; --- 187,197 ---- * the character data for display. */ public boolean charsToGlyphsNS(int count, char[] unicodes, int[] glyphs) { for (int i=0; i<count; i++) { ! int code = unicodes[i]; // char is unsigned. if (code >= HI_SURROGATE_START && code <= HI_SURROGATE_END && i < count - 1) { char low = unicodes[i + 1];
*** 249,262 **** glyphs[i + 1] = INVISIBLE_GLYPH_ID; } } glyphs[i] = getGlyphFromCMAP(code); - if (font.checkUseNatives() && - glyphs[i] < font.glyphToCharMap.length) { - font.glyphToCharMap[glyphs[i]] = (char)code; - } if (code < FontUtilities.MIN_LAYOUT_CHARCODE) { continue; } else if (FontUtilities.isComplexCharCode(code) || --- 202,211 ----
< prev index next >