[UPDATED] Font Setter/Packer 2.0

Font Setter/Packer 2.0

I’m on the Asset Store, woo!

I was prototyping a little turn based RPG, and I wanted to add some little numbers that popped up when you biffed an enemy or cast a heal spell. 3DText seemed like a good option, but I wanted fancy looking text, something like this:

1172104--256605--text.gif
There’s very little support for fully custom bitmap fonts, mostly people just refer to the “SaveFontTexture” script, and then you have to edit what it outputs, but this is really limited, you have to stay inside the boundary of each letter, so you cant do things like fat borders, or hand-painting from scratch.

So Unity has this “Custom Font” asset, in which you need to define the UVs of the assigned Material, but using a calculator and typing everything in by hand seemed like a huge hassle, so I made this Editor Extension, to let me visually draw rectangles over the bitmap to define characters.
Then I added some functions for things like shrinkwrapping the rectangles to minimise wasted space, shape detection to automate it, and bitmap re-packing to reduce the font map size. When you’re done defining all the characters, all you have to do is drop the font object into a 3Dtext and it just works.
Plus, once youv’e done defining the characters, you can pack your orignal map into a more efficient atlas.

Priced at 10 bucks (+ vat)

I also made a bunch of youtube videos (old version), and a 13-page PDF manual.

I would be happy to purchase this. Unfortunately, I, like many other Unity users am not able to use Unity 4.2 at the moment because it crashes every time I open it. According to the Asset Store, your tool is only available for 4.2. Is it possible to get one that will work with Unity 4.1.5?

So I decided to go grab this to fix my custom font woes and is a reasonable price. Am trying it now, although I’m curious what I should do if the ‘smart line’ cannot intersect every character? (e.g. an apostrophe all the way at the top and a comma all the way at the bottom)

// Edit: just noticed this is addressed in the video.

It’s a good plugin. With a few caveats:

  • The smart lines on the characters literally need to be pixel perfect. If they have even a slight amount of transparency nothing will work.
  • If you’re trying to import a custom preexisting font (e.g., Helvetica, Eurostile), this method loses all the character spacings. Notice in the below pic how the W is too far, and the l doesn’t have quite enough space.

1351799--66587--$d76u.png

The only real method to fix this is to adjust each width of the characters manually and eyeball it in the preview text. There is a Leading and Trailing spacing option in the plugin to address this.

Takes a bit of effort but I got it there in the end. Ideally what I’d like is to just be able to export a font to bitmap like the old SaveFontTexture did, without Unity 4’s new flipped and rotated packing algorithm. Until someone creates such a system, the holy grail of custom fonts in Unity will remain buried. But this is a good alternative in the mean time. :slight_smile:

Maybe when Unity 4.3 get released you may take advantage of the sprite packer to address what the above poster said.

I’m using your font maker and it’s great, but I’m having issues with its compatibility in NGUI.

I’ve sort of got it working but the .fontsettings files are only being accepted as an NGUI “dynamic” font even though it’s a bitmap font. And because of that I’ve got a ton a spam in my console complaining that “font size and style overrides are only supported for dynamic fonts.”

Any idea how to resolve these compatibility issues?

I’ve tried a a few things on the ngui side. Like converting a .fontsettings font into an ngui package but no luck there either.

Bitmap fonts can’t be sized, so if you are trying to adjust the size of the displayed text using xxx.fontsize it won’t work.
Eg. if you are using a TextMesh, you can’t change it’s fontSize, ditto for guiStyle.fontSize. You gotta leave/set fontSize to zero, and control display size some other way (for a textMesh you can use charactersize)

I’ve not used NGUI so I don’t know how it handles Unitys .fontsettings object, I was sort of under the impression that it used non-dynamic, atlassed bitmaps (which is what a .fontsettings is really), but it might be as simple as setting font size to zero

Thanks to user ryanflees for prompting me to check compatibility with the new 4.6 UI
Theres a couple extra fields in the canvas Text component that you have to change for proper display

Ive just pushed an update that completely replaced the interface, to (finally) bring it in-line with Unitys 2d editor appearance (handles) and re-jigged some of the controls, took out my clowny buttons. Operation is essentially the same, with few small changes (which are hopefully self-explanatory). I’ve also rewritten the docs, and remade the youtube tutorial video (in OP).
I’ve not done all the videos, they only covered what’s already in the docs - hopefully the PDF + one video will suffice.

I dropped the sprite editor functions, since Unity 4.6 built in a sprite editor it pretty much made mine obsolete, so I took it out and dropped the price $5 to 10 bucks (+VAT).

It’ll hopefully also run a little more efficiently

Hi,

I am using Font Setter in a uGUI environment. It works great, except that I want to use ‘BestFit’ in my text component to account for different screen sizes. However I get this warning, and the fonts don’t change with the size.
‘BestFit is only supported for dynamic fonts’

Is there a workaround?
Regards

Best Fit operates by re-rendering the font map for dynamic fonts when a new size is required. With a bitmap font, you can’t re-render, so it doesn’t work.

If you are designing around different screen resolutions, you should probably change the canvas scaler to scale by screen size
http://docs.unity3d.com/Manual/script-CanvasScaler.html

Hi,

I have been trying to use your tool on Unity 5.4.0p4. Using the pack font map tool I get a new font file, but it s refuses to render in a canvas GUIText (or in my scripts).

Everything looks fine, but it seems that GetCharacterInfo() fails to find any character.

Does anything come to mind?

Cheers

GetCharacterInfo(char, out CharacterInfo) gets info about the glyph
I’ve just updated to 5.4.1f1 and it works fine on fonts generated after packing.

public Font someFont;

CharacterInfo ci;
someFont.GetCharacterInfo( 'a', out ci );
Debug.Log( ci );
Debug.Log( ci.index );
Debug.Log( ci.uvBottomLeft ); //etc...

Please clarify - Canvas text and GUIText are completely different systems
See earlier posts for making canvas text, theres nothing special to do for GUIText (but stop using GUIText)

is this tool IMGUI compatible?

Yes and no

    public GUISkin mySkin //skin that has custom font selected;
    void OnGUI () {
        GUI.skin = mySkin;
        GUILayout.Label( "Hello World!" );
    }

Since guiSkins dont let you select a material & shader for use in GUI display, it will only draw the text with appropraite alpha, not rgb values (you can still change tint colors with the skin)

Theres possibly a workaround using shader replacement (but i’ve never looked into it)
The other solution is - instead of using GUI.label, make sequentional calls to DrawTextureWithTexCoords, and theres some example code for this included in the package (in the “FontSetterOld” package - ‘TexturedGUILabel.cs’)

Note from the unity docs: "The IMGUI system is not generally intended to be used for normal in-game user interfaces that players might use and interact with. For that you should use Unity’s main GameObject-based UI system"

this is intended also for GUI.Label and GUI.Button ?

Button (and everything in GUI) has the same issue

Heres the deafult skin button with modified font

Hi, I’m use font setter / packer with Unity 5.5.0f3.

It’s really easy to use, thank you!

But I’m faced with a problem - on iPhone 5 I get strange display issues - seems like something went wrong with font mapping:

On all other devices (iPhone 6/7, Android 5+) all works just fine. How I could solve that problem?

PS. It must look like this:

My font settings:

If it’s working fine on other devices without you changing any settings, it’s unlikely to be an issue with the font mapping.

Might be something to do with the bitmap being compressed for different targets (is the texture NPOT?)
Maybe show us the images import settings panel

I’m using standard import settings for iOS:

Does I need to change import settings?