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
Highlighted
New Developer
Posts: 18
Registered: ‎12-29-2010
My Device: Torch 9800
My Carrier: Telus

Font.enumerateFonts(true) does not work on SDK 0.9.2

According to the post at http://renaun.com/blog/2010/12/what-font-does-qnx-ui-components-on-the-playbook-use/ you can get the list of available fonts by calling Font.enumerateFonts(true). However when I try it, I get an array of 0 length back.

 

I am using the latest SDK and sim (0.9.2), I have not tried this on other versions.

 

Has anyone else tried this? Do you have a list of fonts I can use?

 

Try running this code in the simulator:

 

package
{
	import flash.display.Sprite;
	import flash.text.Font;
	
	[SWF(width="1024", height="600", backgroundColor="#ffffff", frameRate="30")]
	public class ShowFonts extends Sprite
	{
		public function ShowFonts()
		{
			var fonts:Array = Font.enumerateFonts(true);
			
			trace("Number of fonts: " + fonts.length);
			for(var i:int = 0; i < fonts.length; i++)
			{
				var font:Font = fonts[i];
				trace(font.fontName);
			}
		}
	}
}

 

 

Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Font.enumerateFonts(true) does not work on SDK 0.9.2

I can confirm that code I used on the earlier simulator using that routine no longer works for me either.  Not sure why yet.

 

I did write a small article in December with a basic PlayBook font list, if that helps.  Of course, whether any given one of those is still in the new version is a different story.


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!