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: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

Embedding Fonts

I`m trying to embed fonts for the first time into an AIR app.

 

This is what I tried:

 

[Embed(source="BRITANIC.TTF", fontFamily="BritanicEmbed", mimeType="application/x-font")]
public var BritanicEmbed:Class;

 

var textFormat:TextFormat = new TextFormat();
textFormat.font = "BritanicEmbed";

 

lblTitle = new Label();
lblTitle.format = textFormat;
lblTitle.text = "Test";
lblTitle.embedFonts = true;

 

... and that worked great.

 

But that was just a tester. The actual font I need to use is a .otf font. (OpenType Font)  When I try:

 

[Embed(source="TrajanPro-Regular.otf", fontFamily="TrajanProEmbed", mimeType="application/x-font")]
public var TrajanProEmbed:Class;

 

... running mxmlc gives:

 

Error: exception during transcoding: Font for alias 'TrajanProEmbed' with plain weight and style was not found at: ...

 

Has anyone here gotten OTF fonts to embed. (Note: I`m using the command line and mxmlc to compile my AIR apps, if that makes any difference)

 

Thanks,

Daniel

 

PS  I also have a .ttc font (whatever that is) that I need to use. Is that possible.

Developer
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: Embedding Fonts

Since posting this, I came across:

 

http://onlinefontconverter.com/

 

By converting the .otf and .ttc fonts I had to .ttf fonts, I was able to embed them.

 

The problem I`m having now is that the embedded fonts looks very bad.  I`ve taken a screen capture and zoomed in, and while it does look like they are anti-aliased, they still look terrible.

 

I was worried that perhaps the tool at the onlinefontconverter was responsible, but if I open the converted fonts in Word, they look perfect at all sizes.

 

So now I don`t know what to do -- I have no idea why the fonts would look terrible. (For reference, I`m using a font size of 44)

Highlighted
Developer
Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA

Re: Embedding Fonts

Thank the Lord.


I happened to find a reference to:
lblTitle.textField.antiAliasType = AntiAliasType.ADVANCED;
... setting that suddenly causes everything to look perfect.
Big sigh of relief!
Hope this helps someone else out there trying to embed fonts into their PlayBook apps.