forked from MaximumADHD/Roblox-File-Format
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFontFace.cs
52 lines (41 loc) · 1.39 KB
/
FontFace.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using RobloxFiles.Enums;
namespace RobloxFiles.DataTypes
{
// Implementation of Roblox's Font datatype.
// Renamed to FontFace to avoid disambiguation with System.Font and the Font enum.
public class FontFace
{
public readonly Content Family = "rbxasset://fonts/families/LegacyArial.json";
public readonly FontWeight Weight = FontWeight.Regular;
public readonly FontStyle Style = FontStyle.Normal;
public FontFace(Content family, FontWeight weight = FontWeight.Regular, FontStyle style = FontStyle.Normal)
{
Family = family;
Weight = weight;
Style = style;
}
public override string ToString()
{
return $"Font {{ Family = {Family}, Weight = {Weight}, Style = {Style}}}";
}
public override int GetHashCode()
{
int hash = Family.GetHashCode()
^ Weight.GetHashCode()
^ Style.GetHashCode();
return hash;
}
public override bool Equals(object obj)
{
if (!(obj is FontFace font))
return false;
if (Family != font.Family)
return false;
if (Weight != font.Weight)
return false;
if (Style != font.Style)
return false;
return true;
}
}
}