Hi,
I am looking to use the OS font for different devices and I’m struggling to understand how I can convert the Font data type into a TMPFont_Asset which I can assign to a TextMeshProUGUI field at runtime.
The font can only be retrieved at runtime and so I cannot pre-create the fonts using tmp’s font creator tools.
I have this so far:
private void Awake()
{
string[] systemFontNames = Font.GetOSInstalledFontNames();
// Find the Roboto Font
string fontName = "Roboto";
foreach (string font in systemFontNames)
{
if (font.Contains(fontName))
{
fontName = font;
break;
}
}
Font systemFont = Font.CreateDynamicFontFromOSFont(fontName, 36);
//MenuManager.instance.settingPanelTitle.font = systemFont;
}
Thanks!