Hello Guest

Author Topic: Problem with font.  (Read 8547 times)

canochaba

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Problem with font.
« on: May 15, 2012, 01:21:45 am »
Hello, I have a problem when I create a new font for use in the textmesh. I'm using the program bmfont and I followed all the steps in the documentation, but when I write some text appears misplaced. Attached is a picture. Also get an error "Exception IndexOutRange"  :-\.

VeTaL

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Problem with font.
« Reply #1 on: May 15, 2012, 08:26:12 am »
Had the same here, try another program for font generation.

I have another font question: how to manage layer of the font, i didnt find it in the settings. On the test scene, I have 1 animated sprite and 1 text mesh. And sprite is rendered after, so i cant see whole text. Any workaround?

Got it: just change Z coordinate.
« Last Edit: May 15, 2012, 08:31:13 am by VeTaL »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Problem with font.
« Reply #2 on: May 15, 2012, 08:55:45 am »
BMFont should be fine to use. Which steps did you follow? Did you try to put it in the sprite collection?
If so, theres a bug in the current version that you need a sprite (any sprite) in the sprite collection otherwise you get errors when you press Commit.

When do you get the error?


canochaba

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Problem with font.
« Reply #3 on: May 15, 2012, 03:20:29 pm »
Thank you both for responding, i tried with Hiero and  Codeheads Bitmap Font Creator but i still get the error.
Perhaps the problem may be in the format, I tried .fnt and .dat for font and .tga for texture. What format do I have to use to create the font and texture?

The error comes at the beginning and this is exactly what it says:

"IndexOutOfRangeException: Array index is out of range.
tk2dTextMesh.CalcAnchor (Boolean useInlineStyling, System.Single & offsetX, System.Single & offsetY) (at Assets/tk2d/Fonts/tk2dTextMesh.cs: 298)
tk2dTextMesh.FillTextData () (at Assets/tk2d/Fonts/tk2dTextMesh.cs: 90)
tk2dTextMesh.Init () (at Assets/tk2d/Fonts/tk2dTextMesh.cs: 182)
tk2dTextMesh.Awake () (at Assets/tk2d/Fonts/tk2dTextMesh.cs: 60)"


I have also tried with a sprite collection but textmesh text appears pink, as if not caught the textures.
I attached the files I'm using.

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Problem with font.
« Reply #4 on: May 15, 2012, 03:36:35 pm »
This is really strange. I have had no problem with the font you provided at all.

1. What version of 2D Toolkit and Unity are you using?
2. What text are you entering?
3. Can you try deleting the -tk2d file in the root of the project. This is the index, and perhaps yours is somehow corrupted.

I'll attach a unitypackage with the built font in here, could you test it to see if it works for you? Theres a scene in there which should display "HELLO, WORLD.".

canochaba

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Problem with font.
« Reply #5 on: May 15, 2012, 04:15:49 pm »
I don't understand, the test that you send me work properly. I deleted the -tk2d file and reinstaled the 2d toolkit (Version 1.7 final) but no work correctly, even more, select in TextMesh the font "pop" that you've generated and does not work. However, the test is working properly. ???

canochaba

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Problem with font.
« Reply #6 on: May 15, 2012, 04:22:17 pm »
Ok, Fixed!

I had not seen the release Patch_2 and in the box "Check for update" of the 2D toolkit I was not any update. Case solved! Thank you! :)