Skip navigation
Currently Being Moderated

CS6 - fonts embedded in externally loaded swf - missing characters

Aug 27, 2013 10:56 AM

Tags: #missing #font #swf #character #flash_professional #external #cs6 #embed #flash_cs6

I have created a swf with some embedded fonts and nothing else. I have set all the fonts to be exported for Actionscript. When I load the external font, I call Font.registerFont() on each of the font classes from that SWF. The fonts do work, but several characters are missing from the font.


However, if I embed the same fonts into the main swf that has the textfields instead of loading them from an external swf, all characters appear as expected.


The alternative is for me to embed several fonts into multiple other swf's redundantly.


This appears to be a serious Flash bug. I would love it if it's not, and I'm doing something wrong. Adobe, are you listening?

  • Currently Being Moderated
    Aug 27, 2013 11:34 AM   in reply to Gillissie

    Are you specifying the range of glyphs properly for the fonts? a-z, numbers, punctuation, etc but more to the point any special characters you might need in extended character sets like latin, greek, etc. Make sure you have those embedded.


    The immediate reason that comes to mind why it works when you embed it directly is Flash might see a TextField utilizing a glyph that has not been marked to embed, so Flash helped you by adding that character to the embed. When blindly embedding fonts in a separate SWF it won't help you with that.


    Also Flash uses the systems codepage to limit the glyphs internally. This can be overridden in other apps like Flash Builder but in Flash Pro you're at the mercy of the system codepage as far as what gets embedded. What this means is even though you embed "Arial" and check off to embed "[x] All" glyphs, it still won't do it. Arial definitely contains many other languages glyphs but Flash will refuse to embed them for OS fonts. If your font is special/custom this probably isn't the case as Flash tends to obey in that situation.


    Worst case scenario for you is you may need to put a TextField containing the missing characters in the font SWF. Put it on stage so Flash will embed the glyphs. If you're wholesale missing basic characters like letters, that's a different story.

    Mark as:
  • Currently Being Moderated
    Aug 27, 2013 11:56 AM   in reply to Gillissie

    Are you loading your external fonts into your applications current domain context?



    // not adding error checking but you should have it

    var ldrContext:LoaderContext = new LoaderContext(false,ApplicationDomain.currentDomain,null);

    var fontLoader:Loader = new Loader();

    fontLoader.load(new URLRequest('fonts.swf'), ldrContext);


    You should make sure your fonts are available to your applicationDomain. Check to see if it loaded your fonts via their exported class definition:


    // hopefully traces true:



    Depends on the type of project however.

    Mark as:
  • Currently Being Moderated
    Aug 27, 2013 12:11 PM   in reply to Gillissie

    It's the codepage issue at work again. If you have Flash Builder you can force unicode ranges into the embedded fonts.


    BTW are you importing the font into your library or are you using [Embed] tags on an external font? Try your luck at embedding it in your class for the document, e.g.


    [Embed(source='SomeFont.ttf', fontName="SomeFont", mimeType="application/x-font-truetype", advancedAntiAliasing="true", embedAsCFF="false")];

    private static var SF:String;

    That'll instruct the compiler to embed it. You may have more luck with this.

    Mark as:
  • Currently Being Moderated
    Aug 27, 2013 1:21 PM   in reply to Gillissie

    It's a pretty well known issue that Flash internally makes some decisions it shouldn't when embedding. Why it does is pretty magical to me. I've fought the issue mostly in AS2 projects for almost a decade. It continues to this day..


    At any rate, glad you got your project working which is all that matters to a deadline .


    If you're all set please mark helpful/correct so we can filter unanswered. Good luck!

    Mark as:
  • Currently Being Moderated
    Aug 27, 2013 6:45 PM   in reply to Gillissie

    Please do yourself a huge favor and consider time=money. I wish it "just worked" but Flash Builders ability to specify unicode ranges lets you embed exactly what you want without the codepage selectivity. Otherwise at least you have a workaround.

    Mark as:
  • Currently Being Moderated
    Aug 28, 2013 8:31 AM   in reply to Gillissie

    This is why I take a 98% code approach to all projects. My TextFields are all formatted using the TextFormat class. I embed or load a SWC with fonts in the main project and have anything else loaded use the fonts I loaded one time into the main app.


    Consider there's also Runtime Shared as an option for you. That's where you mark all your fonts in a Font.FLA for export as runtime shared. Then simply create the same fonts in your other UI parts but set them to import from the runtime shared file. Then you can work on the separate UI components while still seeing the correct font.


    System codepage just means if I'm on a copy of Windows English then that will be the language Flash considers most important. If I try to embed Arial and then programmatically create and populate a TextField with Chinese, it won't work, nothing will show up. Even if I explicitly tell Flash to include the Chinese glyphs (of which definitely exist in Arial). Becuase I can't specify the unicode range I need and force it like Flash Builder, Flash "magically internally" would decide all I need is English (latin) glyphs and would not embed the Chinese glyphs. That magical behavior was always a pain.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points