13 Replies Latest reply on Dec 4, 2009 1:14 PM by pkrekelberg

    SWC CSS Font Embedding

    pkrekelberg

      I have a Flex library which uses a defaults.css to style custom components. Some of these components use an embedded font. I had been doing this in CSS using the src: directive inside a @font-face. In Flex 3, the only way I could get this to work was by placing the font files themselves (otf format) at the root level of the Flex Library Project. This means I'd reference them using only their names in the src: directive.

       

      When transitioning to Flex 4, I've got the namespace set up and all of that is working just fine, but the only way I can avoid "unable to transcode" errors is by placing the font files themselves in the Flex application project which I am building, which is simply pulling in the SWC. This is not ideal as there are many projects which use the SWC library, it worked much better to have the fonts compiled into a self-contained SWC.

       

      I saw an example which just happened to place the files at assets/fonts so I have tried that as well.

       

      As before, the fonts are included in the library under "Assets" in Flex Library Build Path.

       

      Has anyone been successful embedding fonts using CSS? Oddly enough, I have some Actionscript which embeds these same fonts and that works fine! The only issue is when I try to do it using CSS @font-face.

       

      Thanks,

      -Patrick