20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.font; 27 28 import java.awt.FontFormatException; 29 import java.awt.font.FontRenderContext; 30 import java.awt.geom.GeneralPath; 31 import java.awt.geom.Rectangle2D; 32 import java.util.HashMap; 33 import java.util.Locale; 34 import java.nio.charset.*; 35 import java.nio.CharBuffer; 36 import java.nio.ByteBuffer; 37 38 class XMap { 39 40 private static HashMap xMappers = new HashMap(); 41 42 /* ConvertedGlyphs has unicode code points as indexes and values 43 * are platform-encoded multi-bytes chars packed into java chars. 44 * These platform-encoded characters are equated to glyph ids, although 45 * that's not strictly true, as X11 only supports using chars. 46 * The assumption carried over from the native implementation that 47 * a char is big enough to hold an X11 glyph id (ie platform char). 48 */ 49 char[] convertedGlyphs; 50 51 static synchronized XMap getXMapper(String encoding) { 52 XMap mapper = (XMap)xMappers.get(encoding); 53 if (mapper == null) { 54 mapper = getXMapperInternal(encoding); 55 xMappers.put(encoding, mapper); 56 } 57 return mapper; 58 } 59 60 static final int SINGLE_BYTE = 1; 61 static final int DOUBLE_BYTE = 2; 62 63 private static XMap getXMapperInternal(String encoding) { 64 65 String jclass = null; 66 int nBytes = SINGLE_BYTE; 67 int maxU = 0xffff; 68 int minU = 0; 69 boolean addAscii = false; 70 boolean lowPartOnly = false; 71 if (encoding.equals("dingbats")) { 72 jclass = "sun.awt.motif.X11Dingbats"; | 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package sun.font; 27 28 import java.awt.FontFormatException; 29 import java.awt.font.FontRenderContext; 30 import java.awt.geom.GeneralPath; 31 import java.awt.geom.Rectangle2D; 32 import java.util.HashMap; 33 import java.util.Locale; 34 import java.nio.charset.*; 35 import java.nio.CharBuffer; 36 import java.nio.ByteBuffer; 37 38 class XMap { 39 40 private static HashMap<String, XMap> xMappers = new HashMap<>(); 41 42 /* ConvertedGlyphs has unicode code points as indexes and values 43 * are platform-encoded multi-bytes chars packed into java chars. 44 * These platform-encoded characters are equated to glyph ids, although 45 * that's not strictly true, as X11 only supports using chars. 46 * The assumption carried over from the native implementation that 47 * a char is big enough to hold an X11 glyph id (ie platform char). 48 */ 49 char[] convertedGlyphs; 50 51 static synchronized XMap getXMapper(String encoding) { 52 XMap mapper = xMappers.get(encoding); 53 if (mapper == null) { 54 mapper = getXMapperInternal(encoding); 55 xMappers.put(encoding, mapper); 56 } 57 return mapper; 58 } 59 60 static final int SINGLE_BYTE = 1; 61 static final int DOUBLE_BYTE = 2; 62 63 private static XMap getXMapperInternal(String encoding) { 64 65 String jclass = null; 66 int nBytes = SINGLE_BYTE; 67 int maxU = 0xffff; 68 int minU = 0; 69 boolean addAscii = false; 70 boolean lowPartOnly = false; 71 if (encoding.equals("dingbats")) { 72 jclass = "sun.awt.motif.X11Dingbats"; |