Skip to main content
September 7, 2012
Answered

TextFormat size being rounded to int

  • September 7, 2012
  • 2 replies
  • 773 views

Hi,

can someone confirm whether it should be possible to set a TextFormat instances size property to a floating point Number? I'm trying to set it to a 12.5, but the Textfomat instance rounds the number, when it's set, back to 12.

The as3 docs specify that the TextFormat size property is an Object and state that the value represents 'The size in pixels of text in this text format'. Does this mean that it has to be a whole pixel? There's no explicit mention of the fact that it should be an int or that it can't be a floating point number?

I've run a seperate test in the flash professional cs3 IDE and am able to create a dynamic Textfield on the stage and set it's size to a floating point number. Seems odd that that would work, but you're not able to accomplish the same thing progrmmatically?

I've found an old post on the flex forum suggesting that embedding the font 'may' fix this issue, but my fonts are already embedded,  so it doesn't appear to be that.

Thanks,

James

This topic has been closed for replies.
Correct answer kglad

you're correct. dynamic font size is rounded to the nearest int.

2 replies

September 7, 2012

Thanks.

Can anyone confirm that this is the expected behaviour, as it doesn't mention it anywhere in the docs.

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
September 7, 2012

you're correct. dynamic font size is rounded to the nearest int.