2D Toolkit Forum

2D Toolkit => Support => Topic started by: daklab on October 25, 2013, 01:31:27 pm

Title: Font Size Issue in tk2dTextMesh
Post by: daklab 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.
Title: Re: Font Size Issue in tk2dTextMesh
Post by: unikronsoftware 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.
Title: Re: Font Size Issue in tk2dTextMesh
Post by: daklab 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
Title: Re: Font Size Issue in tk2dTextMesh
Post by: unikronsoftware 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"...