< prev index next >

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

Print this page
rev 59383 : [mq]: final

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -36,11 +36,10 @@
     /* 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;
 

@@ -59,15 +58,10 @@
         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;
     }

@@ -139,66 +133,35 @@
     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.
-            }
+            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,15 +176,10 @@
                     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

@@ -229,16 +187,11 @@
      * 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.
-            }
+            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,14 +202,10 @@
                     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) ||
< prev index next >