R – Flex / Flash: How to embed the same font in multiple SWCs

apache-flexflashfontsrslswc

I have the following project structure:
– A Flex Project (SDK 3.3)
– Multiple SWCs with grafics and textfields that are used as components in the Flex project.

Since I have a lot of SWCs that all use the same font in dynamic textfields, I do not want to embed the font in every SWC.
Instead I want to have a library (RSL?) with the font from where all the SWCs load the font.

I tried to build a library file with the fonts using the "Export for runtime sharing" feature in Flash.
While it works perfectly when I stay in Flash, Flex throws an "internal build error" when I try to use these SWCs in Flex.

Any ideas for a good strategy to load the fonts?

Thanks a lot,
Kolt

Best Answer

What I've done in the past was to use flash to create a swf file with the embedded fonts. see this if you're not sure what I mean for this) The link also provides other info you may find useful, its not the link I was trying to find but it covers the necessary.

Once you have your font SWF then you can just reuse this for each project. It's not a swc, but it’s as good as for the purpose of fonts. I've used CS3 to do this (I mention this as I tried the trial of CS4 and I think they may have changed the way you create embedded font swfs)

You can reference the font swf in your CSS file using something like

@font-face
{
  src: url("../theFolderWhereTheFileIs/YourFontFile.swf");
  fontFamily: "NameOfTheFontYouHaveEmbedded";
  font-weight : bold;
} 

I create a separate swf file for each type of font and name it appropriately such as StoneSansSemiBold.swf or StoneSansItalic.swf

Related Topic