ZoeAppClass/Assets/Scripts/FontManager.cs

30 lines
664 B
C#

using UnityEngine;
namespace Assets.Scripts
{
class FontManager
{
public Font GetFontFromOS(string NomeFonte, int Tamanho)
{
string [] ListaFontes = Font.GetOSInstalledFontNames();
Font NovaFonte = null;
bool Encontrada = false;
foreach (var Nome in ListaFontes)
{
if (Nome == NomeFonte)
{
Encontrada = true;
break;
}
}
NovaFonte = Font.CreateDynamicFontFromOSFont((Encontrada) ? NomeFonte : "Arial", Tamanho);
return NovaFonte;
}
}
}