diff --git a/src/Skia/Avalonia.Skia/TypefaceCache.cs b/src/Skia/Avalonia.Skia/TypefaceCache.cs index 3d1bf8add0..c5f3d371ad 100644 --- a/src/Skia/Avalonia.Skia/TypefaceCache.cs +++ b/src/Skia/Avalonia.Skia/TypefaceCache.cs @@ -20,7 +20,27 @@ namespace Avalonia.Skia Slant = slant; Weight = weight; } - + + public override int GetHashCode() + { + int hash = 17; + hash = hash * 31 + (int)Slant; + hash = hash * 31 + (int)Weight; + + return hash; + } + + public override bool Equals(object other) + { + return other is FontKey ? Equals((FontKey)other) : false; + } + + public bool Equals(FontKey other) + { + return Slant == other.Slant && + Weight == other.Weight; + } + // Equals and GetHashCode ommitted }