Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

FontFeatureCommonGSUB.cs 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using UnityEngine;
  3. #pragma warning disable CS0660, CS0661
  4. namespace TMPro
  5. {
  6. /// <summary>
  7. /// The SingleSubstitutionRecord defines the substitution of a single glyph by another.
  8. /// </summary>
  9. [Serializable]
  10. public struct SingleSubstitutionRecord
  11. {
  12. //
  13. }
  14. /// <summary>
  15. /// The MultipleSubstitutionRecord defines the substitution of a single glyph by multiple glyphs.
  16. /// </summary>
  17. [Serializable]
  18. public struct MultipleSubstitutionRecord
  19. {
  20. /// <summary>
  21. /// The index of the target glyph being substituted.
  22. /// </summary>
  23. public uint targetGlyphID { get { return m_TargetGlyphID; } set { m_TargetGlyphID = value; } }
  24. /// <summary>
  25. /// Array that contains the index of the glyphs replacing the single target glyph.
  26. /// </summary>
  27. public uint[] substituteGlyphIDs { get { return m_SubstituteGlyphIDs; } set { m_SubstituteGlyphIDs = value; } }
  28. // =============================================
  29. // Private backing fields for public properties.
  30. // =============================================
  31. [SerializeField]
  32. private uint m_TargetGlyphID;
  33. [SerializeField]
  34. private uint[] m_SubstituteGlyphIDs;
  35. }
  36. /// <summary>
  37. /// The AlternateSubstitutionRecord defines the substitution of a single glyph by several potential alternative glyphs.
  38. /// </summary>
  39. [Serializable]
  40. public struct AlternateSubstitutionRecord
  41. {
  42. }
  43. /// <summary>
  44. /// The LigatureSubstitutionRecord defines the substitution of multiple glyphs by a single glyph.
  45. /// </summary>
  46. [Serializable]
  47. public struct LigatureSubstitutionRecord
  48. {
  49. /// <summary>
  50. /// Array that contains the index of the glyphs being substituted.
  51. /// </summary>
  52. public uint[] componentGlyphIDs { get { return m_ComponentGlyphIDs; } set { m_ComponentGlyphIDs = value; } }
  53. /// <summary>
  54. /// The index of the replacement glyph.
  55. /// </summary>
  56. public uint ligatureGlyphID { get { return m_LigatureGlyphID; } set { m_LigatureGlyphID = value; } }
  57. // =============================================
  58. // Private backing fields for public properties.
  59. // =============================================
  60. [SerializeField]
  61. private uint[] m_ComponentGlyphIDs;
  62. [SerializeField]
  63. private uint m_LigatureGlyphID;
  64. // =============================================
  65. // Operator overrides
  66. // =============================================
  67. public static bool operator==(LigatureSubstitutionRecord lhs, LigatureSubstitutionRecord rhs)
  68. {
  69. if (lhs.ligatureGlyphID != rhs.m_LigatureGlyphID)
  70. return false;
  71. int lhsComponentCount = lhs.m_ComponentGlyphIDs.Length;
  72. if (lhsComponentCount != rhs.m_ComponentGlyphIDs.Length)
  73. return false;
  74. for (int i = 0; i < lhsComponentCount; i++)
  75. {
  76. if (lhs.m_ComponentGlyphIDs[i] != rhs.m_ComponentGlyphIDs[i])
  77. return false;
  78. }
  79. return true;
  80. }
  81. public static bool operator!=(LigatureSubstitutionRecord lhs, LigatureSubstitutionRecord rhs)
  82. {
  83. return !(lhs == rhs);
  84. }
  85. }
  86. }