Search Unity

TextMesh Pro External fonts

Discussion in 'UGUI & TextMesh Pro' started by TheZombieKiller, Nov 30, 2019.

  1. TheZombieKiller

    TheZombieKiller

    Joined:
    Feb 8, 2013
    Posts:
    265
    At present, I don't believe there is a way to load a Font object from an external source (such as a Stream). The TextCore.FontEngine class offers a way to load external fonts from a byte[] array, but offers no way to get a Font object out of it.

    The functionality must exist in the engine, as asset bundles appear to store raw .ttf/.otf files. I assume it's possible to construct an asset bundle in memory by reverse engineering the format and load the font from that, but this approach is extremely fragile and quite ugly (not to mention forwards-incompatible!)

    Currently I have a custom modified version of TextMeshPro that allows me to get a TMP_FontAsset from an external file, but this of course won't be compatible with UIElements once runtime support is rolled out.

    Would it be possible for this to be addressed during the 2020.x release cycle?
     
    Helllllllo likes this.
  2. yareth

    yareth

    Joined:
    Sep 20, 2019
    Posts:
    2
    Seconded. Having to rely on Asset Bundles or having to stitch together lower half of text rendering stack hampers modding and will probably break in the future, even more so when most of the needed stuff already exists in the engine, just inaccessible.