using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Cyber.Util {
///
/// Conjures useful information about fonts.
///
public class FontUtil : MonoBehaviour {
///
/// Gets the width of the character.
///
/// The character width.
/// Font.
/// Font size.
/// Font style.
public static float GetCharacterWidth(Font font, int fontSize, FontStyle fontStyle) {
CharacterInfo CharInfo;
font.RequestCharactersInTexture("W", fontSize, fontStyle);
font.GetCharacterInfo('W', out CharInfo, fontSize, fontStyle);
return CharInfo.glyphWidth - 1;
}
}
}