Hello Guest

Author Topic: Font Size Issue in tk2dTextMesh  (Read 4987 times)

daklab

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Daklab - Experiments, Projects, Designs, Tips, and Tutorials Related to Creative Coding
Font Size Issue in tk2dTextMesh
« on: October 25, 2013, 01:31:27 pm »
I'm using BMFont and followed both the Preparing a font and Creating and using a text mesh tutorials but I feel I may have missed something. Basically, I'm able to get my font to show up, this issue is the size. When first setup my tk2dTextMesh instance's scale is 1 but the font showing up in the Scene View and Game View is massive compared to what it should be for proper display. I can set the scale of my tk2dTextMesh instance to .05 (for x,y,z) and then it displays as expected.

My question is, is it bad practice to scale the tk2dTextMesh instance? Did I miss a setting on BMFont export? How do I properly control the font size from BMFont export so it maps well to the size(s) I want the font to be within Unity? Thanks in advance for any thoughts pointing me in the right direction.
Braindrop Labs - Games. Apps. Coded Art. www.braindroplabs.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Font Size Issue in tk2dTextMesh
« Reply #1 on: October 25, 2013, 03:06:09 pm »
You need to create a tk2dCamera first, and then create your sprites / font. (2D Toolkit 2.1 and above). The default behaviour is to create it pixel perfect, and the fonts will be pixel perfect on the target camera settings. If it can't detect the camera / resolution it will simply create at 20 pixels per meter.

daklab

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Daklab - Experiments, Projects, Designs, Tips, and Tutorials Related to Creative Coding
Re: Font Size Issue in tk2dTextMesh
« Reply #2 on: October 26, 2013, 02:20:24 pm »
I do in fact have a tk2dCamera in the scene, but I also have a normal camera. Is the tk2dtoolkit code just checking for the first camera in the scene graph? If so I'd imagine that is an easy update if others ever run into a similar issue.

Quote
If it can't detect the camera / resolution it will simply create at 20 pixels per meter.

Where exactly can I change this '20px per meter' setting?

Love the tk2dToolkit support btw
Braindrop Labs - Games. Apps. Coded Art. www.braindroplabs.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Font Size Issue in tk2dTextMesh
« Reply #3 on: October 26, 2013, 05:29:12 pm »
In the font settings - click on the font and you should see "Size" on there. Or if you put it in sprite collection, it'll be in the sprite collection settings. It'll be either "Explicit" or "Pixels per Meter"...