using System; using UnityEngine; namespace TMPro { /// /// A GlyphAnchorPoint defines the position of an anchor point relative to the origin of a glyph. /// This data structure is used by the Mark-to-Base, Mark-to-Mark and Mark-to-Ligature OpenType font features. /// [Serializable] public struct GlyphAnchorPoint { /// /// The x coordinate of the anchor point relative to the glyph. /// public float xCoordinate { get { return m_XCoordinate; } set { m_XCoordinate = value; } } /// /// The y coordinate of the anchor point relative to the glyph. /// public float yCoordinate { get { return m_YCoordinate; } set { m_YCoordinate = value; } } // ============================================= // Private backing fields for public properties. // ============================================= [SerializeField] private float m_XCoordinate; [SerializeField] private float m_YCoordinate; } /// /// A MarkPositionAdjustment defines the positional adjustment of a glyph relative to the anchor point of base glyph. /// This data structure is used by the Mark-to-Base, Mark-to-Mark and Mark-to-Ligature OpenType font features. /// [Serializable] public struct MarkPositionAdjustment { /// /// The horizontal positional adjustment of the glyph relative to the anchor point of its parent base glyph. /// public float xPositionAdjustment { get { return m_XPositionAdjustment; } set { m_XPositionAdjustment = value; } } /// /// The vertical positional adjustment of the glyph relative to the anchor point of its parent base glyph. /// public float yPositionAdjustment { get { return m_YPositionAdjustment; } set { m_YPositionAdjustment = value; } } /// /// Initializes and returns an instance of MarkPositionAdjustment /// /// The horizontal positional adjustment. /// The vertical positional adjustment. public MarkPositionAdjustment(float x, float y) { m_XPositionAdjustment = x; m_YPositionAdjustment = y; } // ============================================= // Private backing fields for public properties. // ============================================= [SerializeField] private float m_XPositionAdjustment; [SerializeField] private float m_YPositionAdjustment; }; /// /// A MarkToBaseAdjustmentRecord defines the positional adjustment between a base glyph and mark glyph. /// [Serializable] public struct MarkToBaseAdjustmentRecord { /// /// The index of the base glyph. /// public uint baseGlyphID { get { return m_BaseGlyphID; } set { m_BaseGlyphID = value; } } /// /// The position of the anchor point of the base glyph. /// public GlyphAnchorPoint baseGlyphAnchorPoint { get { return m_BaseGlyphAnchorPoint; } set { m_BaseGlyphAnchorPoint = value; } } /// /// The index of the mark glyph. /// public uint markGlyphID { get { return m_MarkGlyphID; } set { m_MarkGlyphID = value; } } /// /// The positional adjustment of the mark glyph relative to the anchor point of the base glyph. /// public MarkPositionAdjustment markPositionAdjustment { get { return m_MarkPositionAdjustment; } set { m_MarkPositionAdjustment = value; } } // ============================================= // Private backing fields for public properties. // ============================================= [SerializeField] private uint m_BaseGlyphID; [SerializeField] private GlyphAnchorPoint m_BaseGlyphAnchorPoint; [SerializeField] private uint m_MarkGlyphID; [SerializeField] private MarkPositionAdjustment m_MarkPositionAdjustment; } /// /// A MarkToMarkAdjustmentRecord defines the positional adjustment between two mark glyphs. /// [Serializable] public struct MarkToMarkAdjustmentRecord { /// /// The index of the base glyph. /// public uint baseMarkGlyphID { get { return m_BaseMarkGlyphID; } set { m_BaseMarkGlyphID = value; } } /// /// The position of the anchor point of the base mark glyph. /// public GlyphAnchorPoint baseMarkGlyphAnchorPoint { get { return m_BaseMarkGlyphAnchorPoint; } set { m_BaseMarkGlyphAnchorPoint = value; } } /// /// The index of the mark glyph. /// public uint combiningMarkGlyphID { get { return m_CombiningMarkGlyphID; } set { m_CombiningMarkGlyphID = value; } } /// /// The positional adjustment of the combining mark glyph relative to the anchor point of the base mark glyph. /// public MarkPositionAdjustment combiningMarkPositionAdjustment { get { return m_CombiningMarkPositionAdjustment; } set { m_CombiningMarkPositionAdjustment = value; } } // ============================================= // Private backing fields for public properties. // ============================================= [SerializeField] private uint m_BaseMarkGlyphID; [SerializeField] private GlyphAnchorPoint m_BaseMarkGlyphAnchorPoint; [SerializeField] private uint m_CombiningMarkGlyphID; [SerializeField] private MarkPositionAdjustment m_CombiningMarkPositionAdjustment; } }