Hello,
i am really getting headache from Embedded font stuff in as3 and would
like some help.
I embedded the fonts by using the Embed tag:
<code>
[Embed( source='../../../../../fonts/myriad
pro/MyriadPro-Bold.otf',
fontName='MyriadProFont', unicodeRange='U+0010-U+00FC', fontWeight =
'bold',
fontFamily="Myriad Pro",
mimeType='application/x-font-truetype',
embedAsCFF="false"
)]
public static var MyriadProBoldFont:Class;
[Embed( source='../../../../../fonts/myriad
pro/MyriadPro-Regular.otf',
fontName='MyriadProFont', unicodeRange='U+0010-U+00FC', fontWeight
= 'normal',
fontFamily="Myriad Pro",
mimeType='application/x-font-truetype',
embedAsCFF="false"
)]
public static var MyriadProRegularFont:Class;
</code>
When I created a new TextField and setup the textformat to use the
MyriadProFont and add it to the list all works fine.
Using this snippet I checked to see if the font is really registered
and it is.
<code>
var embeddedFonts:Array = Font.enumerateFonts(false);
embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);
</code>
Now we also have swf's that gets loaded in. The designer has put
textfields in place. I need add the textformat to it. But the damn
embedding doesn work. It doesnt render any text. I searched but could
not find any solution. I hope someone here has a solution. Below the
code i use.
<code>
var tField:TextField = _sprite.getChildByName("field") as TextField;
addFormatting( treatmentTimeInfo , STD_LABEL_FONT_SIZE , WHITE);
function addFormatting(tField:TextField):void{
var format:TextFormat = new TextFormat()
format.font = "Myriad Pro";
format.bold = true;
tField.defaultTextFormat = format;
tField.embedFonts = true;
tField.setTextFormat( format );
tField.text = "some_text"
}
</code>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders