TMP_FontFeatureTable.cs
1.93 KB
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
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
namespace TMPro
{
/// <summary>
/// Table that contains the various font features available for the given font asset.
/// </summary>
[Serializable]
public class TMP_FontFeatureTable
{
/// <summary>
/// List that contains the glyph pair adjustment records.
/// </summary>
internal List<TMP_GlyphPairAdjustmentRecord> glyphPairAdjustmentRecords
{
get { return m_GlyphPairAdjustmentRecords; }
set { m_GlyphPairAdjustmentRecords = value; }
}
[SerializeField]
internal List<TMP_GlyphPairAdjustmentRecord> m_GlyphPairAdjustmentRecords;
/// <summary>
///
/// </summary>
internal Dictionary<long, TMP_GlyphPairAdjustmentRecord> m_GlyphPairAdjustmentRecordLookupDictionary;
// =============================================
// Constructor(s)
// =============================================
public TMP_FontFeatureTable()
{
m_GlyphPairAdjustmentRecords = new List<TMP_GlyphPairAdjustmentRecord>();
m_GlyphPairAdjustmentRecordLookupDictionary = new Dictionary<long, TMP_GlyphPairAdjustmentRecord>();
}
// =============================================
// Utility Functions
// =============================================
/// <summary>
/// Sort the glyph pair adjustment records by glyph index.
/// </summary>
public void SortGlyphPairAdjustmentRecords()
{
// Sort List of Kerning Info
if (m_GlyphPairAdjustmentRecords.Count > 0)
m_GlyphPairAdjustmentRecords = m_GlyphPairAdjustmentRecords.OrderBy(s => s.firstAdjustmentRecord.glyphIndex).ThenBy(s => s.secondAdjustmentRecord.glyphIndex).ToList();
}
}
}