Dashboard/Quik/Media/FontInfo.cs

44 lines
1.0 KiB
C#
Raw Normal View History

2023-06-29 13:17:32 +02:00
using System;
namespace Quik.Media
{
public struct FontInfo : IEquatable<FontInfo>
{
public string Family { get; }
public FontStyle Style { get; }
public override string ToString()
{
2023-09-22 18:30:17 +02:00
return $"{Family} {Style}";
2023-06-29 13:17:32 +02:00
}
public override int GetHashCode()
{
return Family.GetHashCode() ^
2023-09-22 18:30:17 +02:00
(Style.GetHashCode() * 3976061);
2023-06-29 13:17:32 +02:00
}
public static bool operator==(FontInfo a, FontInfo b)
{
return (a.Style == b.Style) &&
(a.Family == a.Family);
}
public static bool operator!=(FontInfo a, FontInfo b)
{
return (a.Style != b.Style) ||
(a.Family != b.Family);
}
public bool Equals(FontInfo other)
{
return this == other;
}
public override bool Equals(object obj)
{
return (obj.GetType() == typeof(FontInfo)) &&
this == (FontInfo)obj;
}
}
}