Maybe it’s not the right forum to ask this question but for my game I want to make a font with several colors like this: 1512034–85808–$aakqir6r.bmp (594 KB)
Each character consists of more than one color.
Does anybody know how to make such a font?
All the (free) font editors I know only can make black characters.
A font does not contain any specific color information, it’s just a collection of shapes that can be applied a variation of properties, one of those being colour.
If you use Unity 4 then you can use the richtext property to stylize your text by using HTML style formatting tags.
Here is a small example of how to use this:
using UnityEngine;
using System.Collections;
public class GUITest : MonoBehaviour
{
// Our GUIStyle to use
private GUIStyle textStyle;
void Start ()
{
// Setup the new GUIStyle and enable richText
textStyle = new GUIStyle();
textStyle.richText = true;
// Extra Shizzle
textStyle.fontSize = 130;
textStyle.alignment = TextAnchor.MiddleCenter;
}
void OnGUI ()
{
// Sample label with different colors
GUI.Label(new Rect(0,0,Screen.width,Screen.height),
"<color=red>G</color>" +
"<color=green>M</color>" +
"<color=blue>M</color>" +
" " +
"<color=yellow>R</color>" +
"<color=teal>O</color>" +
"<color=cyan>C</color>" +
"<color=brown>K</color>" +
"<color=#DF01D7>S</color>", textStyle);
}
}
And the output would look like:
Thanks!
The richtext property would be a nice solution.
I understand now that a font does not contain any specific color information.
I think the characters in the image that I attached above are vector images and not real fonts. But can you never make a font like that with more colors for each character (character “a” is light blue with a dark blue border and a gradient)?
Try looking into a bitmap font instead, like this example:
http://lukasz.dk/2011/05/01/pixel-perfect-bitmap-font-in-unity/
That is an old example, but the core concept should still apply today.
I will take a look at that.
Thanks for help!
There’s also the “Custom Font”, which is poorly documented and a bit of a black art. I tried to put some words together here:
(Nice font btw)