TMP_Character.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using UnityEngine.TextCore;
  3. namespace TMPro
  4. {
  5. /// <summary>
  6. /// A basic element of text.
  7. /// </summary>
  8. [Serializable]
  9. public class TMP_Character : TMP_TextElement
  10. {
  11. /// <summary>
  12. /// Default constructor.
  13. /// </summary>
  14. public TMP_Character()
  15. {
  16. m_ElementType = TextElementType.Character;
  17. this.scale = 1.0f;
  18. }
  19. /// <summary>
  20. /// Constructor for new character
  21. /// </summary>
  22. /// <param name="unicode">Unicode value.</param>
  23. /// <param name="glyph">Glyph</param>
  24. public TMP_Character(uint unicode, Glyph glyph)
  25. {
  26. m_ElementType = TextElementType.Character;
  27. this.unicode = unicode;
  28. this.glyph = glyph;
  29. this.glyphIndex = glyph.index;
  30. this.scale = 1.0f;
  31. }
  32. /// <summary>
  33. /// Constructor for new character
  34. /// </summary>
  35. /// <param name="unicode">Unicode value.</param>
  36. /// <param name="glyphIndex">Glyph index.</param>
  37. internal TMP_Character(uint unicode, uint glyphIndex)
  38. {
  39. m_ElementType = TextElementType.Character;
  40. this.unicode = unicode;
  41. this.glyph = null;
  42. this.glyphIndex = glyphIndex;
  43. this.scale = 1.0f;
  44. }
  45. }
  46. }