TMP_TextElement.cs
1.97 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
using System;
using UnityEngine;
using UnityEngine.TextCore;
namespace TMPro
{
public enum TextElementType : byte
{
Character = 0x1,
Sprite = 0x2,
}
/// <summary>
/// Base class for all text elements like Character and SpriteCharacter.
/// </summary>
[Serializable]
public class TMP_TextElement
{
/// <summary>
/// The type of text element which can be a character or sprite.
/// </summary>
public TextElementType elementType { get { return m_ElementType; } }
/// <summary>
/// The unicode value (code point) of the character.
/// </summary>
public uint unicode { get { return m_Unicode; } set { m_Unicode = value; } }
/// <summary>
/// The Text Asset to which this Text Element belongs.
/// </summary>
public TMP_Asset textAsset { get { return m_TextAsset; } set { m_TextAsset = value; } }
/// <summary>
/// The glyph used by this text element.
/// </summary>
public Glyph glyph { get { return m_Glyph; } set { m_Glyph = value; } }
/// <summary>
/// The index of the glyph used by this text element.
/// </summary>
public uint glyphIndex { get { return m_GlyphIndex; } set { m_GlyphIndex = value; } }
/// <summary>
/// The relative scale of the character.
/// </summary>
public float scale { get { return m_Scale; } set { m_Scale = value; } }
// =============================================
// Private backing fields for public properties.
// =============================================
[SerializeField]
protected TextElementType m_ElementType;
[SerializeField]
internal uint m_Unicode;
internal TMP_Asset m_TextAsset;
internal Glyph m_Glyph;
[SerializeField]
internal uint m_GlyphIndex;
[SerializeField]
internal float m_Scale;
}
}