Hi,

OpenJDK currently treats TrueType fonts with Apple Platform ID names
as invalid format because it only supports MS Platform ID(=3).
Any font without valid MS Platform ID names is unusable on OpenJDK.

Here is a patch for both OpenJDK 6 & 7 to solve the problem.
I reached the body size limit so I only attached JDK 7's patch here.

a. Platform specified encoding ID (charset) and LANG ID (locale)
detection for Apple Mac Platform (=1), Apple Unicode (or UTF-16, =0),
ISO (deprecated, =2) is added.
Fonts shipping with Mac like STHeiti can be loaded properly after patching this.

b. Mainly a new class for mapping between Apple's LANG ID and Java
Locales is introduced.
Some Apple LANG IDs like Azerbaijan have script variants (Arabic,
Latin script) and don't seem to be mapped into valid Java Locale.

c. MS LCID Mappings are moved to a single class for better code
organization. (Existed in FontManager.java of JDK6 or
TrueTypeFont.java of JDK7)

Don't know if Apple's planing to port its implementation to OpenJDK.
This patch will help us solving the problem until they release their works.
I's hoping someone to decide whether to accept it or not.

Thanks
-Johnson

# HG changeset patch
# Parent 0a56bdd709d01c1663047e55201d19152ffd3d69
Supports TrueType fonts with Apple platform ID.

