- Home /
Custom font completely broken in Unity 4.
When I imported my project into Unity 4, it completely bricked my custom font. I made the font by importing a texture (after hand-painting the characters) and used that texture as a basis for a custom font within Unity. I spent a long time arranging the letters so they were spaced nicely in the font inspector.
Looked and worked great in 3.5. Used it on my text meshes.
Now it's just a garbled mess and ruined. Everything is just shards of letters/numbers at best, and at worst, blank. All the settings are different now for custom fonts, and none of them do or change anything. I've randomly fiddled with Index, UV, Vert, Flip, all the X/Y H/W values... nothing.
Can nothing be done? Has support for custom fonts been officially removed?
Answer by JasonB · Nov 30, 2012 at 08:52 AM
I seem to have figured out how the new custom font system works, but it's extremely convoluted, so you've been warned. I figured it out thanks to memememememe's explanation.
I have a font I custom painted, and the image dimensions on it are 2048x1024; 16 characters across, 8 down.
To get the values you need to place into the UV area, you need to figure out how your characters are positioned on a scale of 0 to 1. You divide 1 by the number of characters on a dimension. 1 divided by 16 got me 0.0625. Therefore, this is the number of my UV Width for all characters. 1 divided by 8 is 0.125. This is the UV Height for all characters.
For UV X and Y, it's just a matter of deciding which character you want and multiplying the width or height value times the column/row of the letter.
Note: For Vert, it seems that Vert Y must be negative, or else you'll get an upside-down character. It also seems that the Vert size is based on the pixel size of the characters. Since my characters are each 128x128, putting 128 and -128 into the Vert Width and Height give me properly proportioned letters.
In other words, if you want to sit there and work out your entire font, it's going to take about an hour, a calculator, and a lot of patience to get the positioning right. It's a vastly inferior system to the old way of doing it, but since this is now the only way, this is how it's done.
Hope it helps.
Answer by masterchafe · Nov 29, 2012 at 07:45 AM
I just had this happen to me too, looks like Unity4 decided to rearrange the font when it converted the project and now the painted custom textures no longer match the font file. I'm assuming I'm going to have to export the newly arranged font and paint over it in photoshop again. Groan. :(
EDIT: so I went to the wiki for the SaveFontTexture script and according to Eric the script is no longer needed as unity now has a way of creating an editable copy of your fonts from the gear menu in the inspector, see: http://wiki.unity3d.com/index.php?title=SaveFontTexture
I'm going right ahead and converting my fonts this way now.
Unfortunately for me, I didn't base my font off an existing font. I painted it from scratch, so I have nothing to go off of.
Answer by memememememe · Nov 29, 2012 at 04:59 AM
Im waiting for an answer on this as well. Technically it is still a custom font but dealing with them is alot more difficult. Index refers to the decimal mapping in an ascii table to that character. (here's a good list for that http://ss64.com/ascii.html). UV XY/HW refers to the UV mapping on the font mesh in relation to the position in the texture (XY = Position, HW = height and width). Vert XY/HW refers to the position and scaled of the actual font mesh. (this is how you would get superscript and subscript characters)
Oi. What a nightmare. I don't know why they did this, the old system worked perfect. What's worse is they didn't update the manual to reflect these changes.
I have an exclamation point that starts at 128 x 0 (and all characters are 128x128 pixels). So when I put 128 x 0 into the UV and 128 x 128 into the size, you'd think I should see an exclamation point appear, but it's just blank. Even when I slowly slide every value around, nothing ever appears. It's driving me up the wall. I don't even know that it's creating a mesh for my typed character, even if I set the dimensions of the mesh to be enormous.
Answer by hpjohn · Feb 22, 2013 at 12:44 PM
Check out this on the Asset Store: http://u3d.as/content/hpjohn/font-setter-packer-/4bZ
Lets you visually define the UV Rectangles for font bitmaps
Your answer
Follow this Question
Related Questions
Custom Font 1 Answer
Change the size of a custom font in a Canvas text 1 Answer
How to custom filter target objects? 0 Answers
On Android Dynamic Font doesn't support use system font? 0 Answers
Clock, numbers past 2 digits???? 2 Answers