TMP and custom font

I know TMP let’s you customize a font and all that, which is great, but we need to try and get a new build out a bit quicker than messing with trying to get things the way we want in TMP currently. We have a custom font that was designed in Photoshop and we used Unity’s custom font feature to create our own custom font from it. We were using a small script to curve the text, but the script is giving errors in 5.6, so we wanted to use TMP’s curve text feature. Is there a way to use our custom font that we already have set up with TMP?

Thanks!

It is possible but there is not automated way of doing it. Someone would have to create a script to do it which would not be difficult.

Here is sort of the manual steps to do it which should give you a good idea of how a script could be implemented.

  1. Using the Font Asset Creator, create a font asset using your font and make sure the atlas size and padding value kind of matches what we used in your custom font atlas. Also try to add / include the same characters. Don’t worry too much about each character as you can add / remove glyph from the glyph table manually.

  2. Import your new font atlas texture and with the Inspector panel set to debug mode on the font asset, replace the existing atlas by yours. Then select the embedded material and assign your texture to it.

  3. Then switch back to normal mode in the Inspector (ie. not debug mode) then you will need to manually edit each of the glyphs in the Glyph table to match the data with your .fnt data for your custom font. This process will be painful and this is where a script that would automatically convert the data from the .fnt to this required data format be handy :slight_smile:

This should work. I am in Iceland right now with limited access but I’ll be checking in whenever possible. Worst case, I will be back in the US over the weekend and can help you / create that script when I return. If you need my assistance with this, please provide me (via email) with your custom font and the .fnt file.

P.S. I used the wrong account on this post … oops/.

Thank you. Will take a look into this and see what we can do.

is it possible to use Foreign characters like Simplified Chinese or Japanese with TextMeshPro? When I try using the asset creator tool, TextMeshPro only recognizes the English characters.

It is absolutely possible.

You have to make sure the font you are trying to use does contain characters for those given languages.

Also make sure the you are familiar with the various options in the Font Asset Creator to select the characters for those given languages. Please see the following video which covers all these options

https://www.youtube.com/watch?v=qzJNIGCFFtY

2 Likes

Hi everyone

I created with TextMesh Pro a font atlas and saved this font but I need to add another character. When opening Font Asset Creator, I cannot choose this customized font I created, therefore I would have to create the Atlas again but I don't remember the settings I originally used.

Is there a way to edit the Font Settings I used in Asset Creator, or even better a way to add another character to this atlas existing font? Bear in mind Asset Creator does not let me choose the TMP font I generated in Asset Creator, else it'd be straight forward.

Thank you, Sergio

The potential key settings to retain would be Atlas size, Sampling Point Size and Padding value and of course what characters were contained in the previous font asset.

The Sampling Point Size, Padding and Atlas size are listed in the font asset inspector. In terms of the characters previously contained in the font asset, when selecting Character Set options in the font asset creator like custom characters, you can specify another font asset (or the one you are trying to update) and it will pull the characters contained in that asset. See the following video about this.

Lastly, you can save over the original font asset and this will retain its meta data / GUID and assignments. It will also update all material presets that were using this font asset’s atlas texture (provided you follow the naming convention on material presets which is to retain the name of the font in the material preset name like “Arial SDF - something”.

I'm having a heck of a time trying to figure out how to use my custom created font with Text Mesh Pro. It says it has support for bitmap fonts, but I see no way to drag and drop my own atlas and text file information. I have always used BMfont to put out my text file information and the texture map. It's worked like a charm in NGUI but I couldn't find a way to get it to work with Unity's built-in UI. Does the built in UI also not support bitmap fonts? Or better yet Text Mesh Pro supports custom bitmap fonts created externally?

Is your external font atlas texture edited in some external tool or are we just talking about a non edited font file?

It’s an atlas texture and .fnt file produced out of an external tool called BMfont.

I am familiar with BMFont. Just trying to figure out if you edited the font atlas texture produced by BMFont in Photoshop or if you simply generated a plain font atlas textures and .fnt.

1 Like

Ah yes edited in Photoshop, using it as a PSD. I’ve updated the file path in the text file BMfont spits out so it’s referencing the correct atlas.

Although you can use a custom font atlas with TextMesh Pro, the process to make this work isn’t very user friendly.

If you can provide me (via PM or email) with the font atlas texture and .fnt file, I’ll take a look to see if I can make that easier and if not (due to time constrains) at least provide you with some workflow to make it work.

Thank you very much for taking the time to help me, and to be willing to look into it. I actually just bit the bullet and tried a new workflow of using Text Mesh Pro’s built in workflow. Turns out it has so many features you can put on a text object I don’t really need to use Photoshop. I really only needed to add a beveled edge and a metallic texture over the font. When I first messaged on here for help I had no idea Text Mesh Pro had the ability to do all of the things I needed right inside of Unity. Again, thank you for responding so quickly and for offering support.

1 Like

You are most welcome :slight_smile:

Are there any optimizations that need to be made when using Text Mesh Pro or does it already atlas everything? I know nothing about the topic.

I am using Unity 2018.1.6 and, I believe, TextMesh Pro 1.2.2. When I open the Asset Creator and click on the generate button, nothing happens. No errors are thrown and no atlas is generated. The button just clicks.

Is there something I can do to figure out what is wrong? Is there a way to get it to work?
Thanks for any help.

What font are you using as source?

What character set / ranges have you defined?

Either the font file is invalid at which point you should be getting an error message in the console. Make sure you upgrade to version 1.2.4 from the package manager.

If not the font file, then you might have select / defined a character range that doesn’t contain any characters.

See the following video which provides in depth explanation of the features / options of the Font Asset Creator.

I am using Arial. I made a new project to just test using TextMesh Pro. I did not specifically add Arial to my project, so maybe I should pick a new one and add it specifically.

As for ranges... I have tried all sorts of values. Granted, my original intent was to render the hiragana and katakana at ranges 3040 - 30FF, but then I just tried to render ASCII values. My final attempt was to do nothing other than select the font. I figured the default values would be the most likely to work.

UPDATE:
I tried copying a font from my WIndows/Font folder into my Assets folder. It worked. (Still using 1.2.2) I guess whatever font is selectable by default does not work. Still wish I received an error message, but I am glad it works now.

1 Like

The Arial font includes in Unity is not a valid font. In version 1.2.4 of the TMP UPM package, you should get a message / error from the Font Asset Creator when trying to use this font.

This is the type of message that should be displayed in the Console:

“Font Asset Creator - Error Code [Invalid_File_Path] has occurred trying to load the [Arial] font file. This typically results from the use of an incompatible or corrupted font file.”

1 Like