diff --git a/src/share/classes/sun/font/AppleLangIDMap.java b/src/share/classes/sun/font/AppleLangIDMap.java
new file mode 100644
--- /dev/null
+++ b/src/share/classes/sun/font/AppleLangIDMap.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2010, 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
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ *
+ * @author [email protected]
+ */
+public class AppleLangIDMap {
+
+    private static final short US_LANGID = 0; // US English - default (Apple)
+    private static Map<String, Short> appleLangIDMap;
+
+    // Return an Apple Language ID from the given Locale.
+    // Used when getting localized font data.
+    public static short getAppleLangIDFromLocale(Locale locale) {
+        // optimize for common case
+        if (locale.equals(Locale.US)) {
+            return US_LANGID;
+        }
+
+        if (appleLangIDMap == null) {
+            createAppleLangIDMap();
+        }
+
+        Locale[] locales = new Locale[] {locale,
+            new Locale(locale.getLanguage(), locale.getCountry()),
+            new Locale(locale.getLanguage(), "", locale.getVariant()),
+            new Locale(locale.getLanguage())
+        };
+        Short langidObject = null;
+        for (int i = 0; i < locales.length && langidObject == null; ++i) {
+            langidObject = (Short) appleLangIDMap.get(locales[i].toString());
+        }
+        return langidObject != null ? langidObject.shortValue() : US_LANGID;
+    }
+
+    private static void addAppleLangIDMapEntry(Map<String, Short> map,
+                                        String key, short value) {
+        map.put(key, Short.valueOf(value));
+    }
+
+    private static synchronized void createAppleLangIDMap() {
+        if (appleLangIDMap != null) {
+            return;
+        }
+
+        Map<String, Short> map = new HashMap<String, Short>(200);
+
+        // http://developer.apple.com/fonts/ttrefman/RM06/Chap6name.html#ID
+        addAppleLangIDMapEntry(map, "en", (short) 0);
+        addAppleLangIDMapEntry(map, "fr", (short) 1);
+        addAppleLangIDMapEntry(map, "de", (short) 2);
+        addAppleLangIDMapEntry(map, "it", (short) 3);
+        addAppleLangIDMapEntry(map, "nl", (short) 4);
+        addAppleLangIDMapEntry(map, "sv", (short) 5);
+        addAppleLangIDMapEntry(map, "es", (short) 6);
+        addAppleLangIDMapEntry(map, "da", (short) 7);
+        addAppleLangIDMapEntry(map, "pt", (short) 8);
+        addAppleLangIDMapEntry(map, "no", (short) 9);
+        addAppleLangIDMapEntry(map, "he", (short) 10);
+        addAppleLangIDMapEntry(map, "ja", (short) 11);
+        addAppleLangIDMapEntry(map, "ar", (short) 12);
+        addAppleLangIDMapEntry(map, "fi", (short) 13);
+        addAppleLangIDMapEntry(map, "el", (short) 14);
+        addAppleLangIDMapEntry(map, "is", (short) 15);
+        addAppleLangIDMapEntry(map, "mt", (short) 16);
+        addAppleLangIDMapEntry(map, "tr", (short) 17);
+        addAppleLangIDMapEntry(map, "hr", (short) 18);
+        addAppleLangIDMapEntry(map, "zh_TW", (short) 19);
+        addAppleLangIDMapEntry(map, "zh_HK", (short) 19);
+        addAppleLangIDMapEntry(map, "ur", (short) 20);
+        addAppleLangIDMapEntry(map, "hi", (short) 21);
+        addAppleLangIDMapEntry(map, "th", (short) 22);
+        addAppleLangIDMapEntry(map, "ko", (short) 23);
+        addAppleLangIDMapEntry(map, "lt", (short) 24);
+        addAppleLangIDMapEntry(map, "pl", (short) 25);
+        addAppleLangIDMapEntry(map, "hu", (short) 26);
+        addAppleLangIDMapEntry(map, "et", (short) 27);
+        addAppleLangIDMapEntry(map, "lv", (short) 28);
+        addAppleLangIDMapEntry(map, "se", (short) 29);
+        addAppleLangIDMapEntry(map, "fo", (short) 30);
+        addAppleLangIDMapEntry(map, "fa", (short) 31);
+        addAppleLangIDMapEntry(map, "ru", (short) 32);
+        addAppleLangIDMapEntry(map, "zh_CN", (short) 33);
+        addAppleLangIDMapEntry(map, "zh_SG", (short) 33);
+        addAppleLangIDMapEntry(map, "zh", (short) 33);
+        addAppleLangIDMapEntry(map, "nl_BE", (short) 34); // Flemish
+        addAppleLangIDMapEntry(map, "ga", (short) 35);
+        addAppleLangIDMapEntry(map, "sq", (short) 36);
+        addAppleLangIDMapEntry(map, "ro", (short) 37);
+        addAppleLangIDMapEntry(map, "cs", (short) 38);
+        addAppleLangIDMapEntry(map, "sk", (short) 39);
+        addAppleLangIDMapEntry(map, "sl", (short) 40);
+        addAppleLangIDMapEntry(map, "yi", (short) 41);
+        addAppleLangIDMapEntry(map, "sr", (short) 42);
+        addAppleLangIDMapEntry(map, "mk", (short) 43);
+        addAppleLangIDMapEntry(map, "bg", (short) 44);
+        addAppleLangIDMapEntry(map, "uk", (short) 45);
+        addAppleLangIDMapEntry(map, "be", (short) 46);
+        addAppleLangIDMapEntry(map, "uz", (short) 47);
+        addAppleLangIDMapEntry(map, "kk", (short) 48);
+        addAppleLangIDMapEntry(map, "az_AZ_Cyrl", (short) 49); // Azerbaijani (Cyrillic script)
+        addAppleLangIDMapEntry(map, "az_IR", (short) 50); // Azerbaijani (Arabic script)
+        addAppleLangIDMapEntry(map, "hy", (short) 51);
+        addAppleLangIDMapEntry(map, "ka", (short) 52);
+        addAppleLangIDMapEntry(map, "mo", (short) 53);
+        addAppleLangIDMapEntry(map, "ky", (short) 54);
+        addAppleLangIDMapEntry(map, "tg", (short) 55);
+        addAppleLangIDMapEntry(map, "tk", (short) 56);
+        addAppleLangIDMapEntry(map, "mn_CN", (short) 57); // Mongolian (Mongolian script)
+        addAppleLangIDMapEntry(map, "mn", (short) 58); // Mongolian (Cyrillic script)
+        addAppleLangIDMapEntry(map, "ps", (short) 59);
+        addAppleLangIDMapEntry(map, "ku", (short) 60);
+        addAppleLangIDMapEntry(map, "ks", (short) 61);
+        addAppleLangIDMapEntry(map, "sd", (short) 62);
+        addAppleLangIDMapEntry(map, "bo", (short) 63);
+        addAppleLangIDMapEntry(map, "ne", (short) 64);
+        addAppleLangIDMapEntry(map, "sa", (short) 65);
+        addAppleLangIDMapEntry(map, "mr", (short) 66);
+        addAppleLangIDMapEntry(map, "bn", (short) 67);
+        addAppleLangIDMapEntry(map, "as", (short) 68);
+        addAppleLangIDMapEntry(map, "gu", (short) 69);
+        addAppleLangIDMapEntry(map, "pa", (short) 70);
+        addAppleLangIDMapEntry(map, "or", (short) 71);
+        addAppleLangIDMapEntry(map, "ml", (short) 72);
+        addAppleLangIDMapEntry(map, "kn", (short) 73);
+        addAppleLangIDMapEntry(map, "ta", (short) 74);
+        addAppleLangIDMapEntry(map, "te", (short) 75);
+        addAppleLangIDMapEntry(map, "si", (short) 76);
+        addAppleLangIDMapEntry(map, "my", (short) 77);
+        addAppleLangIDMapEntry(map, "km", (short) 78);
+        addAppleLangIDMapEntry(map, "lo", (short) 79);
+        addAppleLangIDMapEntry(map, "vi", (short) 80);
+        addAppleLangIDMapEntry(map, "id", (short) 81);
+        addAppleLangIDMapEntry(map, "tl", (short) 82);
+        addAppleLangIDMapEntry(map, "ms", (short) 83); // Malay (Roman script)
+        addAppleLangIDMapEntry(map, "ms_BN", (short) 84); // Malay (Arabic script)
+        addAppleLangIDMapEntry(map, "am", (short) 85);
+        addAppleLangIDMapEntry(map, "ti", (short) 86);
+        addAppleLangIDMapEntry(map, "om", (short) 87);
+        addAppleLangIDMapEntry(map, "so", (short) 88);
+        addAppleLangIDMapEntry(map, "sw", (short) 89);
+        addAppleLangIDMapEntry(map, "rw", (short) 90);
+        addAppleLangIDMapEntry(map, "rn", (short) 91);
+        addAppleLangIDMapEntry(map, "ny", (short) 92);
+        addAppleLangIDMapEntry(map, "mg", (short) 93);
+        addAppleLangIDMapEntry(map, "eo", (short) 94);
+
+        addAppleLangIDMapEntry(map, "cy", (short) 128);
+        addAppleLangIDMapEntry(map, "eu", (short) 129);
+        addAppleLangIDMapEntry(map, "ca", (short) 130);
+        addAppleLangIDMapEntry(map, "la", (short) 131);
+        addAppleLangIDMapEntry(map, "qu", (short) 132);
+        addAppleLangIDMapEntry(map, "gn", (short) 133);
+        addAppleLangIDMapEntry(map, "ay", (short) 134);
+        addAppleLangIDMapEntry(map, "tt", (short) 135);
+        addAppleLangIDMapEntry(map, "ug", (short) 136);
+        addAppleLangIDMapEntry(map, "dz", (short) 137);
+        addAppleLangIDMapEntry(map, "jv", (short) 138);
+        addAppleLangIDMapEntry(map, "su", (short) 139);
+        addAppleLangIDMapEntry(map, "gl", (short) 140);
+        addAppleLangIDMapEntry(map, "af", (short) 141);
+        addAppleLangIDMapEntry(map, "br", (short) 142);
+        addAppleLangIDMapEntry(map, "iu", (short) 143);
+        addAppleLangIDMapEntry(map, "gd", (short) 144);
+        addAppleLangIDMapEntry(map, "gv", (short) 145);
+        addAppleLangIDMapEntry(map, "ga__Latg", (short) 146); // Irish Gaelic (with dot above)
+        addAppleLangIDMapEntry(map, "to", (short) 147);
+        addAppleLangIDMapEntry(map, "el__Polyton", (short) 148); // Greek (polytonic)
+        addAppleLangIDMapEntry(map, "kl", (short) 149);
+        addAppleLangIDMapEntry(map, "az_AZ", (short) 150); // Azerbaijani (Roman script)
+        addAppleLangIDMapEntry(map, "az", (short) 150); // Azerbaijani (Roman script)
+
+        appleLangIDMap = map;
+    }
+
+}
diff --git a/src/share/classes/sun/font/LCIDMap.java b/src/share/classes/sun/font/LCIDMap.java
new file mode 100644
--- /dev/null
+++ b/src/share/classes/sun/font/LCIDMap.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2003, 2011, 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
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ *
+ * @author [email protected]
+ */
+public class LCIDMap {
+    private static final short US_LCID = 0x0409;    // US English - default (MS)
+    private static Map<String, Short> lcidMap;
+
+    // Return a Microsoft LCID from the given Locale.
+    // Used when getting localized font data.
+    public static short getLCIDFromLocale(Locale locale) {
+        // optimize for common case
+        if (locale.equals(Locale.US)) {
+            return US_LCID;
+        }
+
+        if (lcidMap == null) {
+            createLCIDMap();
+        }
+
+        String key = locale.toString();
+        while (!"".equals(key)) {
+            Short lcidObject = (Short) lcidMap.get(key);
+            if (lcidObject != null) {
+                return lcidObject.shortValue();
+            }
+            int pos = key.lastIndexOf('_');
+            if (pos < 1) {
+                return US_LCID;
+            }
+            key = key.substring(0, pos);
+        }
+
+        return US_LCID;
+    }
+
+    private static void addLCIDMapEntry(Map<String, Short> map,
+                                        String key, short value) {
+        map.put(key, Short.valueOf(value));
+    }
+
+    private static synchronized void createLCIDMap() {
+        if (lcidMap != null) {
+            return;
+        }
+
+        Map<String, Short> map = new HashMap<String, Short>(200);
+
+        // the following statements are derived from the langIDMap
+        // in src/windows/native/java/lang/java_props_md.c using the following
+        // awk script:
+        //    $1~/\/\*/   { next}
+        //    $3~/\?\?/   { next }
+        //    $3!~/_/     { next }
+        //    $1~/0x0409/ { next }
+        //    $1~/0x0c0a/ { next }
+        //    $1~/0x042c/ { next }
+        //    $1~/0x0443/ { next }
+        //    $1~/0x0812/ { next }
+        //    $1~/0x04/   { print "        addLCIDMapEntry(map, " substr($3, 0, 3) "\", (short) " substr($1, 0, 6) ");" ; next }
+        //    $3~/,/      { print "        addLCIDMapEntry(map, " $3  " (short) " substr($1, 0, 6) ");" ; next }
+        //                { print "        addLCIDMapEntry(map, " $3 ", (short) " substr($1, 0, 6) ");" ; next }
+        // The lines of this script:
+        // - eliminate comments
+        // - eliminate questionable locales
+        // - eliminate language-only locales
+        // - eliminate the default LCID value
+        // - eliminate a few other unneeded LCID values
+        // - print language-only locale entries for x04* LCID values
+        //   (apparently Microsoft doesn't use language-only LCID values -
+        //   see http://www.microsoft.com/OpenType/otspec/name.htm
+        // - print complete entries for all other LCID values
+        // Run
+        //     awk -f awk-script langIDMap > statements
+        addLCIDMapEntry(map, "ar", (short) 0x0401);
+        addLCIDMapEntry(map, "bg", (short) 0x0402);
+        addLCIDMapEntry(map, "ca", (short) 0x0403);
+        addLCIDMapEntry(map, "zh", (short) 0x0404);
+        addLCIDMapEntry(map, "cs", (short) 0x0405);
+        addLCIDMapEntry(map, "da", (short) 0x0406);
+        addLCIDMapEntry(map, "de", (short) 0x0407);
+        addLCIDMapEntry(map, "el", (short) 0x0408);
+        addLCIDMapEntry(map, "es", (short) 0x040a);
+        addLCIDMapEntry(map, "fi", (short) 0x040b);
+        addLCIDMapEntry(map, "fr", (short) 0x040c);
+        addLCIDMapEntry(map, "iw", (short) 0x040d);
+        addLCIDMapEntry(map, "hu", (short) 0x040e);
+        addLCIDMapEntry(map, "is", (short) 0x040f);
+        addLCIDMapEntry(map, "it", (short) 0x0410);
+        addLCIDMapEntry(map, "ja", (short) 0x0411);
+        addLCIDMapEntry(map, "ko", (short) 0x0412);
+        addLCIDMapEntry(map, "nl", (short) 0x0413);
+        addLCIDMapEntry(map, "no", (short) 0x0414);
+        addLCIDMapEntry(map, "pl", (short) 0x0415);
+        addLCIDMapEntry(map, "pt", (short) 0x0416);
+        addLCIDMapEntry(map, "rm", (short) 0x0417);
+        addLCIDMapEntry(map, "ro", (short) 0x0418);
+        addLCIDMapEntry(map, "ru", (short) 0x0419);
+        addLCIDMapEntry(map, "hr", (short) 0x041a);
+        addLCIDMapEntry(map, "sk", (short) 0x041b);
+        addLCIDMapEntry(map, "sq", (short) 0x041c);
+        addLCIDMapEntry(map, "sv", (short) 0x041d);
+        addLCIDMapEntry(map, "th", (short) 0x041e);
+        addLCIDMapEntry(map, "tr", (short) 0x041f);
+        addLCIDMapEntry(map, "ur", (short) 0x0420);
+        addLCIDMapEntry(map, "in", (short) 0x0421);
+        addLCIDMapEntry(map, "uk", (short) 0x0422);
+        addLCIDMapEntry(map, "be", (short) 0x0423);
+        addLCIDMapEntry(map, "sl", (short) 0x0424);
+        addLCIDMapEntry(map, "et", (short) 0x0425);
+        addLCIDMapEntry(map, "lv", (short) 0x0426);
+        addLCIDMapEntry(map, "lt", (short) 0x0427);
+        addLCIDMapEntry(map, "fa", (short) 0x0429);
+        addLCIDMapEntry(map, "vi", (short) 0x042a);
+        addLCIDMapEntry(map, "hy", (short) 0x042b);
+        addLCIDMapEntry(map, "eu", (short) 0x042d);
+        addLCIDMapEntry(map, "mk", (short) 0x042f);
+        addLCIDMapEntry(map, "tn", (short) 0x0432);
+        addLCIDMapEntry(map, "xh", (short) 0x0434);
+        addLCIDMapEntry(map, "zu", (short) 0x0435);
+        addLCIDMapEntry(map, "af", (short) 0x0436);
+        addLCIDMapEntry(map, "ka", (short) 0x0437);
+        addLCIDMapEntry(map, "fo", (short) 0x0438);
+        addLCIDMapEntry(map, "hi", (short) 0x0439);
+        addLCIDMapEntry(map, "mt", (short) 0x043a);
+        addLCIDMapEntry(map, "se", (short) 0x043b);
+        addLCIDMapEntry(map, "gd", (short) 0x043c);
+        addLCIDMapEntry(map, "ms", (short) 0x043e);
+        addLCIDMapEntry(map, "kk", (short) 0x043f);
+        addLCIDMapEntry(map, "ky", (short) 0x0440);
+        addLCIDMapEntry(map, "sw", (short) 0x0441);
+        addLCIDMapEntry(map, "tt", (short) 0x0444);
+        addLCIDMapEntry(map, "bn", (short) 0x0445);
+        addLCIDMapEntry(map, "pa", (short) 0x0446);
+        addLCIDMapEntry(map, "gu", (short) 0x0447);
+        addLCIDMapEntry(map, "ta", (short) 0x0449);
+        addLCIDMapEntry(map, "te", (short) 0x044a);
+        addLCIDMapEntry(map, "kn", (short) 0x044b);
+        addLCIDMapEntry(map, "ml", (short) 0x044c);
+        addLCIDMapEntry(map, "mr", (short) 0x044e);
+        addLCIDMapEntry(map, "sa", (short) 0x044f);
+        addLCIDMapEntry(map, "mn", (short) 0x0450);
+        addLCIDMapEntry(map, "cy", (short) 0x0452);
+        addLCIDMapEntry(map, "gl", (short) 0x0456);
+        addLCIDMapEntry(map, "dv", (short) 0x0465);
+        addLCIDMapEntry(map, "qu", (short) 0x046b);
+        addLCIDMapEntry(map, "mi", (short) 0x0481);
+        addLCIDMapEntry(map, "ar_IQ", (short) 0x0801);
+        addLCIDMapEntry(map, "zh_CN", (short) 0x0804);
+        addLCIDMapEntry(map, "de_CH", (short) 0x0807);
+        addLCIDMapEntry(map, "en_GB", (short) 0x0809);
+        addLCIDMapEntry(map, "es_MX", (short) 0x080a);
+        addLCIDMapEntry(map, "fr_BE", (short) 0x080c);
+        addLCIDMapEntry(map, "it_CH", (short) 0x0810);
+        addLCIDMapEntry(map, "nl_BE", (short) 0x0813);
+        addLCIDMapEntry(map, "no_NO_NY", (short) 0x0814);
+        addLCIDMapEntry(map, "pt_PT", (short) 0x0816);
+        addLCIDMapEntry(map, "ro_MD", (short) 0x0818);
+        addLCIDMapEntry(map, "ru_MD", (short) 0x0819);
+        addLCIDMapEntry(map, "sr_CS", (short) 0x081a);
+        addLCIDMapEntry(map, "sv_FI", (short) 0x081d);
+        addLCIDMapEntry(map, "az_AZ", (short) 0x082c);
+        addLCIDMapEntry(map, "se_SE", (short) 0x083b);
+        addLCIDMapEntry(map, "ga_IE", (short) 0x083c);
+        addLCIDMapEntry(map, "ms_BN", (short) 0x083e);
+        addLCIDMapEntry(map, "uz_UZ", (short) 0x0843);
+        addLCIDMapEntry(map, "qu_EC", (short) 0x086b);
+        addLCIDMapEntry(map, "ar_EG", (short) 0x0c01);
+        addLCIDMapEntry(map, "zh_HK", (short) 0x0c04);
+        addLCIDMapEntry(map, "de_AT", (short) 0x0c07);
+        addLCIDMapEntry(map, "en_AU", (short) 0x0c09);
+        addLCIDMapEntry(map, "fr_CA", (short) 0x0c0c);
+        addLCIDMapEntry(map, "sr_CS", (short) 0x0c1a);
+        addLCIDMapEntry(map, "se_FI", (short) 0x0c3b);
+        addLCIDMapEntry(map, "qu_PE", (short) 0x0c6b);
+        addLCIDMapEntry(map, "ar_LY", (short) 0x1001);
+        addLCIDMapEntry(map, "zh_SG", (short) 0x1004);
+        addLCIDMapEntry(map, "de_LU", (short) 0x1007);
+        addLCIDMapEntry(map, "en_CA", (short) 0x1009);
+        addLCIDMapEntry(map, "es_GT", (short) 0x100a);
+        addLCIDMapEntry(map, "fr_CH", (short) 0x100c);
+        addLCIDMapEntry(map, "hr_BA", (short) 0x101a);
+        addLCIDMapEntry(map, "ar_DZ", (short) 0x1401);
+        addLCIDMapEntry(map, "zh_MO", (short) 0x1404);
+        addLCIDMapEntry(map, "de_LI", (short) 0x1407);
+        addLCIDMapEntry(map, "en_NZ", (short) 0x1409);
+        addLCIDMapEntry(map, "es_CR", (short) 0x140a);
+        addLCIDMapEntry(map, "fr_LU", (short) 0x140c);
+        addLCIDMapEntry(map, "bs_BA", (short) 0x141a);
+        addLCIDMapEntry(map, "ar_MA", (short) 0x1801);
+        addLCIDMapEntry(map, "en_IE", (short) 0x1809);
+        addLCIDMapEntry(map, "es_PA", (short) 0x180a);
+        addLCIDMapEntry(map, "fr_MC", (short) 0x180c);
+        addLCIDMapEntry(map, "sr_BA", (short) 0x181a);
+        addLCIDMapEntry(map, "ar_TN", (short) 0x1c01);
+        addLCIDMapEntry(map, "en_ZA", (short) 0x1c09);
+        addLCIDMapEntry(map, "es_DO", (short) 0x1c0a);
+        addLCIDMapEntry(map, "sr_BA", (short) 0x1c1a);
+        addLCIDMapEntry(map, "ar_OM", (short) 0x2001);
+        addLCIDMapEntry(map, "en_JM", (short) 0x2009);
+        addLCIDMapEntry(map, "es_VE", (short) 0x200a);
+        addLCIDMapEntry(map, "ar_YE", (short) 0x2401);
+        addLCIDMapEntry(map, "es_CO", (short) 0x240a);
+        addLCIDMapEntry(map, "ar_SY", (short) 0x2801);
+        addLCIDMapEntry(map, "en_BZ", (short) 0x2809);
+        addLCIDMapEntry(map, "es_PE", (short) 0x280a);
+        addLCIDMapEntry(map, "ar_JO", (short) 0x2c01);
+        addLCIDMapEntry(map, "en_TT", (short) 0x2c09);
+        addLCIDMapEntry(map, "es_AR", (short) 0x2c0a);
+        addLCIDMapEntry(map, "ar_LB", (short) 0x3001);
+        addLCIDMapEntry(map, "en_ZW", (short) 0x3009);
+        addLCIDMapEntry(map, "es_EC", (short) 0x300a);
+        addLCIDMapEntry(map, "ar_KW", (short) 0x3401);
+        addLCIDMapEntry(map, "en_PH", (short) 0x3409);
+        addLCIDMapEntry(map, "es_CL", (short) 0x340a);
+        addLCIDMapEntry(map, "ar_AE", (short) 0x3801);
+        addLCIDMapEntry(map, "es_UY", (short) 0x380a);
+        addLCIDMapEntry(map, "ar_BH", (short) 0x3c01);
+        addLCIDMapEntry(map, "es_PY", (short) 0x3c0a);
+        addLCIDMapEntry(map, "ar_QA", (short) 0x4001);
+        addLCIDMapEntry(map, "es_BO", (short) 0x400a);
+        addLCIDMapEntry(map, "es_SV", (short) 0x440a);
+        addLCIDMapEntry(map, "es_HN", (short) 0x480a);
+        addLCIDMapEntry(map, "es_NI", (short) 0x4c0a);
+        addLCIDMapEntry(map, "es_PR", (short) 0x500a);
+
+        lcidMap = map;
+    }
+
+}
diff --git a/src/share/classes/sun/font/TrueTypeFont.java b/src/share/classes/sun/font/TrueTypeFont.java
--- a/src/share/classes/sun/font/TrueTypeFont.java
+++ b/src/share/classes/sun/font/TrueTypeFont.java
@@ -39,9 +39,7 @@
 import java.nio.ShortBuffer;
 import java.nio.channels.ClosedChannelException;
 import java.nio.channels.FileChannel;
