8170950: Text is displayed in bold when fonts are installed into symlinked folder
authordbatrak
Tue, 14 Feb 2017 00:09:32 +0300
changeset 43832 b9f4905c5240
parent 43831 a6e823534165
child 43833 205cd5dd58a9
8170950: Text is displayed in bold when fonts are installed into symlinked folder Reviewed-by: prr, serb
jdk/src/java.desktop/share/classes/sun/font/FontFamily.java
--- a/jdk/src/java.desktop/share/classes/sun/font/FontFamily.java	Mon Feb 13 11:51:03 2017 -0800
+++ b/jdk/src/java.desktop/share/classes/sun/font/FontFamily.java	Tue Feb 14 00:09:32 2017 +0300
@@ -27,6 +27,7 @@
 
 import java.io.File;
 import java.awt.Font;
+import java.io.IOException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
@@ -132,6 +133,16 @@
 
         FileFont newFont = (FileFont)font;
         File newDir = (new File(newFont.platName)).getParentFile();
+        if (existDir != null) {
+            try {
+                existDir = existDir.getCanonicalFile();
+            } catch (IOException ignored) {}
+        }
+        if (newDir != null) {
+            try {
+                newDir = newDir.getCanonicalFile();
+            } catch (IOException ignored) {}
+        }
         return java.util.Objects.equals(newDir, existDir);
     }