changeset 57774:747c05277fd7

8231556: Wrong font ligatures used when 2 versions of same font used Reviewed-by: serb, kcr
author prr
date Thu, 19 Dec 2019 15:36:40 -0800
parents eb42609c4249
children 75dd1b241671
files src/java.desktop/share/classes/sun/font/PhysicalFont.java
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/classes/sun/font/PhysicalFont.java	Thu Dec 19 12:28:56 2019 -0800
+++ b/src/java.desktop/share/classes/sun/font/PhysicalFont.java	Thu Dec 19 15:36:40 2019 -0800
@@ -41,12 +41,19 @@
     protected Object nativeNames;
 
     public boolean equals(Object o) {
-        return (o != null && o.getClass() == this.getClass() &&
-                ((Font2D)o).fullName.equals(this.fullName));
+        if (o == null || o.getClass() != this.getClass()) {
+            return false;
+        }
+        PhysicalFont other = (PhysicalFont)o;
+        return
+           (this.fullName.equals(other.fullName)) &&
+            ((this.platName == null && other.platName == null) ||
+             (this.platName != null && this.platName.equals(other.platName)));
     }
 
     public int hashCode() {
-        return fullName.hashCode();
+        return fullName.hashCode() +
+               (platName != null ? platName.hashCode() : 0);
     }
 
     /**