Possible to use embedded font in TLFTextField, with TextFormat?
I want to be able to dynamically change the font in a TLFTextField to an embedded font (not a device font). I'm using Flash CS5.
The only way I've found a TLFTextField will use an embedded font is if the on-stage TLFTextField has been set to use that font through the Flash UI. The example code I've found online (Font.registerFont etc) all works fine for a TextField, but not TLFTextField.
Below is a very simple piece of code that I expected to work. I have a font (Earwig Factory) embedded in my library (as DF4, linkage "Earwig"), and the isFontCompatible trace call prints "true", but still it is using the device font - if I remove the system font from my machine (or view the SWF on another machine) it falls back to Times New Roman.
Can anyone give a very simple example of a TLFTextField dynamically selecting an embedded font? Eventually I would like to store my fonts in a separate SWC / SWF, but for now just working out of the Library would be a good start.
Thanks,
Grant
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.FontStyle;
import fl.text.TLFTextField;
import flash.text.engine.FontLookup;
var format:TextFormat = new TextFormat();
format.font = "Earwig Factory"
trace("Earwig Factory isFontCompatible: " + tf.isFontCompatible("Earwig Factory", FontStyle.REGULAR) );
tf.defaultTextFormat = format;
tf.embedFonts = true;
//tf.antiAliasType = AntiAliasType.ADVANCED;
tf.setTextFormat(format);
//tf.textFlow.fontLookup = FontLookup.EMBEDDED_CFF;