-import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Locale;
 import sun.java2d.Disposer;
 import sun.java2d.DisposerRecord;
@@ -94,18 +92,16 @@
     public static final int ottoTag = 0x4f54544f; // 'otto' - OpenType font
 
     /* -- ID's used in the 'name' table */
+    public static final int UNICODE_PLATFORM_ID = 0;
+    public static final int MAC_PLATFORM_ID = 1;
+    public static final int ISO_PLATFORM_ID = 2; // deprecated
     public static final int MS_PLATFORM_ID = 3;
-    /* MS locale id for US English is the "default" */
-    public static final short ENGLISH_LOCALE_ID = 0x0409; // 1033 decimal
+
     public static final int FAMILY_NAME_ID = 1;
     // public static final int STYLE_WEIGHT_ID = 2; // currently unused.
     public static final int FULL_NAME_ID = 4;
     public static final int POSTSCRIPT_NAME_ID = 6;
 
-    private static final short US_LCID = 0x0409;  // US English - default
-
-    private static Map<String, Short> lcidMap;
-
     class DirectoryEntry {
         int tag;
         int offset;
@@ -1052,7 +1048,7 @@
         metrics[offset+3] = ulSize * pointSize;
     }
 
-    private String makeString(byte[] bytes, int len, short encoding) {
+    private String parseMSStringCharset(byte[] bytes, int len, short encoding) {
 
         /* Check for fonts using encodings 2->6 is just for
          * some old DBCS fonts, apparently mostly on Solaris.
@@ -1084,6 +1080,52 @@
             default: charset = "UTF-16";  break;
         }
 
+        return charset;
+    }
+
+    private String parseAppleStringCharset(short encoding) {
+        String charset;
+        switch (encoding) {
+            // see http://developer.apple.com/fonts/ttrefman/RM06/Chap6name.html#ID
+            case 0:  charset = "MacRoman";  break;
+            case 1:  charset = "SJIS";  break;
+            case 2:  charset = "Big5";  break;
+            case 3:  charset = "EUC_KR";  break;
+            case 4:  charset = "MacArabic";  break;
+            case 5:  charset = "MacHebrew";  break;
+            case 6:  charset = "MacGreek";  break;
+            case 7:  charset = "MacCyrillic";  break;
+            case 8:  charset = "MacSymbol";  break;
+            case 21:  charset = "MacThai";  break;
+            case 25:  charset = "GBK";  break;
+            /* 9-20, 21-24, 26-31 unknown mapping. use UTF-16 instead? */
+            default: charset = "UTF-16BE";  break;
+        }
+
+        return charset;
+    }
+
+    private String parseISOStringCharset(short encoding) {
+        String charset;
+        switch (encoding) {
+            case 0:  charset = "ASCII";  break;
+            case 1:  charset = "UTF-32";  break;
+            case 2:  charset = "ISO8859-1";  break;
+            default: charset = "UTF-32";  break;
+        }
+
+        return charset;
+    }
+
+    private String makeString(byte[] bytes, int len, short platformID, short encoding) {
+        String charset = "UTF-16BE";
+        if (platformID == MS_PLATFORM_ID) {
+            charset = parseMSStringCharset(bytes, len, encoding);
+        } else if (platformID == MAC_PLATFORM_ID) {
+            charset = parseAppleStringCharset(encoding);
+        } else if (platformID == ISO_PLATFORM_ID) {
+            charset = parseISOStringCharset(encoding);
+        }
         try {
             return new String(bytes, 0, len, charset);
         } catch (UnsupportedEncodingException e) {
@@ -1096,6 +1138,13 @@
         }
     }
 
