PS: I meant this:
var font:Font = new Garamond3Embedded() as Font; textFormat.font = font.fontName; 2010/9/22 Juan Pablo Califano <[email protected]> > Have you tried not setting the font name in the text format object? I think > it defaults to Times or something like that. > > Then, if the text shows up, maybe the problem is in the font identifier. > > You could then / also try this, which should give you the right name for > the font. > > var font:Garamond3Embedded = new Garamond3Embedded(); > textFormat.font = font.fontName; > > Cheers > Juan Pablo Califano > > 2010/9/22 Kerry Thompson <[email protected]> > > I've been banging my head up against this for 4 hours, and the client >> has to ship tonight. >> >> FlashBuilder 4, Windows 7. >> >> I am just trying to make a little demo of how to embed a font, but >> when I pull together code that has worked before into one simple >> class, it doesn't show the text. It draws the outline of the text >> field, but there is no text. When I comment out one line, >> textField.embedFonts = true, it works, but not with the embedded font. >> >> I've tried different fonts, and can't get any of them to work. Can >> somebody spot what I'm doing wrong? >> >> Cordially, >> Kerry Thompson >> >> public class FontEmbedding extends Sprite >> { >> public function FontEmbedding() >> { >> showText(); >> } >> >> /** >> * Embeds the Garamond 3 font >> */ >> [Embed( >> source='../fonts/GaramThrSC.ttf', >> fontName='Garamond3' >> )] >> >> private static var Garamond3Embedded: Class; >> >> private function showText():void >> { >> var textFormat:TextFormat; >> var textField:TextField; >> registerFonts(); >> >> textFormat = new TextFormat(); >> textFormat.color = 0x000000; >> textFormat.font = "Garamond3Embedded"; >> textFormat.align = "left"; >> >> textField = new TextField(); >> textField.defaultTextFormat = textFormat; >> textField.border = (true); >> >> textField.embedFonts = true; >> >> textField.text = "Hello Autovod!"; >> textField.width = 100; >> textField.height = 30; >> >> addChild(textField); >> textField.x = 100; >> textField.y = 60; >> } >> >> public static function registerFonts(): void >> { >> Font.registerFont(Garamond3Embedded); >> } >> } >> } >> _______________________________________________ >> Flashcoders mailing list >> [email protected] >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders >> > > _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

