Hi, I’m looking for a solution to read a .ttf file as bytes[ ] and somehow turn it into a TMPro FontAsset. I’ve spent a few hours and decided to move on to creating a TMPro FontAsset with Font.CreateDynamicFontFromOSFont in combination with TMP_FontAsset.CreateFontAsset, however I can’t seem to get that working either.
Maybe I can get access to unity source code for importing a UnityEngine.Font to use with TMP_FontAsset.CreateFontAsset? I have Unity Pro.
Hoping anyone can shed some light on this, I’d really love to have this as a feature of my product, and the end users would love it.
// Get paths to OS Fonts
string[] fontPaths = Font.GetPathsToOSFonts();
// Create new font object from one of those paths
Font osFont = new Font(fontPaths[index]);
// Create new dynamic font asset
TMP_FontAsset fontAsset = TMP_FontAsset.CreateFontAsset(osFont);
thanks for the update, I’m curious if that will fix the following issue that I noticed:
Only certain fonts can be used with this method of OSFonts. I’m not sure why.
How can I allow fonts that I install to show up? I’m trying to use fonts that are listed as Free for Commercial use.
**** Nevermind, I think i figured that out.
Only fonts with Font file names can be used! it works great again!