Skip to main content
Projectitis
Inspiring
May 29, 2014
Answered

[Embed(source='font.ttf')] suddenly failing in AIR 13.0

  • May 29, 2014
  • 1 reply
  • 305 views

Hi all,

I have an app for iOS and Android that we've been testing for about 6 months with no problem.  It uses Embed code to define 5 different fonts used throughout the app, like this:

[Embed(source='fonts/Feijoa_Medium.ttf', fontFamily="_Feijoa", fontWeight=FontWeight.NORMAL, advancedAntiAliasing="true", embedAsCFF="false")]

  public static const FeijoaClass : Class;

// Sometime later

Font.registerFont( FeijoaClass );

This has been working perfectly in AIR 3.9

I recently upgraded the AIR version to 13.0 (Edit: also happens in 14.0) and first received this error message:

Build failed: Warning. The constant 'FeijoaClass' was not initialised

On a whim, I changed the variable to private static var like this:

[Embed(source='fonts/Feijoa_Medium.ttf', fontFamily="_Feijoa", fontWeight=FontWeight.NORMAL, advancedAntiAliasing="true", embedAsCFF="false")]

  private static var FeijoaClass : Class;

The project now compiles, but I get the following run-time error on the Font.registerFont call:

[Fault] exception, information=TypeError: Error #2007: Parameter font must be non-null.

And sure enough, all my embedded classes are null.

The path to the font is correct.  However, another weird thing is that if I deliberately change the path to the font to be incorrect, I do not receive any sort of error (I'm sure i used to in AIR 3.9 if the path was incorrect).

Any ideas?  Scratching my head at this one!

This topic has been closed for replies.
Correct answer Projectitis

Ok, this turned out to be a problem with my IDE.

I use FlashDevelop and had recently updated to 4.6.2

I reinstalled an older version (4.5.2) and embeds are working again!

1 reply

Projectitis
ProjectitisAuthorCorrect answer
Inspiring
May 30, 2014

Ok, this turned out to be a problem with my IDE.

I use FlashDevelop and had recently updated to 4.6.2

I reinstalled an older version (4.5.2) and embeds are working again!