using System;
using UnityEngine;
using UnityEngine.TextCore;
namespace TMPro
{
///
/// The visual representation of the sprite character using this glyph.
///
[Serializable]
public class TMP_SpriteGlyph : Glyph
{
///
/// An optional reference to the underlying sprite used to create this glyph.
///
public Sprite sprite;
// ********************
// CONSTRUCTORS
// ********************
public TMP_SpriteGlyph() { }
///
/// Constructor for new sprite glyph.
///
/// Index of the sprite glyph.
/// Metrics which define the position of the glyph in the context of text layout.
/// GlyphRect which defines the coordinates of the glyph in the atlas texture.
/// Scale of the glyph.
/// Index of the atlas texture that contains the glyph.
public TMP_SpriteGlyph(uint index, GlyphMetrics metrics, GlyphRect glyphRect, float scale, int atlasIndex)
{
this.index = index;
this.metrics = metrics;
this.glyphRect = glyphRect;
this.scale = scale;
this.atlasIndex = atlasIndex;
}
///
/// Constructor for new sprite glyph.
///
/// >Index of the sprite glyph.
/// Metrics which define the position of the glyph in the context of text layout.
/// GlyphRect which defines the coordinates of the glyph in the atlas texture.
/// Scale of the glyph.
/// Index of the atlas texture that contains the glyph.
/// A reference to the Unity Sprite representing this sprite glyph.
public TMP_SpriteGlyph(uint index, GlyphMetrics metrics, GlyphRect glyphRect, float scale, int atlasIndex, Sprite sprite)
{
this.index = index;
this.metrics = metrics;
this.glyphRect = glyphRect;
this.scale = scale;
this.atlasIndex = atlasIndex;
this.sprite = sprite;
}
}
}