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
Developer
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000
My Carrier: Vodafone
Accepted Solution

How to get a Webdings character in a Label?

How do I get a Webdings character displayed in a text of a Label? I have tried to use TextFormat to set the font to "Webdings" and used the Unicode switch \u... (with the right number) in the Label.text, but all that is displayed is a square.

Eugene

My PlayBook App: Checklists
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to get a Webdings character in a Label?

Some fonts have to be loaded/embedded to be used. Google search will show examples in how to load and embed other fonts in AS3.
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to get a Webdings character in a Label?

John, that doesn't apply to those which are actually installed on the PlayBook though, does it? Webdings and Wingdings are both there: http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Fonts-removed-in-1-0-1-mainly-BBA...

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to get a Webdings character in a Label?

Ah, then no. Did not know that font was on the device.
Developer
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000
My Carrier: Vodafone

Re: How to get a Webdings character in a Label?

Then I still don't know how to do it....

Eugene

My PlayBook App: Checklists
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: How to get a Webdings character in a Label?

Can you post a code snippet in what you are doing?
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: How to get a Webdings character in a Label?

Or at least tell us which \u code you're attempting to use.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000
My Carrier: Vodafone

Re: How to get a Webdings character in a Label?

This is (part of) the code I am using in my class. I want to have a black right pointing arrow between the '1' and the '3'. When I use font="Webdings" the label text is all rubbish, if I don't use font= then the arrow shows up as an open little square.

 

package containers
{
	import constants.MyConstants;

	import flash.text.TextFormat;
	
	import qnx.ui.text.Label;

	...
	
	public class HeaderContainer extends Container
	{
		...
		protected var _lblActionSort123:Label = new Label();
		protected var _sprBackgroundColor:Sprite = new Sprite();
		protected var _tfmtAction:TextFormat = new TextFormat();
		...
		
		public function HeaderContainer()
		{
			...
			initializeUI();
		}

		
		public function initializeUI() : void
		{
			...

			with (_tfmtAction)
			{
				size = MyConstants.ACTION_FONT_SIZE;
				color = MyConstants.BLACK;
				font = "Webdings";
			}

			with (_lblActionSort123)
			{
				setPosition(_lblActionSortABC.x + _lblActionSortABC.width + 5, _lblActionSortABC.y);
				format = _tfmtAction;
				width = 75;
				text= "Sort 1" + "\u25BA" + "3";
				addEventListener(MouseEvent.CLICK, onSort123Clicked);
			}
			

			_sprBackgroundColor.addChild(_lblActionSort123);
			addChild(_sprBackgroundColor);

			...
		}

		...

	}
}

 

Eugene

My PlayBook App: Checklists
Developer
Posts: 1,008
Registered: ‎12-12-2010
My Device: Passport (Red Limited Edition)
My Carrier: Mobile Vikings

Re: How to get a Webdings character in a Label?

[ Edited ]

I got it working (but with issues):

 

			var textFormat:TextFormat = new TextFormat();
			textFormat.font = "Webdings";
			textFormat.color = 0xffffff;
			textFormat.size = 20;			

var webdingsLabel:Label = new Label(); webdingsLabel.format = textFormat; webdingsLabel.text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; webdingsLabel.width = 800; webdingsLabel.x = MARGIN; webdingsLabel.y = 50; addChild(webdingsLabel); var testField:TextField = new TextField(); testField.defaultTextFormat = textFormat; testField.text = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; testField.selectable = false; testField.width = webdingsLabel.width; testField.x = MARGIN; testField.y = 100; addChild(testField);

 

 Which results in the following:

 

IMG_00000161.jpg

 

The top row is the alphabet displayed in a qnx Label (from the qnx.fuse.ui.* library actually) and the second row is that same alphabet displayed in a standard TextField. We can observe that Webdings does work properly, without any unicode messing. However the Label is displaying squares for the last 3 characters.

 

I hope this helps, just use a TextField with selectable set to false and you should be good.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Developer
Posts: 167
Registered: ‎12-17-2010
My Device: Bold 9000
My Carrier: Vodafone

Re: How to get a Webdings character in a Label?

Ok, I got that to work similarly. But how can I now get the following label: '1', then the black Webdings arrow pointing to the right and then the '3'? Because if I set the font to Webdings, the '1' and '3' become different characters as well.

Eugene

My PlayBook App: Checklists