Hello
Guest
Home
Help
Search
Login
Register
2D Toolkit Forum
»
2D Toolkit
»
Support
»
TextMesh size in pixels
« previous
next »
Print
Pages: [
1
]
Author
Topic: TextMesh size in pixels (Read 4721 times)
DemiGoth
2D Toolkit
Newbie
Posts: 45
TextMesh size in pixels
«
on:
May 23, 2015, 03:26:34 pm »
I'm looking for a way to calculate the size in pixels of a TextMesh. I know that fonts like Courier have a fixed width, but others like Times New Roman don't. It's for those fonts that I need to know the length in pixels of the text written...
Logged
DemiGoth
2D Toolkit
Newbie
Posts: 45
Re: TextMesh size in pixels
«
Reply #1 on:
May 24, 2015, 08:01:50 am »
Nvm, got it figured out -> GetEstimatedMeshBoundsForString(string str). And from the looks of it, it's quite accurate as well. Now it's time to get building the ticker I want to make ;-)
Logged
unikronsoftware
Administrator
Hero Member
Posts: 9709
Re: TextMesh size in pixels
«
Reply #2 on:
May 24, 2015, 12:09:23 pm »
Yup thats it. Its not 100% accurate as the name suggests but its very very close
Logged
DemiGoth
2D Toolkit
Newbie
Posts: 45
Re: TextMesh size in pixels
«
Reply #3 on:
May 27, 2015, 10:47:37 am »
Quote from: unikronsoftware on May 24, 2015, 12:09:23 pm
Yup thats it. Its not 100% accurate as the name suggests but its very very close
Close enough for me. Just add an extra 10px and it should be fine (I hope
)
Logged
Print
Pages: [
1
]
« previous
next »
2D Toolkit Forum
»
2D Toolkit
»
Support
»
TextMesh size in pixels