Unity Font Research Summary

Source: Internet
Author: User



The interface that the project was made with Ngui. Fonts use the Unity default Arial, published on some Android phones found in Chinese does not display, this has made some research.









The Font documentation for unity: http://docs.unity3d.com/Manual/class-Font.html,http://game.ceeger.com/Components/class-Font.html (Chinese translation)



1. Use dynamic fonts:



The advantage, the dynamic word basically contains all words (Chinese, etc.), the size is adjustable, the display is clear, can use in the dynamic text.






Unity's easy support TTF. In the OTF format, the font files are placed in the assets folder, and untiy will generate materials and stickers for them on their own initiative, regardless of location.









Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3axmdax/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">



Imported fonts can be set up, and each one is explained in the documentation. Set Character to dynamic.






The Include font data check indicates that the font is packaged in the installation package. Then install to the user machine. Assume that the user machine comes with the font. It is not possible to pack in, but you need to specify the font order that the system will use in the font names. (The Font names property automatically displays the name of the font after importing it, noting that it is not the file name of the font.) The font name is the system name for the font)



For Chinese fonts, the problem with selecting include font data is that the font size is too large, for example the Blackbody has 9 m. Ya-hei 10 m. Will cause the installation file to grow (9M black pack into unity will increase the installation file 5M). Suppose the project to use more than one dynamic font is more depressed, unity convenient support TTF and other fonts for Western characters is a convenient thing, on the Chinese side also have to deal with problems such as slimming.



Assuming that the font is not packaged, you need to ensure that the font already exists on the system. At this point, the font names property takes effect and, at execution time, looks for the font in the list itself from the system. Until it is found.






Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3axmdax/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">



Assume that the unity default dynamic font arial is used. The explanation for this is that the default font for the current platform will be used by default after publishing to a different platform.



In the test when the Millet 1 on the machine, the low version number MIUI system can not display Chinese characters, there is a high version of MIUI millet phone can display Arial,simei and other fonts (do not need to pack into the installation file), on a Meizu mobile phone test can not display Arial. So Unity's Arial font is not insured against the platform's mapping relationship.



The andriod system has its own default font, the Droid Sans (with only Western characters). And the default Chinese font Droid Sans Fallback. Unity maps the Arial font to the Droid Sans (Fallback) on the Andriod platform.









In the low version MIUI system (1), you can see that there is only one Chinese font file DroidSansFallback . TTF with a size of more than 2M. Take out this font file and put it in unity you can see the font name is LTHYSZK. It may be that the font name is changed by the MIUI system to the expiration of the Arial map of unity to Andriod.



There are several Chinese font files in the MIUI system with the high version number. Among them The size of the Droidsansfallback.ttf becomes 4.4M, and the font name found in unity is already droid Sans fallback, it is obvious that unity's Arial map to Andriod is actually related to the font name. (did not test the high version of the TTF to get the lower version of the MIUI system, it seems to have to brush the machine ability to measure? This conclusion is just a test.)



There are several Chinese fonts in the high version miui, which are really system-specific fonts:



< Span style= "Color:rgb (68,68,68); Font-family:tahoma, ' Microsoft Yahei ', SimSun; font-size:16px; line-height:24px ">



In the following articles, the andriod default font is compared with Microsoft Black, which results in a very similar conclusion between the two fonts. wanted to be skinny. Do not know Droidsansfallback.ttf include all Chinese characters, I use 2M droidsansfallback.ttf tested some remote words and found no missing ones. (Suppose you want to use Jache.) can use this instead)






Another problem with Arial is that it is the default font for unity. Unity does not actually pack Arial into the installation file, cannot find the font source file, and cannot change the font names property. No Chinese is displayed in the system where the default font is not found.



So a better approach is to short the shell.



Import a font without packaging it to the installation file, set the font names property (including the list of font names for each platform), and raise different fonts on different platforms. Just make sure that the font names attribute specified at the time of publication has the fonts for the target platform.



To be clear, the imported font effect is currently displayed at development time, but is performed differently depending on the settings of the system and platform and font names.



Packaging into embedded fonts will be consistent, and the only problem is that the installation files will grow very large.






Another issue identified during the announcement:



Low version Ngui (3.0) Select the dynamic font, the font list can be selected Lucida Grande fonts, when published to the Andriod and WINPC system error can not be published:





Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3axmdax/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">






reason is Lucida Grande is the default font under MacOS that cannot be advertised to other platforms (it should not be advertised in MacOS or Arial font). No such font can be advertised under the current operating system windows (this seems to be the case without Lucida Grande from MacOS. Refer to the following article). This is the low version number Ngui design is not good. Ngui actually does not have a dynamic font, its dynamic font is actually called Unity's dynamic font settings, its own only bitmap fonts. After upgrading Ngui to 3.5.6, the outgoing font option has only Ngui and unity, and then selects the details with what font. Ngui finally got the self-knowledge. no longer misleading.



and choosing unity will block out the font options for non-current systems, which is a great improvement.






MacOS with Lucida Grande font (close to ya black), ios default is blackbody-Jane Heiti SC (earlier version number is Chinese blackbody).







References:



Compile, Encounter couldn ' t build player because of unsupported data on target platform resolution



http://blog.csdn.net/monzart7an/article/details/24156661



Simple Introduction to Android fonts



Http://www.apkbus.com/android-58182-1-1.html



On Android, Droidsans is the default font. Just include western characters, and the application will call it by default. The droidsansfallback includes East Asian characters when the characters that need to be displayed do not exist in the Droidsans font (for example, Kanji). That is, when there is no corresponding encoded character, the system will go to the droidsansfallback to find the corresponding encoded character, if found, then use the Droidsansfallback font to display it, assuming that the encoding corresponding character is still not found, you cannot display the character on the screen.






About Android default fonts and Microsoft Jas font



Http://www.cnbeta.com/articles/114854.htm






2.bmfont



Bitmap font bitmap fonts are the second option, making the character set Atlas a flexible way to use a variety of fonts. The disadvantage is that bitmaps cannot be scaled with jagged characters, and Chinese characters are generally simply introduced into words that are often used or used in items, or the entire character set is too large. Will consume too much memory. Or you cannot integrate all characters by the Unity Atlas limit size.






Open Ngui's bitmap font maker



NGUI 3.5.6 or above version number can be easily made bitmapfont. It is necessary to import FreeType.dll, assuming that the file cannot be found without the bitmap font being created.



Import the installation package from NGUI to the project, its default location is Assets/ngui/editor/freetype.dll. I've moved this file away. I need to find it again, and here's the find Freetype.dllbutton.









Font Maker is able to create Bimapfont from the imported TTF: I choose the imported simhei from source, and the character set includes 2 characters in the southeast. Output atlas causes the specified character set picture to be placed in an existing atlas, and a separate one is generated without specifying it. Not conducive to drawcall, preferably very many Bitmapfont Atlas common one.








Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3axmdax/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">






The font I created is called Heiti.prefab. Because it is very convenient to use prefab, where all can be used.








Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy3axmdax/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70 /gravity/southeast ">



Select Ngui when you are using it. Then select the Heiti font, only the words in the set will be displayed.















Unity Font Research Summary


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.