• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Stephen McGreal · Nov 19, 2013 at 06:36 PM · errorformatimporterunsupported

TrueTypeFontImporter.GenerateEditableFont logs strange errors

I'm working with some code to auto-generate font atlases from localisation string databases. It's code that worked fine under older versions of Unity, but at some point in the last year or so when the code was gathering dust, a Unity update changed the rules about how you manage fonts, and now you have to make sure they're "readable" before you can edit them. So, that's what I'm trying to do: Load a TTF font, then get it into an editable form so that I can generate PNGs and the like.

Unfortunately, some of the fonts I'm working with give this error:

Font Error: Cloning a dynamic font is not supported and may result in incorrect font rendering.

... And all of them give this one:

The font Assets/Foo/Bar.ttf could not be imported because the format is unsupported

The simple test code that producted these errors:

     [MenuItem ("Localization/Font Test")]
     static void FontTest()
     {
         String sSourceFontPath = "Assets/Foo/Bar.ttf";
         String sTargetFontPath = "Assets/Foo/Bar_Baz.ttf";
             
         UnityEngine.Object f = AssetDatabase.LoadMainAssetAtPath(sSourceFontPath);
         string path = AssetDatabase.GetAssetPath(f);
         Debug.Log("Generating copy of: " + path);
         TrueTypeFontImporter fontImporter = AssetImporter.GetAtPath(path) as TrueTypeFontImporter;
         Font font = fontImporter.GenerateEditableFont(sTargetFontPath);
     }
     

What am I doing wrong?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Graham-Dunnett ♦♦ · Nov 19, 2013 at 08:31 PM 0
Share

I'm guessing Assets/Foo/Bar.ttf has been imported as a dynamic font, and, as the error says, you cannot clone dynamic fonts.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error building player (unsupported data) 0 Answers

expecting :, found ;. 1 Answer

Another 'unable to convert classes to dex format' question 0 Answers

MonoDevelop AutoComplete not working 2 Answers

Export objects to a .3DS file at runtime 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges