Embedding fonts in Flex 3 can be achived by
@font-face {
src : url("comic.TTF");
fontFamily : comic;
}
But this will not work in flex 4. We need to add one more property ‘cff’ and setting it to true.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768">
<fx:Style>
@namespace mx "library://ns.adobe.com/flex/halo";
@namespace s "library://ns.adobe.com/flex/spark";
@font-face {
src : url("comic.TTF");
fontFamily : comic;
cff : true;
}
.myStyle {
font-family : comic;
font-size : 24;
}
</fx:Style>
<s:RichText fontFamily="comic" x="40" y="23">
Embedding font in flex 4 - RichText
</s:RichText>
<s:SimpleText styleName="myStyle" x="40" y="63">
Embedding font in flex 4 - RichText
</s:SimpleText>
</s:Application>