Skip to content

Commit

Permalink
8231556: Wrong font ligatures used when 2 versions of same font used
Browse files Browse the repository at this point in the history
Backport-of: d86eb1d
  • Loading branch information
Sonia Zaldana Calles authored and jerboaa committed Nov 28, 2023
1 parent f65058e commit a3661a5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/java.desktop/share/classes/sun/font/PhysicalFont.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,19 @@ public abstract class PhysicalFont extends Font2D {
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);
}

/**
Expand Down

1 comment on commit a3661a5

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.