+    private boolean isLocaleID(short platformID, short langID, Locale locale) {
+        return (platformID == MS_PLATFORM_ID && langID == LCIDMap.getLCIDFromLocale(locale)) ||
+                (platformID == MAC_PLATFORM_ID && langID == AppleLangIDMap.getAppleLangIDFromLocale(locale)) ||
+                platformID == UNICODE_PLATFORM_ID ||
+                platformID == ISO_PLATFORM_ID;
+    }
+
     protected void initNames() {
 
         byte[] name = new byte[256];
@@ -1113,14 +1162,9 @@
             int stringPtr = sbuffer.get() & 0xffff;
 
             nameLocale = sun.awt.SunToolkit.getStartupLocale();
-            short nameLocaleID = getLCIDFromLocale(nameLocale);
 
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
-                if (platformID != MS_PLATFORM_ID) {
-                    sbuffer.position(sbuffer.position()+5);
-                    continue; // skip over this record.
-                }
                 short encodingID = sbuffer.get();
                 short langID     = sbuffer.get();
                 short nameID     = sbuffer.get();
@@ -1131,17 +1175,17 @@
 
                 case FAMILY_NAME_ID:
 
-                    if (familyName == null || langID == ENGLISH_LOCALE_ID ||
-                        langID == nameLocaleID)
+                    if (familyName == null || isLocaleID(platformID, langID, Locale.US) ||
+                        isLocaleID(platformID, langID, nameLocale))
                     {
                         buffer.position(namePtr);
                         buffer.get(name, 0, nameLen);
-                        tmpName = makeString(name, nameLen, encodingID);
+                        tmpName = makeString(name, nameLen, platformID, encodingID);
 
-                        if (familyName == null || langID == ENGLISH_LOCALE_ID){
+                        if (familyName == null || isLocaleID(platformID, langID, Locale.US)){
                             familyName = tmpName;
                         }
-                        if (langID == nameLocaleID) {
+                        if (isLocaleID(platformID, langID, nameLocale)) {
                             localeFamilyName = tmpName;
                         }
                     }
@@ -1161,17 +1205,17 @@
 
                 case FULL_NAME_ID:
 
-                    if (fullName == null || langID == ENGLISH_LOCALE_ID ||
-                        langID == nameLocaleID)
+                    if (fullName == null || isLocaleID(platformID, langID, Locale.US) ||
+                        isLocaleID(platformID, langID, nameLocale))
                     {
                         buffer.position(namePtr);
                         buffer.get(name, 0, nameLen);
-                        tmpName = makeString(name, nameLen, encodingID);
+                        tmpName = makeString(name, nameLen, platformID, encodingID);
 
-                        if (fullName == null || langID == ENGLISH_LOCALE_ID) {
+                        if (fullName == null || isLocaleID(platformID, langID, Locale.US)) {
                             fullName = tmpName;
                         }
-                        if (langID == nameLocaleID) {
+                        if (isLocaleID(platformID, langID, nameLocale)) {
                             localeFullName = tmpName;
                         }
                     }
@@ -1192,7 +1236,7 @@
      * English, if that isn't found, return null and let the caller
      * figure out how to handle that.
      */
-    protected String lookupName(short findLocaleID, int findNameID) {
+    protected String lookupName(Locale locale, int findNameID) {
         String foundName = null;
         byte[] name = new byte[1024];
 
@@ -1211,22 +1255,18 @@
 
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
-                if (platformID != MS_PLATFORM_ID) {
-                    sbuffer.position(sbuffer.position()+5);
-                    continue; // skip over this record.
-                }
                 short encodingID = sbuffer.get();
                 short langID     = sbuffer.get();
                 short nameID     = sbuffer.get();
                 int   nameLen    = ((int) sbuffer.get()) & 0xffff;
                 int   namePtr    = (((int) sbuffer.get()) & 0xffff) + stringPtr;
                 if (nameID == findNameID &&
-                    ((foundName == null && langID == ENGLISH_LOCALE_ID)
-                     || langID == findLocaleID)) {
+                    ((foundName == null && isLocaleID(platformID, langID, Locale.US))
+                     || isLocaleID(platformID, langID, locale))) {
                     buffer.position(namePtr);
                     buffer.get(name, 0, nameLen);
-                    foundName = makeString(name, nameLen, encodingID);
-                    if (langID == findLocaleID) {
+                    foundName = makeString(name, nameLen, platformID, encodingID);
+                    if (isLocaleID(platformID, langID, locale)) {
                         return foundName;
                     }
                 }
@@ -1256,7 +1296,7 @@
      */
     @Override
     public String getPostscriptName() {
-        String name = lookupName(ENGLISH_LOCALE_ID, POSTSCRIPT_NAME_ID);
+        String name = lookupName(Locale.US, POSTSCRIPT_NAME_ID);
         if (name == null) {
             return fullName;
         } else {
@@ -1271,8 +1311,7 @@
         } else if (locale.equals(nameLocale) && localeFullName != null) {
             return localeFullName;
         } else {
-            short localeID = getLCIDFromLocale(locale);
-            String name = lookupName(localeID, FULL_NAME_ID);
+            String name = lookupName(locale, FULL_NAME_ID);
             if (name == null) {
                 return fullName;
             } else {
@@ -1281,227 +1320,6 @@
         }
     }
 
-    // Return a Microsoft LCID from the given Locale.
-    // Used when getting localized font data.
-
-    private static void addLCIDMapEntry(Map<String, Short> map,
-                                        String key, short value) {
-        map.put(key, Short.valueOf(value));
-    }
-
-    private static synchronized void createLCIDMap() {
-        if (lcidMap != null) {
-            return;
-        }
-
-        Map<String, Short> map = new HashMap<String, Short>(200);
-
-        // the following statements are derived from the langIDMap
-        // in src/windows/native/java/lang/java_props_md.c using the following
-        // awk script:
-        //    $1~/\/\*/   { next}
-        //    $3~/\?\?/   { next }
-        //    $3!~/_/     { next }
-        //    $1~/0x0409/ { next }
-        //    $1~/0x0c0a/ { next }
-        //    $1~/0x042c/ { next }
-        //    $1~/0x0443/ { next }
-        //    $1~/0x0812/ { next }
-        //    $1~/0x04/   { print "        addLCIDMapEntry(map, " substr($3, 0, 3) "\", (short) " substr($1, 0, 6) ");" ; next }
-        //    $3~/,/      { print "        addLCIDMapEntry(map, " $3  " (short) " substr($1, 0, 6) ");" ; next }
-        //                { print "        addLCIDMapEntry(map, " $3 ", (short) " substr($1, 0, 6) ");" ; next }
-        // The lines of this script:
-        // - eliminate comments
-        // - eliminate questionable locales
-        // - eliminate language-only locales
-        // - eliminate the default LCID value
-        // - eliminate a few other unneeded LCID values
-        // - print language-only locale entries for x04* LCID values
-        //   (apparently Microsoft doesn't use language-only LCID values -
-        //   see http://www.microsoft.com/OpenType/otspec/name.htm
-        // - print complete entries for all other LCID values
-        // Run
-        //     awk -f awk-script langIDMap > statements
-        addLCIDMapEntry(map, "ar", (short) 0x0401);
-        addLCIDMapEntry(map, "bg", (short) 0x0402);
-        addLCIDMapEntry(map, "ca", (short) 0x0403);
-        addLCIDMapEntry(map, "zh", (short) 0x0404);
-        addLCIDMapEntry(map, "cs", (short) 0x0405);
-        addLCIDMapEntry(map, "da", (short) 0x0406);
-        addLCIDMapEntry(map, "de", (short) 0x0407);
-        addLCIDMapEntry(map, "el", (short) 0x0408);
-        addLCIDMapEntry(map, "es", (short) 0x040a);
-        addLCIDMapEntry(map, "fi", (short) 0x040b);
-        addLCIDMapEntry(map, "fr", (short) 0x040c);
-        addLCIDMapEntry(map, "iw", (short) 0x040d);
-        addLCIDMapEntry(map, "hu", (short) 0x040e);
-        addLCIDMapEntry(map, "is", (short) 0x040f);
-        addLCIDMapEntry(map, "it", (short) 0x0410);
-        addLCIDMapEntry(map, "ja", (short) 0x0411);
-        addLCIDMapEntry(map, "ko", (short) 0x0412);
-        addLCIDMapEntry(map, "nl", (short) 0x0413);
-        addLCIDMapEntry(map, "no", (short) 0x0414);
-        addLCIDMapEntry(map, "pl", (short) 0x0415);
-        addLCIDMapEntry(map, "pt", (short) 0x0416);
-        addLCIDMapEntry(map, "rm", (short) 0x0417);
-        addLCIDMapEntry(map, "ro", (short) 0x0418);
-        addLCIDMapEntry(map, "ru", (short) 0x0419);
-        addLCIDMapEntry(map, "hr", (short) 0x041a);
-        addLCIDMapEntry(map, "sk", (short) 0x041b);
-        addLCIDMapEntry(map, "sq", (short) 0x041c);
-        addLCIDMapEntry(map, "sv", (short) 0x041d);
-        addLCIDMapEntry(map, "th", (short) 0x041e);
-        addLCIDMapEntry(map, "tr", (short) 0x041f);
-        addLCIDMapEntry(map, "ur", (short) 0x0420);
-        addLCIDMapEntry(map, "in", (short) 0x0421);
-        addLCIDMapEntry(map, "uk", (short) 0x0422);
-        addLCIDMapEntry(map, "be", (short) 0x0423);
-        addLCIDMapEntry(map, "sl", (short) 0x0424);
-        addLCIDMapEntry(map, "et", (short) 0x0425);
-        addLCIDMapEntry(map, "lv", (short) 0x0426);
-        addLCIDMapEntry(map, "lt", (short) 0x0427);
-        addLCIDMapEntry(map, "fa", (short) 0x0429);
-        addLCIDMapEntry(map, "vi", (short) 0x042a);
-        addLCIDMapEntry(map, "hy", (short) 0x042b);
-        addLCIDMapEntry(map, "eu", (short) 0x042d);
-        addLCIDMapEntry(map, "mk", (short) 0x042f);
-        addLCIDMapEntry(map, "tn", (short) 0x0432);
-        addLCIDMapEntry(map, "xh", (short) 0x0434);
-        addLCIDMapEntry(map, "zu", (short) 0x0435);
-        addLCIDMapEntry(map, "af", (short) 0x0436);
-        addLCIDMapEntry(map, "ka", (short) 0x0437);
-        addLCIDMapEntry(map, "fo", (short) 0x0438);
-        addLCIDMapEntry(map, "hi", (short) 0x0439);
-        addLCIDMapEntry(map, "mt", (short) 0x043a);
-        addLCIDMapEntry(map, "se", (short) 0x043b);
-        addLCIDMapEntry(map, "gd", (short) 0x043c);
-        addLCIDMapEntry(map, "ms", (short) 0x043e);
-        addLCIDMapEntry(map, "kk", (short) 0x043f);
-        addLCIDMapEntry(map, "ky", (short) 0x0440);
-        addLCIDMapEntry(map, "sw", (short) 0x0441);
-        addLCIDMapEntry(map, "tt", (short) 0x0444);
-        addLCIDMapEntry(map, "bn", (short) 0x0445);
-        addLCIDMapEntry(map, "pa", (short) 0x0446);
-        addLCIDMapEntry(map, "gu", (short) 0x0447);
-        addLCIDMapEntry(map, "ta", (short) 0x0449);
-        addLCIDMapEntry(map, "te", (short) 0x044a);
-        addLCIDMapEntry(map, "kn", (short) 0x044b);
-        addLCIDMapEntry(map, "ml", (short) 0x044c);
-        addLCIDMapEntry(map, "mr", (short) 0x044e);
-        addLCIDMapEntry(map, "sa", (short) 0x044f);
-        addLCIDMapEntry(map, "mn", (short) 0x0450);
-        addLCIDMapEntry(map, "cy", (short) 0x0452);
-        addLCIDMapEntry(map, "gl", (short) 0x0456);
-        addLCIDMapEntry(map, "dv", (short) 0x0465);
-        addLCIDMapEntry(map, "qu", (short) 0x046b);
-        addLCIDMapEntry(map, "mi", (short) 0x0481);
-        addLCIDMapEntry(map, "ar_IQ", (short) 0x0801);
-        addLCIDMapEntry(map, "zh_CN", (short) 0x0804);
-        addLCIDMapEntry(map, "de_CH", (short) 0x0807);
-        addLCIDMapEntry(map, "en_GB", (short) 0x0809);
-        addLCIDMapEntry(map, "es_MX", (short) 0x080a);
-        addLCIDMapEntry(map, "fr_BE", (short) 0x080c);
-        addLCIDMapEntry(map, "it_CH", (short) 0x0810);
-        addLCIDMapEntry(map, "nl_BE", (short) 0x0813);
-        addLCIDMapEntry(map, "no_NO_NY", (short) 0x0814);
-        addLCIDMapEntry(map, "pt_PT", (short) 0x0816);
-        addLCIDMapEntry(map, "ro_MD", (short) 0x0818);
-        addLCIDMapEntry(map, "ru_MD", (short) 0x0819);
-        addLCIDMapEntry(map, "sr_CS", (short) 0x081a);
-        addLCIDMapEntry(map, "sv_FI", (short) 0x081d);
-        addLCIDMapEntry(map, "az_AZ", (short) 0x082c);
-        addLCIDMapEntry(map, "se_SE", (short) 0x083b);
-        addLCIDMapEntry(map, "ga_IE", (short) 0x083c);
-        addLCIDMapEntry(map, "ms_BN", (short) 0x083e);
-        addLCIDMapEntry(map, "uz_UZ", (short) 0x0843);
-        addLCIDMapEntry(map, "qu_EC", (short) 0x086b);
-        addLCIDMapEntry(map, "ar_EG", (short) 0x0c01);
-        addLCIDMapEntry(map, "zh_HK", (short) 0x0c04);
-        addLCIDMapEntry(map, "de_AT", (short) 0x0c07);
-        addLCIDMapEntry(map, "en_AU", (short) 0x0c09);
-        addLCIDMapEntry(map, "fr_CA", (short) 0x0c0c);
-        addLCIDMapEntry(map, "sr_CS", (short) 0x0c1a);
-        addLCIDMapEntry(map, "se_FI", (short) 0x0c3b);
-        addLCIDMapEntry(map, "qu_PE", (short) 0x0c6b);
-        addLCIDMapEntry(map, "ar_LY", (short) 0x1001);
-        addLCIDMapEntry(map, "zh_SG", (short) 0x1004);
-        addLCIDMapEntry(map, "de_LU", (short) 0x1007);
-        addLCIDMapEntry(map, "en_CA", (short) 0x1009);
-        addLCIDMapEntry(map, "es_GT", (short) 0x100a);
-        addLCIDMapEntry(map, "fr_CH", (short) 0x100c);
-        addLCIDMapEntry(map, "hr_BA", (short) 0x101a);
-        addLCIDMapEntry(map, "ar_DZ", (short) 0x1401);
-        addLCIDMapEntry(map, "zh_MO", (short) 0x1404);
-        addLCIDMapEntry(map, "de_LI", (short) 0x1407);
-        addLCIDMapEntry(map, "en_NZ", (short) 0x1409);
-        addLCIDMapEntry(map, "es_CR", (short) 0x140a);
-        addLCIDMapEntry(map, "fr_LU", (short) 0x140c);
-        addLCIDMapEntry(map, "bs_BA", (short) 0x141a);
-        addLCIDMapEntry(map, "ar_MA", (short) 0x1801);
-        addLCIDMapEntry(map, "en_IE", (short) 0x1809);
-        addLCIDMapEntry(map, "es_PA", (short) 0x180a);
-        addLCIDMapEntry(map, "fr_MC", (short) 0x180c);
-        addLCIDMapEntry(map, "sr_BA", (short) 0x181a);
-        addLCIDMapEntry(map, "ar_TN", (short) 0x1c01);
-        addLCIDMapEntry(map, "en_ZA", (short) 0x1c09);
-        addLCIDMapEntry(map, "es_DO", (short) 0x1c0a);
-        addLCIDMapEntry(map, "sr_BA", (short) 0x1c1a);
-        addLCIDMapEntry(map, "ar_OM", (short) 0x2001);
-        addLCIDMapEntry(map, "en_JM", (short) 0x2009);
-        addLCIDMapEntry(map, "es_VE", (short) 0x200a);
-        addLCIDMapEntry(map, "ar_YE", (short) 0x2401);
-        addLCIDMapEntry(map, "es_CO", (short) 0x240a);
-        addLCIDMapEntry(map, "ar_SY", (short) 0x2801);
-        addLCIDMapEntry(map, "en_BZ", (short) 0x2809);
-        addLCIDMapEntry(map, "es_PE", (short) 0x280a);
-        addLCIDMapEntry(map, "ar_JO", (short) 0x2c01);
-        addLCIDMapEntry(map, "en_TT", (short) 0x2c09);
-        addLCIDMapEntry(map, "es_AR", (short) 0x2c0a);
-        addLCIDMapEntry(map, "ar_LB", (short) 0x3001);
-        addLCIDMapEntry(map, "en_ZW", (short) 0x3009);
-        addLCIDMapEntry(map, "es_EC", (short) 0x300a);
-        addLCIDMapEntry(map, "ar_KW", (short) 0x3401);
-        addLCIDMapEntry(map, "en_PH", (short) 0x3409);
-        addLCIDMapEntry(map, "es_CL", (short) 0x340a);
-        addLCIDMapEntry(map, "ar_AE", (short) 0x3801);
-        addLCIDMapEntry(map, "es_UY", (short) 0x380a);
-        addLCIDMapEntry(map, "ar_BH", (short) 0x3c01);
-        addLCIDMapEntry(map, "es_PY", (short) 0x3c0a);
-        addLCIDMapEntry(map, "ar_QA", (short) 0x4001);
-        addLCIDMapEntry(map, "es_BO", (short) 0x400a);
-        addLCIDMapEntry(map, "es_SV", (short) 0x440a);
-        addLCIDMapEntry(map, "es_HN", (short) 0x480a);
-        addLCIDMapEntry(map, "es_NI", (short) 0x4c0a);
-        addLCIDMapEntry(map, "es_PR", (short) 0x500a);
-
-        lcidMap = map;
-    }
-
-    private static short getLCIDFromLocale(Locale locale) {
-        // optimize for common case
-        if (locale.equals(Locale.US)) {
-            return US_LCID;
-        }
-
-        if (lcidMap == null) {
-            createLCIDMap();
-        }
-
-        String key = locale.toString();
-        while (!"".equals(key)) {
-            Short lcidObject = (Short) lcidMap.get(key);
-            if (lcidObject != null) {
-                return lcidObject.shortValue();
-            }
-            int pos = key.lastIndexOf('_');
-            if (pos < 1) {
-                return US_LCID;
-            }
-            key = key.substring(0, pos);
-        }
-
-        return US_LCID;
-    }
 
     @Override
     public String getFamilyName(Locale locale) {
@@ -1510,8 +1328,7 @@
         } else if (locale.equals(nameLocale) && localeFamilyName != null) {
             return localeFamilyName;
         } else {
-            short localeID = getLCIDFromLocale(locale);
-            String name = lookupName(localeID, FAMILY_NAME_ID);
+            String name = lookupName(locale, FAMILY_NAME_ID);
             if (name == null) {
                 return familyName;
             } else {
@@ -1549,10 +1366,6 @@
             int stringPtr = ((int) sbuffer.get()) & 0xffff;
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
-                if (platformID != MS_PLATFORM_ID) {
-                    sbuffer.position(sbuffer.position()+5);
-                    continue; // skip over this record.
-                }
                 short encodingID = sbuffer.get();
                 short langID     = sbuffer.get();
                 short nameID     = sbuffer.get();
@@ -1562,7 +1375,7 @@
                 if (nameID == requestedID) {
                     buffer.position(namePtr);
                     buffer.get(name, 0, nameLen);
-                    names.add(makeString(name, nameLen, encodingID));
+                    names.add(makeString(name, nameLen, platformID, encodingID));
                 }
             }
         }

Reply via email to