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
tyrael
Posts: 71
Registered: ‎01-06-2011
My Device: Not Specified

Re: Embedding Fonts

If I run fontswf in cmd, it opens a second windows that says "'java' is not recognized as an internal or external command". 

---
My Apps:
KeepUp (http://appworld.blackberry.com/webstore/content/26514?lang=en)
Developer
p3pp3r
Posts: 157
Registered: ‎12-16-2010
My Device: Torch 9800, PlayBook

Re: Embedding Fonts

 


tyrael wrote:

If I run fontswf in cmd, it opens a second windows that says "'java' is not recognized as an internal or external command". 


fontswf requires Java runtime (or SDK). Go to java.com, download latest Java runtime (or SDK which includes runtime) and you should be able to re-run.

 

----------
If you find this post helpful please "like" it and accept as a solution.
Developer
studiochris
Posts: 165
Registered: ‎10-26-2010
My Device: BlackBerry® PlayBook™

Re: Embedding Fonts

[ Edited ]

If you have the Flash IDE available, fonts loaded through the library panel and exported for ActionScript work as well. The easiest way I've found is to export the library as a SWC and import the Font classes from the SWC into your project just like any other ActionScript library.

 

 

package
{
	import flash.text.Font;
	
	public class FontLibrary
	{
		private static var myriadProLight:Font = new MyriadProLight();
		private static var myriadPro:Font = new MyriadPro();
		private static var myriadProSemiBold:Font = new MyriadProSemiBold();
		private static var myriadProBold:Font = new MyriadProBold();
		
		public static const MYRIAD_PRO_LIGHT:String = myriadProLight.fontName;
		public static const MYRIAD_PRO:String = myriadPro.fontName;
		public static const MYRIAD_PRO_SEMIBOLD:String = myriadProSemiBold.fontName;
		public static const MYRIAD_PRO_BOLD:String = myriadProBold.fontName;
        
       		public function FontLibrary()
		{
			Font.registerFont(MyriadProLight);
			Font.registerFont(MyriadPro);
			Font.registerFont(MyriadProSemiBold);
			Font.registerFont(MyriadProBold);
        	}
   	}
}

 

 

Developer
tyrael
Posts: 71
Registered: ‎01-06-2011
My Device: Not Specified

Re: Embedding Fonts

@p3pp3r: I have the latest update for java. I tried removing it and reinstalling as well, but I still get the same error. I don't know what's wrong. I open cmd at the bin folder, and type in "start fontswf", or "start fontswf.bat", and hit enter. A new window pops up and says that java is not an executable command.

---
My Apps:
KeepUp (http://appworld.blackberry.com/webstore/content/26514?lang=en)
Developer
rhgills
Posts: 39
Registered: ‎01-13-2011
My Device: Not Specified

Re: Embedding Fonts

[ Edited ]

I was able to successfully embed a font in my application using the method described by kefayati in this post, with one caveat. The -4 flag supplied to the command line fontswf tool, as shown in his example, creates a font in the new CFF format.

 

flexsdk\bin\fontswf -a titr -o titr -4 titr.ttf

If you want to use the embedded font with non-CFF compliant classes, such as qnx.ui.text.Label, you need to embed the font in a non-CFF format. In this case, simply call fontswf with -3 instead of -4 as below and embed the SWF in your project as normal.

 

flexsdk\bin\fontswf -a titr -o titr -3 titr.ttf
If trying to set a custom font for a label, remember to not only set the textFormat.font to the name you assigned to your font, but also set the label.embedFonts property to true.
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Device: BlackBerry Torch

Re: Embedding Fonts

FWIW, I just got done implementing using a custom font using Renaun's method. It worked like a charm! I had thought it would be a lot more painful based on the length of this thread and the comments people have made. I even used it on a LabelButton instead of a TextField.

 

I'm using FlashBuilder Burrito with 0.9.2. I thought I would even have to change project settings, or build settings, or something, but I didn't!

 

Bill

 

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Developer
noahnu
Posts: 138
Registered: ‎01-09-2011
My Device: Blackberry Tablet OS

Re: Embedding Fonts

Are the only supported font types ttf and cff?

From,
Noah NU