Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
New Contributor
brian515
Posts: 6
Registered: ‎02-10-2011
My Device: Not Specified
Accepted Solution

Max font size?

Hi everyone,

 

I've got a basic label with some text that I want to make really big. But, it seems like there is some undocumented maximum size that I can make the label's text. Anything above around 300 pt. font seems to max out and revert back down to about 300 pt, regardless of how huge I make the bounding rectangle of the lablel. 

 

Bug or feature? Is there a workaround?

 

Thanks!

Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Max font size?

hey brian,

 

there is a 127 pixel font limit on TextFormat's size. It has been there for a while. here is a link to more details:

 

http://www.moock.org/blog/archives/000284.html

 

if you do a test you'll see no matter what value you use past 127, it'll always be the same. hope that sheds some light. good luck!

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Contributor
brian515
Posts: 6
Registered: ‎02-10-2011
My Device: Not Specified

Re: Max font size?

Okay, well that solves the question as to why I couldn't make big text. But, the problem still remains. I tried scaling my Label using the .scaleX and .scaleY properties, but that just made it not show up at all.

 

Is there a way I can apply the Element Format to the qnx.ui.text.Label class? 

Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: Max font size?

hey,

 

the underlying object in a Label object is a TextField object. so using hte TextElement approach may not work. i did however get the scaleX and the scaleY to work. here is an example of the code i used:

 

 

package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import flash.utils.getDefinitionByName;
import flash.utils.getQualifiedClassName;

import qnx.ui.text.Label;

[SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
public class LabelTest extends Sprite
{
public function LabelTest()
{
super();

// support autoOrients
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;

var format:TextFormat = new TextFormat();
format.font = "BBAlpha Sans";
format.size = 127;

var format2:TextFormat = new TextFormat();
format2.font = "BBAlpha Sans";
format2.size = 127;

var textmsg :Label = new Label();
textmsg.format = format;
textmsg.text = "My huge text";
textmsg.textField.scaleX = 2;
textmsg.textField.scaleY = 2;
textmsg.setSize( textmsg.textWidth + 5, textmsg.textHeight + 5 );

var controlLabel:Label = new Label();
controlLabel.format = format2;
controlLabel.text = "My huge text";
controlLabel.setSize( controlLabel.textWidth + 5, controlLabel.textHeight + 5 );
controlLabel.setPosition(0,textmsg.y + textmsg.height + 5);

addChild(textmsg);
addChild(controlLabel);
}
}
}

 

i used two Labels. one where i resized and the other where did not. make sure to scale the inner textField object. hope that clears a few things up. good luck!

 

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman
New Contributor
brian515
Posts: 6
Registered: ‎02-10-2011
My Device: Not Specified

Re: Max font size?

[ Edited ]

Oh awesome! Thanks for your quick replies! I wasn't scaling the textField property of my label; just the label itself. Now it works like a charm!