float GetYAnchorForHeight(float textHeight)
{
int heightAnchor = (int)_anchor / 3;
float lineHeight = (_fontInst.lineHeight + lineSpacing) * _scale.y;
switch (heightAnchor)
{
case 0: return -lineHeight;
case 1:
{
float y = -textHeight / 2.0f - lineHeight;
if (_fontInst.version >= 2)
{
float ty = _fontInst.texelSize.y * _scale.y;
return Mathf.Floor(y / ty) * ty;
}
else return y;
}
case 2: return -textHeight - lineHeight;
}
return -lineHeight;
}