Skip to main content
Participating Frequently
November 26, 2008
Answered

Can you embed a font just using ActionScript in Flash CS4?

  • November 26, 2008
  • 6 replies
  • 17093 views
I want to embed a font for use with the new text framework in Flash CS4 just using ActionScript. Can anyone provide an example?
This topic has been closed for replies.
Correct answer Peter_deHaan
rhodesbe,

I tried a similar CFF embedding test in Flex Builder 3.0.2 with Flash Player 9.x and got the similar warning ("transcoding parameter 'cff' is not supported by 'flex2.compiler.media.FontTranscoder").

I was actually playing around with this a week ago and hit this roadblock as well. I asked around on the Flash Authoring team and got this pointer:
quote:

The new embed functionality is in mxmlc.jar. You could try replacing the mxmlc.jar installed with Flash CS4 with a more recent version, but i’m not very optimistic that would work very well (definitely don’t delete the old copy). The dependencies between flash and mxmlc are many and complex, and they have likely been broken in new versions.


I tried replacing my mxmlc.jar file in Flash CS4 with a recent nightly build of Flex Gumbo SDK and had less than stellar results:
quote:

"Error initializing Java Runtime Environment. You may need to reinstall Flash."


The only other suggestion given to me was:
quote:

You could create a swc file using a new version of flexbuilder with the new embed stuff available in gumbo (defining ArialEmbeddedFont), and then put the swc in the library path for your FLA and access the ArialEmbeddedFont that way. I think that would work fine, since flexbuilder would handle the [Embed]. The only issue would be if the flash swc linker doesn’t handle definefont4 correctly, but i think we tested that.


I haven't had a chance to experiment with that, but it should work. Let me know if you have any success.
I don't know when I'll get time to test it out, but if I get something working I'll add it to actionscriptexamples.com and/or flexexamples.com.

Regards,
Peter

6 replies

Participating Frequently
June 24, 2009

In build 7972, the 'cff' transcoding parameter was renamed to 'embedAsCFF'.

Gordon Smith

Adobe Flex SDK Team

June 24, 2009

Thanks Gordon, that seemed to fix my problem.

Inspiring
September 4, 2010

I don't understand how you fixed it.

June 23, 2009

I get the same error: transcoding parameter 'cff' is not supported by 'flex2.compiler.media.FontTranscoder'  in flex Gumbo, build 4.0.0.8031.

Any idea why I can't embed a font in flex 4?

brian_thomas2
Adobe Employee
Adobe Employee
June 24, 2009

You shouldn't see this error if you are building with Gumbo. You should double check your SDK setup. Are you sure that you aren't overriding the SDK version in your project settings?

June 24, 2009

If you are talking about right clicking the project and changing the compiler/sdk settings there then I've done that several times. Each time it says it's using sdk 4.0.0.8031, never changes. If there's something else you are refering to, then please be more specific.

Peter_deHaan
Participating Frequently
January 14, 2009
I have a poorly written tutorial on ActionScriptExamples.com at http://actionscriptexamples.com/2008/12/20/embedding-fonts-from-a-flex-application-into-a-flash-swf-file/

Peter
Peter_deHaan
Participating Frequently
December 5, 2008
I wouldn't go as far as to say "fault". DefineFont4 and CFF is all new/beta stuff being worked on in Gumbo and TLF. Flash CS4 was already finished before this stuff was finalized. I'll keep looking into this when I get a bit of time to see if I can get the FlexBuilder SWC approach working in the meantime though.

Regards,
Peter
Participating Frequently
December 5, 2008
quote:

Originally posted by: peterd_mm
I wouldn't go as far as to say "fault". DefineFont4 and CFF is all new/beta stuff being worked on in Gumbo and TLF. Flash CS4 was already finished before this stuff was finalized. I'll keep looking into this when I get a bit of time to see if I can get the FlexBuilder SWC approach working in the meantime though.


I figured Flash CS4 would be updated for the final release. I did get the SWC method to work.

Inspiring
January 14, 2009
Is there an update on this issue?
Updating the library path to Gumbo is also not working for me.
I need a way to embed fonts in the Flash IDE not using the Text Layout Framework.
Thank you
Peter_deHaan
Peter_deHaanCorrect answer
Participating Frequently
December 4, 2008
rhodesbe,

I tried a similar CFF embedding test in Flex Builder 3.0.2 with Flash Player 9.x and got the similar warning ("transcoding parameter 'cff' is not supported by 'flex2.compiler.media.FontTranscoder").

I was actually playing around with this a week ago and hit this roadblock as well. I asked around on the Flash Authoring team and got this pointer:
quote:

The new embed functionality is in mxmlc.jar. You could try replacing the mxmlc.jar installed with Flash CS4 with a more recent version, but i’m not very optimistic that would work very well (definitely don’t delete the old copy). The dependencies between flash and mxmlc are many and complex, and they have likely been broken in new versions.


I tried replacing my mxmlc.jar file in Flash CS4 with a recent nightly build of Flex Gumbo SDK and had less than stellar results:
quote:

"Error initializing Java Runtime Environment. You may need to reinstall Flash."


The only other suggestion given to me was:
quote:

You could create a swc file using a new version of flexbuilder with the new embed stuff available in gumbo (defining ArialEmbeddedFont), and then put the swc in the library path for your FLA and access the ArialEmbeddedFont that way. I think that would work fine, since flexbuilder would handle the [Embed]. The only issue would be if the flash swc linker doesn’t handle definefont4 correctly, but i think we tested that.


I haven't had a chance to experiment with that, but it should work. Let me know if you have any success.
I don't know when I'll get time to test it out, but if I get something working I'll add it to actionscriptexamples.com and/or flexexamples.com.

Regards,
Peter
Participating Frequently
December 5, 2008
Thanks for looking into this Peter. This was driving me crazy and I'm glad it turns out to be Flash CS4's fault. Hopefully this will be fixed in the future. I'll give the SWC approach a try.
brian_thomas2
Adobe Employee
Adobe Employee
November 26, 2008
Check out this post on our blog: Embedded Font Subsetting Using DefineFont4. I recommend this method of ActionScript font embedding for use in TLF.
Participating Frequently
November 26, 2008
I've read that article. I'm using this meta tag in my class:
[Embed(source="MinionPro-Regular.otf", fontFamily="MinionPro", cff="true")]
private var MinionFont:Class;

But when I compile I get this error.
"transcoding parameter 'cff' is not supported by 'flex2.compiler.media.FontTranscoder'"

I've downloaded the Gumbo SDK and tried adding to my library path, but I still get the same error. Any advise?
Adobe Employee
November 27, 2008
Sounds like your project is somehow using an older Flex SDK compiler and not Flex Gumbo compiler. Are you sure you picked the Flex Gumbo sdk by choosing "Use a specific SDK" and pointing it to the Flex Gumbo SDK as indicated at this link?
http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/