To embed a font in a CSS one uses the @font-face directive. An example is shown below.
@font-face {
src: url("../../../framework/assets/gilr35w.TTF");
fontFamily: GillSansLight;
advancedAntiAliasing: true;
}
Be sure that you make a relative path from the location of the CSS file to your font or else your Ant file won’t compile and will throw an error like:
“unable to resolve … for transcoding”
It’s also possible that you get the same error for assets which have been embedded into the Flex application by using the @Embed feature. Be sure that you place a ‘/’ in front of the location where the source of the asset should be or else you’ll get this error.
In the Ant file you place an mxmlc execution block inside a target as shown below and it should work like a charm:
<mxmlc file="${APP_ROOT}/${CSS_SRC_PATH}/productSelector.css"
output="${OUTPUT_ROOT}/${CSS_DEST_PATH}/productSelector.swf" >
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
</mxmlc>
One can use the mxmlc execution tag by loading the flexTasks.jar as a resource in the Ant file.
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/flexAnt/flexTasks.jar" />