Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:43:34+00:00 2026-05-28T18:43:34+00:00

I am working on an application which needs to load fonts dynamically based upon

  • 0

I am working on an application which needs to load fonts dynamically based upon the fonts used in a given document that the user opens. The fonts are used in a RichEditableTextControl so need to be CFF format.

If I add the code:

[Embed(source="/assets/fonts/AvenirLTStd Book.otf",
fontFamily="EmbedAvenir LT Std 45 Book",
mimeType="application/x-font",
embedAsCFF="true")]
public const embeddedFont:Class;

to the main SWF then the text displays correctly with the embedded font but moving the code to a separate file and adding a loader as per the information I found at the following link does not load the font – http://www.scottgmorgan.com/blog/index.php/2007/06/18/runtime-font-embedding-in-as3-there-is-no-need-to-embed-the-entire-fontset-anymore/

The loader code is:

private function loadFont(url:String):void {
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fontLoaded);
    loader.load(new URLRequest(url));
}

private function fontLoaded(event:Event):void {
    var FontLibrary:Class = event.target.applicationDomain.getDefinition("FontAvenirLTStd") as Class;
    Font.registerFont(FontLibrary.embeddedFont);
}

There is an error thrown at the Font.registerFont line to say that the parameter being passed cannot be null. I have checked in debug mode and the issue seems to be that the class exists but does not have any content. The FontLibrary class is instantiated but the only child entry in the debugger is _prototype so trying to access the embeddedFont property does return undefined.

At the moment the font SWF is in the assets folder of the main project so I don’t believe there should be any security restrictions and, as I said, the SWF loading part appears to work.

One thing which is hampering my diagnostics is that I am not sure if the problem is the font SWF not being created correctly and having no content or if the main app is unable to load it. Any help on at least being able to narrow that down would be appreciated.

I would appreciate all the help I can get on this as I have been stuck at this problem for some time and it is a key part of the application.

Thanks in advance to everyone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:43:35+00:00Added an answer on May 28, 2026 at 6:43 pm

    Just a quick note for anyone who ends up here from Google, the problem was that I had managed to lose the static keyword from the embeddedFont constant definition in the top block. It should have been public static const embeddedFont:Class;

    Hope this helps someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a internet application which needs to be load tested before
I'm working on iphone application which needs to run offline at an exhibition. It
I'm a newbie C++ developer and I'm working on an application which needs to
I'm working on a program that needs to be able to load object-properties from
I'm working on an application where the user needs to select Year, Make, and
I'm working on a multi-platform application in C where I need to load fonts
I am working on a desktop application for which I need to load the
I am working on an iPhone application that has a UISearchBar which populates a
I’ve recently started working on a Win Forms application which needs some improving and
I used Sphinx4 for some time which really fits my needs. I load a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.