Unity makes picture fonts

Source: Internet
Author: User

Reference http://blog.sina.com.cn/s/blog_6768751b0101niao.html
Http://forum.china.unity3d.com/thread-20425-1-1.html

Sometimes the art will give a series of WordArt, such as digital 0,1,2,3,4,5,6,7,8,9, these words to the developer in the form of pictures, this time how to use the image usage?

The first way to think of the method is to name the image by word, and then the word as a key to the dictionary, get the time by the word to get (such as the image of the number 1 is named 1, the dictionary key is 1, get through dictionary[1]).

This way is too old-fashioned ~ ~ ~, so there is a second, the art picture into a font (font size can not be adjusted, only by zooming adjustment)

I. According to the art picture production. fnt file
1. Download the Bmfont software and select options---Font setting after opening.

Font: Fonts, size: font sizes, match char height: match characters ' heights bold: Font bold, Ltalic: Italic
Font smoothing: Let the fonts smooth level: is the horizontal distance of the font

2. Font settings, import font pictures. Select Edit-open Image Manager. Import image imported image, Delect delete the selected picture, the picture when the import to ensure that the ID is not the same, the ID value is arbitrary.

3. Save the font as. fnt file Option-save bitmap font as ..., generate a. fnt and. png file.

Two. Build the font based on the previous step. Fnt and. png files.
1. Import the font Setter Packer plugin and import the. fnt and. png files that were generated in the previous step.
2. Set the. png file

3. Open the Window->font Editor window in the Unity menu bar

4. Select the font image file that you want to edit, select the picture of the setting

5. Enter the automatic setting mode, is actually semi-automatic, because still want to manually enter the corresponding letter or kanji

6. Enter the corresponding letter or kanji one at a time, press ENTER after each input to enter the next letter input mode, all the letters are entered and press stop to exit Auto mode

7. Click +1, add a space character, and place the space character corresponding position in the appropriate position, adjust the width and height (can not)

8. Set the vertical position of the anchor point of the corresponding area of the character, note that the same line of the anchor point must be guaranteed at the same level, you can drag directly with the mouse to adjust the anchor position, you can also directly by modifying the value of Y to precisely set the vertical position of the anchor point

9. Packaging

10. Use
At this point you can see the asset folder more out of several files font-1 (font), font-1 (font) (Packed), Font-1 (Material), Font-1 (Material) (Packed), Font-1 ( Packed), where the Packed is packaged after the generated file, and the red box files are packaged before the packaging is complete, we no longer need them, delete. Create a new Ui->text object within the scene, the font property of text is selected for the Font-1 (font) (Packed) file We just created, the Materia attribute is selected Font-1 (Material), In the Text property, enter a word in a random sentence. It is important to note that due to the particularity of the bitmap font, we cannot set the font display size by directly setting the size of font size, but we can do this by setting the scaling of the text object. In addition, if your picture font size is larger, then you may not see any text display, at this time you need to adjust the width and height of the text object to the appropriate size to make the text to be displayed. (If you open the found font picture or material is missing, manually pull it in, the second time will not appear lost).

Unity makes picture fonts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.