--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	2011-03-11 21:41:48.000000000 -0500
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	2011-03-12 16:12:53.000000000 -0500
@@ -94,6 +94,7 @@
     public static final int ottoTag = 0x4f54544f; // 'otto' - OpenType font
 
     /* -- ID's used in the 'name' table */
+    public static final int APPLE_PLATFORM_ID = 1;
     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
@@ -1052,8 +1053,7 @@
         metrics[offset+3] = ulSize * pointSize;
     }
 
-    private String makeString(byte[] bytes, int len, short encoding) {
-
+    private String makeStringMS(byte[] bytes, int len, short encoding) {
         /* Check for fonts using encodings 2->6 is just for
          * some old DBCS fonts, apparently mostly on Solaris.
          * Some of these fonts encode ascii names as double-byte characters.
@@ -1093,7 +1093,48 @@
             return new String(bytes, 0, len);
         } catch (Throwable t) {
             return null;
-        }
+        }    	
+    }
+    
+    private String makeStringApple(byte bytes[], int len, short encoding) {
+    	String charset;
+    	switch (encoding) {
+			case 0:  charset = "MacRoman";    break;
+			case 1:  charset = "SJIS";        break; // Mac OS Japanese
+			case 2:  charset = "Big5";        break; // Mac OS Chinese Traditional
+			case 3:  charset = "EUC-KR";      break; // Mac OS Korean
+			case 4:  charset = "MacArabic";   break;
+			case 5:  charset = "MacHebrew";   break;
+			case 6:  charset = "MacGreek";    break;
+			case 7:  charset = "MacCyrillic"; break;
+			case 21: charset = "MacThai";     break;
+			case 25: charset = "EUC_CN";      break; // Mac OS Chinese Simplified
+			default: charset = "MacRoman";    break;
+		}
+    	
+	  try {
+	      return new String(bytes, 0, len, charset);
+	  } catch (UnsupportedEncodingException e) {
+	      if (FontUtilities.isLogging()) {
+	          FontUtilities.getLogger().warning(e + " EncodingID=" + encoding);
+	          }
+	      return new String(bytes, 0, len);
+	  } catch (Throwable t) {
+	      return null;
+	  }    	
+	}
+    
+    private String makeString(byte[] bytes, int len, short platform, short encoding) {
+    	if (platform == MS_PLATFORM_ID) {
+    		return makeStringMS(bytes, len, encoding);
+    	}
+    	else if (platform == APPLE_PLATFORM_ID) {
+    		return makeStringApple(bytes, len, encoding);
+    	}
+    	else {
+    		return null;
+    	}
+    	
     }
 
     protected void initNames() {
@@ -1117,7 +1158,7 @@
 
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
-                if (platformID != MS_PLATFORM_ID) {
+                if (platformID != MS_PLATFORM_ID && platformID != APPLE_PLATFORM_ID) {
                     sbuffer.position(sbuffer.position()+5);
                     continue; // skip over this record.
                 }
@@ -1136,7 +1177,7 @@
                     {
                         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){
                             familyName = tmpName;
@@ -1166,7 +1207,7 @@
                     {
                         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) {
                             fullName = tmpName;
@@ -1211,7 +1252,7 @@
 
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
-                if (platformID != MS_PLATFORM_ID) {
+                if (platformID != MS_PLATFORM_ID && platformID != APPLE_PLATFORM_ID) {
                     sbuffer.position(sbuffer.position()+5);
                     continue; // skip over this record.
                 }
@@ -1225,7 +1266,7 @@
                      || langID == findLocaleID)) {
                     buffer.position(namePtr);
                     buffer.get(name, 0, nameLen);
-                    foundName = makeString(name, nameLen, encodingID);
+                    foundName = makeString(name, nameLen, platformID, encodingID);
                     if (langID == findLocaleID) {
                         return foundName;
                     }
@@ -1296,6 +1337,112 @@
 
         Map<String, Short> map = new HashMap<String, Short>(200);
 
+        // Language IDs for mac
+        addLCIDMapEntry(map, "en", (short) 0);
+        addLCIDMapEntry(map, "fr", (short) 1);
+        addLCIDMapEntry(map, "de", (short) 2);
+        addLCIDMapEntry(map, "it", (short) 3);
+        addLCIDMapEntry(map, "nl", (short) 4);
+        addLCIDMapEntry(map, "sv", (short) 5);
+        addLCIDMapEntry(map, "es", (short) 6);
+        addLCIDMapEntry(map, "da", (short) 7);
+        addLCIDMapEntry(map, "pt", (short) 8);
+        addLCIDMapEntry(map, "no", (short) 9);
+        addLCIDMapEntry(map, "he", (short) 10);
+        addLCIDMapEntry(map, "ja", (short) 11);
+        addLCIDMapEntry(map, "ar", (short) 12);
+        addLCIDMapEntry(map, "fi", (short) 13);
+        addLCIDMapEntry(map, "is", (short) 15);
+        addLCIDMapEntry(map, "mt", (short) 16);
+        addLCIDMapEntry(map, "tr", (short) 17);
+        addLCIDMapEntry(map, "hr", (short) 18);
+        addLCIDMapEntry(map, "zh", (short) 19);
+        addLCIDMapEntry(map, "ur", (short) 20);
+        addLCIDMapEntry(map, "hi", (short) 21);
+        addLCIDMapEntry(map, "th", (short) 22);
+        addLCIDMapEntry(map, "ko", (short) 23);
+        addLCIDMapEntry(map, "lt", (short) 24);
+        addLCIDMapEntry(map, "pl", (short) 25);
+        addLCIDMapEntry(map, "hu", (short) 26);
+        addLCIDMapEntry(map, "et", (short) 27);
+        addLCIDMapEntry(map, "lv", (short) 28);
+        addLCIDMapEntry(map, "fo", (short) 30);
+        addLCIDMapEntry(map, "fa", (short) 31);
+        addLCIDMapEntry(map, "ru", (short) 32);
+        addLCIDMapEntry(map, "zh", (short) 33);
+        addLCIDMapEntry(map, "ga", (short) 35);
+        addLCIDMapEntry(map, "sq", (short) 36);
+        addLCIDMapEntry(map, "ro", (short) 37);
+        addLCIDMapEntry(map, "cs", (short) 38);
+        addLCIDMapEntry(map, "sk", (short) 39);
+        addLCIDMapEntry(map, "sl", (short) 40);
+        addLCIDMapEntry(map, "yi", (short) 41);
+        addLCIDMapEntry(map, "sr", (short) 42);
+        addLCIDMapEntry(map, "mk", (short) 43);
+        addLCIDMapEntry(map, "bg", (short) 44);
+        addLCIDMapEntry(map, "uk", (short) 45);
+        addLCIDMapEntry(map, "be", (short) 46);
+        addLCIDMapEntry(map, "uz", (short) 47);
+        addLCIDMapEntry(map, "kk", (short) 48);
+        addLCIDMapEntry(map, "hy", (short) 51);
+        addLCIDMapEntry(map, "ka", (short) 52);
+        addLCIDMapEntry(map, "mo", (short) 53);
+        addLCIDMapEntry(map, "ky", (short) 54);
+        addLCIDMapEntry(map, "tg", (short) 55);
+        addLCIDMapEntry(map, "tk", (short) 56);
+        addLCIDMapEntry(map, "ps", (short) 59);
+        addLCIDMapEntry(map, "ku", (short) 60);
+        addLCIDMapEntry(map, "ks", (short) 61);
+        addLCIDMapEntry(map, "sd", (short) 62);
+        addLCIDMapEntry(map, "bo", (short) 63);
+        addLCIDMapEntry(map, "ne", (short) 64);
+        addLCIDMapEntry(map, "sa", (short) 65);
+        addLCIDMapEntry(map, "mr", (short) 66);
+        addLCIDMapEntry(map, "bn", (short) 67);
+        addLCIDMapEntry(map, "as", (short) 68);
+        addLCIDMapEntry(map, "gu", (short) 69);
+        addLCIDMapEntry(map, "pa", (short) 70);
+        addLCIDMapEntry(map, "or", (short) 71);
+        addLCIDMapEntry(map, "ml", (short) 72);
+        addLCIDMapEntry(map, "kn", (short) 73);
+        addLCIDMapEntry(map, "ta", (short) 74);
+        addLCIDMapEntry(map, "te", (short) 75);
+        addLCIDMapEntry(map, "si", (short) 76);
+        addLCIDMapEntry(map, "my", (short) 77);
+        addLCIDMapEntry(map, "km", (short) 78);
+        addLCIDMapEntry(map, "lo", (short) 79);
+        addLCIDMapEntry(map, "vi", (short) 80);
+        addLCIDMapEntry(map, "id", (short) 81);
+        addLCIDMapEntry(map, "tl", (short) 82);
+        addLCIDMapEntry(map, "am", (short) 85);
+        addLCIDMapEntry(map, "ti", (short) 86);
+        addLCIDMapEntry(map, "om", (short) 87);
+        addLCIDMapEntry(map, "so", (short) 88);
+        addLCIDMapEntry(map, "sw", (short) 89);
+        addLCIDMapEntry(map, "rw", (short) 90);
+        addLCIDMapEntry(map, "rn", (short) 91);
+        addLCIDMapEntry(map, "mg", (short) 93);
+        addLCIDMapEntry(map, "eo", (short) 94);
+        addLCIDMapEntry(map, "cy", (short) 128);
+        addLCIDMapEntry(map, "eu", (short) 129);
+        addLCIDMapEntry(map, "ca", (short) 130);
+        addLCIDMapEntry(map, "la", (short) 131);
+        addLCIDMapEntry(map, "qu", (short) 132);
+        addLCIDMapEntry(map, "gn", (short) 133);
+        addLCIDMapEntry(map, "ay", (short) 134);
+        addLCIDMapEntry(map, "tt", (short) 135);
+        addLCIDMapEntry(map, "ug", (short) 136);
+        addLCIDMapEntry(map, "dz", (short) 137);
+        addLCIDMapEntry(map, "jv", (short) 138);
+        addLCIDMapEntry(map, "su", (short) 139);
+        addLCIDMapEntry(map, "gl", (short) 140);
+        addLCIDMapEntry(map, "af", (short) 141);
+        addLCIDMapEntry(map, "br", (short) 142);
+        addLCIDMapEntry(map, "iu", (short) 143);
+        addLCIDMapEntry(map, "gd", (short) 144);
+        addLCIDMapEntry(map, "gv", (short) 145);
+        addLCIDMapEntry(map, "to", (short) 147);
+        
         // the following statements are derived from the langIDMap
         // in src/windows/native/java/lang/java_props_md.c using the following
         // awk script:
@@ -1321,7 +1468,7 @@
         //   see http://www.microsoft.com/OpenType/otspec/name.htm
         // - print complete entries for all other LCID values
         // Run
-        //     awk -f awk-script langIDMap > statements
+        //     awk -f awk-script langIDMap > statements             
         addLCIDMapEntry(map, "ar", (short) 0x0401);
         addLCIDMapEntry(map, "bg", (short) 0x0402);
         addLCIDMapEntry(map, "ca", (short) 0x0403);
@@ -1549,7 +1696,7 @@
             int stringPtr = ((int) sbuffer.get()) & 0xffff;
             for (int i=0; i<numRecords; i++) {
                 short platformID = sbuffer.get();
-                if (platformID != MS_PLATFORM_ID) {
+                if (platformID != MS_PLATFORM_ID && platformID != APPLE_PLATFORM_ID) {
                     sbuffer.position(sbuffer.position()+5);
                     continue; // skip over this record.
                 }
@@ -1562,7 +1709,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));
                 }
             }
         }
