-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBMGlyph.cs
77 lines (71 loc) · 1.65 KB
/
BMGlyph.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Decompiled with JetBrains decompiler
// Type: BMGlyph
// Assembly: Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
using System;
using System.Collections.Generic;
[Serializable]
public class BMGlyph
{
public int advance;
public int channel;
public int height;
public int index;
public List<int> kerning;
public int offsetX;
public int offsetY;
public int width;
public int x;
public int y;
public int GetKerning(int previousChar)
{
if (this.kerning != null)
{
int index = 0;
for (int count = this.kerning.Count; index < count; index += 2)
{
if (this.kerning[index] == previousChar)
return this.kerning[index + 1];
}
}
return 0;
}
public void SetKerning(int previousChar, int amount)
{
if (this.kerning == null)
this.kerning = new List<int>();
for (int index = 0; index < this.kerning.Count; index += 2)
{
if (this.kerning[index] == previousChar)
{
this.kerning[index + 1] = amount;
return;
}
}
this.kerning.Add(previousChar);
this.kerning.Add(amount);
}
public void Trim(int xMin, int yMin, int xMax, int yMax)
{
int num1 = this.x + this.width;
int num2 = this.y + this.height;
if (this.x < xMin)
{
int num3 = xMin - this.x;
this.x += num3;
this.width -= num3;
this.offsetX += num3;
}
if (this.y < yMin)
{
int num4 = yMin - this.y;
this.y += num4;
this.height -= num4;
this.offsetY += num4;
}
if (num1 > xMax)
this.width -= num1 - xMax;
if (num2 <= yMax)
return;
this.height -= num2 - yMax;
}
}