If you're getting an "Unable to transcode", it's usually because the file can't be found. It can also be that the file is corrupt.
A working case for a file residing in the Assets/Fonts directory, below the main directory:
Beyond this, I'd need to see your code.
Well.. The issue is not with building the SWC. The problem occurs when I build an application (AIR or web) which uses the SWC (via "Flex Build Path", "Library Path", "Add Project").
I added precisely your code into my defaults.css which is in the src folder of my Flex Library Project. I've included a screenshot of the code, structure of the assets/fonts folder, and the Errors upon building the application which uses the SWC.
I can put these exact font files in an assets/fonts folder in the application itself and it builds! The fonts need to be in the SWC, not the application. This worked with these exact files in the Flex 3.4 SDK.
Here is a simple example which exhibits the core issue, a Library and an application which, once it links the SWC, triggers a "unable to read transcoding source" error.
CSSFontExample.zip 1.5 MB
I have also tried pulling in the SWC as a "theme" binary and the same error occurs. Either I am building the SWC incorrectly, or this is a major bug in Flex 4.
Does this work on the command line?
good question... have not tried. Do those projects work for you?
If this sheds any light, if I delete the file altogether from the library to ensure failure, the error I get is "Unable to resolve for transcoding" as opposed to "unable to read transcoding source" when the file is there and added to the library as an asset.
In FB, in short, the stuff you posted did work for me.
I took the zip file and imported that. FB created a directory src/assets/fonts and copied the relevant files in there. I clobbered those and it failed. Then I added back the Library.swc manually, and it compiled.
Also, I tried this on the command line and it WORKED using a Flex application (have not tried linking in AIR yet). How is this possible? What does this tell us?
Huh.. weird. I am not sure what I am missing on the FB side.
If it works on the command line and not in Fb, it points to either a bug in Fb or a flaw in how you're pointing to things in Fb.
1) wipe out any compiled stuff before proceeding, just to make sure that some odd version skew isn't a variable.
2) In Fb, add a reference to the swc manually (Project> Properties> Add SWC)
Are you saying you were able to build the "AIR Project" with the style getting applied using the Library defaults.css, or are you saying you were simply able to build the Library project?
I was able to pull in the command-line compiled SWC by adding this to the compiler arguments for the AIR project to get it to work:
(the SWC I compiled at the command line happened to be called t.swc)
However, manually pulling in the SWC and pointing to it as the theme using the Properties window triggers the same transcoding errors. Something is different about the way Flash Builder 4 is using compc vs. this simple command line:
compc -include-file Myriad.otf Myriad.otf -include-file defaults.css defaults.css -o t.swc
I'm awfully confused.
1 person found this helpful
File a bug for this issue using http://bugs.adobe.com/flex
When you compile your library, the defaults.css and the fonts get included into the library. But the @font-face is not processed at that time, so the fonts are not embedded.
When the main app looks at the defaults.css it tries to process @font-face but is not able to pull the fonts from the swc file.
It seems the issue is with @font-face, because defaults.css can use assets using Embed
So please log a bug.
Flex SDK Team