forked from ACEmulator/ACE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFont.cs
45 lines (41 loc) · 1.65 KB
/
Font.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
using ACE.DatLoader.Entity;
using System.Collections.Generic;
using System.IO;
namespace ACE.DatLoader.FileTypes
{
/// <summary>
/// These are client_portal.dat files starting with 0x40.
/// It is essentially a map to a specific texture file (spritemap) that contains all the characters in this font.
/// </summary>
[DatFileType(DatFileType.Font)]
public class Font : FileType
{
public uint MaxCharHeight;
public uint MaxCharWidth;
public uint NumCharacters;
public List<FontCharDesc> CharDescs = new List<FontCharDesc>();
public uint NumHorizontalBorderPixels;
public uint NumVerticalBorderPixels;
public uint BaselineOffset;
public uint ForegroundSurfaceDataID; // This is a DataID to a Texture (0x06) type, if set
public uint BackgroundSurfaceDataID; // This is a DataID to a Texture (0x06) type, if set
public override void Unpack(BinaryReader reader)
{
Id = reader.ReadUInt32();
MaxCharHeight = reader.ReadUInt32();
MaxCharWidth = reader.ReadUInt32();
NumCharacters = reader.ReadUInt32();
for(uint i = 0; i < NumCharacters; i++)
{
var fontCharDesc = new FontCharDesc();
fontCharDesc.Unpack(reader);
CharDescs.Add(fontCharDesc);
}
NumHorizontalBorderPixels = reader.ReadUInt32();
NumVerticalBorderPixels = reader.ReadUInt32();
BaselineOffset = reader.ReadUInt32();
ForegroundSurfaceDataID = reader.ReadUInt32();
BackgroundSurfaceDataID = reader.ReadUInt32();
}
}
}