public override bool GetGlyph(char ch, GlyphInfo glyph)
{
BMGlyph bg;
if (ch == ' ')
{
glyph.width = Mathf.CeilToInt(size * scale / 2);
glyph.height = Mathf.CeilToInt(size * scale);
glyph.vert.xMin = 0;
glyph.vert.xMax = 0;
glyph.vert.yMin = 0;
glyph.vert.yMax = 0;
glyph.uvTopLeft = Vector2.zero;
glyph.uvBottomLeft = Vector2.zero;
glyph.uvTopRight = Vector2.zero;
glyph.uvBottomRight = Vector2.zero;
glyph.channel = 0;
return true;
}
else if (_dict.TryGetValue((int)ch, out bg))
{
glyph.width = Mathf.CeilToInt(bg.advance * scale);
glyph.height = Mathf.CeilToInt(bg.lineHeight * scale);
glyph.vert.xMin = bg.offsetX * scale;
glyph.vert.xMax = (bg.offsetX + bg.width) * scale;
glyph.vert.yMin = (-bg.height - bg.offsetY) * scale;
glyph.vert.yMax = -bg.offsetY * scale;
glyph.uvBottomLeft = new Vector2(bg.uvRect.xMin, bg.uvRect.yMin);
glyph.uvTopLeft = new Vector2(bg.uvRect.xMin, bg.uvRect.yMax);
glyph.uvTopRight = new Vector2(bg.uvRect.xMax, bg.uvRect.yMax);
glyph.uvBottomRight = new Vector2(bg.uvRect.xMax, bg.uvRect.yMin);
glyph.channel = bg.channel;
return true;
}
else
return false;
}