Quantcast
Channel: Blogs RSS feed - Carl+ - Indie DB
Viewing all articles
Browse latest Browse all 10

Unity – NGUI Custom Font Maker (Post 8)

$
0
0
With NGUI you can create Labels that can use different types of fonts. Most of these don’t come with NGUI by default but you can add them yourself. For this I’ll be using Photoshop to select my Font Type. So for anything you want to add its a good idea to type out your text and have a look through what suits your UI best. Fonts can be found under C:/Windows/Fonts. Find the name of your text from your Program such as Photoshop and Copy & Paste it to the desktop for now. You can also download Custom Fonts Online from Places such as Dafont or1001 Free Fonts 1. We will need to Turn this Font Into an Image, tga or png (This will be added to the Atlas so it can be used as the Image for the Label). The Other thing needed is the Font File in .txt so Unity can read it (This is the Definition so Unity can label with part of the Image is displayed when you press a Key) 2. Once you have a Font of your choosing you will need a program to turn this Font Into a Image & .txt file. BitMap Font Generator is a Freeware Tool for this. Once you have Downloaded, Installed & Opened it you need to select your Font (If its a Basic Windows Font it will be there) If its a custom font you can add the File Under Options/ Font Settings/ Add Font File Most setting under Font Settings can be left a Default except Size. 32px should work fine for most though. 3. Once you have loaded/selected a Font click Ok then go to Options/ Export Settings. You can change the Texture Size anywhere from 32×32 to 1024×1024 I wouldn’t recommend higher 256 should be fine. select the Textures: tga – Targa. Click Ok. To select the Font you want select the 1st tick box on the right side of the screen “Latin + Latin Supplement” but have a look through the others to. 4. To save the Font & Image click Options/ Save Bitmap Font As. Put it on your desktop for now 5. Now you will have a .tga file and the Font File. you need to change the Extension from .fnt to .txt to do this Right Click the Font File/ Properties/ In the name change the .fnt to .txt 6. Copy both these files into Unity, Place them where you want. Open the Font Maker under NGUI Tab. Select or Drag & Drop your Font txt & select your 2D tga Texture, Name your Font, Select your Altas you want to add these to and click Create Font. Now you can create a Panel, Select your Font (Prefab) and type away. You can change your Font at any point Under UI Label Script/ Font (Your Label must be selected) Font NGUI Unity

Viewing all articles
Browse latest Browse all 10

Trending Articles