Highlighted

AFEFontManager in Adobe AIR 18 . How to embed fonts now?

Community Beginner ,
Jul 14, 2015

Copy link to clipboard

Copied

I have been building my games using FlashDevelop with Flex SDK compiler all the time, but now I need ASC 2.0 with adobe air. So I have migrated to it. But one problem came out, which I just can't find a solution for. I need to embed TTF fonts, which I used to always add additional compiler option -managers=flash.fonts.AFEFontManager for. In this new AIR SDK all I get is the next warning:

command line Warning: 'compiler.fonts.managers' is not fully supported.

And of course fonts do not embed. Is there a solution for it?

Here's how I embed them

[Embed(source = "VERDANA.TTF", fontName = "verdana")]
private static var Verdana: Class;

So, how can I embed fonts in AIR 18?

TOPICS
Development

Views

634

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

AFEFontManager in Adobe AIR 18 . How to embed fonts now?

Community Beginner ,
Jul 14, 2015

Copy link to clipboard

Copied

I have been building my games using FlashDevelop with Flex SDK compiler all the time, but now I need ASC 2.0 with adobe air. So I have migrated to it. But one problem came out, which I just can't find a solution for. I need to embed TTF fonts, which I used to always add additional compiler option -managers=flash.fonts.AFEFontManager for. In this new AIR SDK all I get is the next warning:

command line Warning: 'compiler.fonts.managers' is not fully supported.

And of course fonts do not embed. Is there a solution for it?

Here's how I embed them

[Embed(source = "VERDANA.TTF", fontName = "verdana")]
private static var Verdana: Class;

So, how can I embed fonts in AIR 18?

TOPICS
Development

Views

635

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 14, 2015 0
Community Beginner ,
Jul 14, 2015

Copy link to clipboard

Copied

try adding

[Embed(source = "VERDANA.TTF", fontName = "verdana", embedAsCFF="false")]

I had the same problem and adding embedAsCFF="false" make it work

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2015 0
Community Beginner ,
Jul 14, 2015

Copy link to clipboard

Copied

Thanks for your reply, but no, it won't work.

I've found out that Adobe has removed pre-transcoding of fonts from ASC 2.0. Now all we can do is to use fontswf command line utility to create swf from fonts or to make library of fonts using Flash Pro, and save them as swc or swf.

Then pass font class to Font.registerFont() method to make them available.

Normal embed does not work anymore, with whatever parameters

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 14, 2015 0
Community Beginner ,
Jul 15, 2015

Copy link to clipboard

Copied

It's realy strange as I use embedded font in my current project and all works great.

note :

- I removed the -managers option in the compiler options.

- I don't use verdana as name but an other font name 'Verdana_'.

- Here is my Embed code :

    [Embed(source="/assets/fonts/VERDANA.TTF", fontName="Verdana_", mimeType="application/x-font-truetype", embedAsCFF="false")]
    /**police Verdana Regular**/
    public var verdanaReg:Class
;


Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2015 0
Community Beginner ,
Jul 15, 2015

Copy link to clipboard

Copied

What compiler version do you use?

It used to work in my projects too, but I decided to migrate to ASC 2.0 the other day. That's when it all failed

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2015 0
Engaged ,
Jul 15, 2015

Copy link to clipboard

Copied

I am using Flash Builder 4.7, so I'm not sure how helpful I'll be, but I'll post my experience anyway.

ASC 2.0 is the "fast compiler" they put out awhile back, no?  I've got several projects for iOS/Android that are using the new compiler and can embed fonts just fine.  I'm currently using AIR SDK 16.

Here's a couple working font embed statements:

  [Embed(source="../../../embed/doctor_soos_bold_3.0.ttf", fontName="DoctorSoosBold", mimeType = "application/x-font-truetype", embedAsCFF="false")]

  protected static var DR_SOOS_FONT:Class;

  [Embed(source="../../../embed/Vag Rounded BT.ttf", fontName="Vag", mimeType = "application/x-font-truetype", embedAsCFF="false")]

  protected static var VAG_FONT:Class;

After that, I just use a Starling textfield and use the name from the Embed statement, and it works.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2015 0
Community Beginner ,
Jul 15, 2015

Copy link to clipboard

Copied

Hi Kostyanych, I use AIR SDK 17 with ASC 2.0 compiler on FlashBuilder 4.7 and IntelliJ IDEA for both mobile and web.

Did you try to remove the -managers option ? Did you try adding mimeType and embedAsCFF="false" ? Did you try changing the fontName ?  Can you paste a sample code how you use the font, maybe a creation of textField ?

Here is a sample code how I create a TextField on my project:

var texte:TextField      = new TextField();      // create TextField

var f:TextFormat         = new TextFormat();     // create a TextFormat
f.font                   = 'Verdana_';           // assign my font name Verdana_
texte.embedFonts         = true;                 // setting enbed font to true to use embeded fonts
texte.defaultTextFormat  = f;                    // apply the textFormat to my TextField

addChild( texte );

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 15, 2015 0
Community Beginner ,
Jul 16, 2015

Copy link to clipboard

Copied

Hi!

Yes, I tried all of this. Removing -managers option was the very first thing I did.  My AIR SDK Version is 18.0.0.44, the latest at the moment.

The textfield I'm using is the one of starling framework. It's build correctly inside and embedFonts setter is enabled.

By the way, the fonts really get embedded, but cannot be transcoded anymore. Right now if a change back to Flex SDK 4.6, the same code works perfectly.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 16, 2015 0
Community Beginner ,
Jul 16, 2015

Copy link to clipboard

Copied

Try ask on Starling Forum, maybe someone could help you there, I never had problems likes this with flash TextFields or Starling ones using embedding fonts since ASC 2.0.

But a simple code sample could helps to find out the problem

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 16, 2015 0