Hi guys, I'm trying to fix an issue I have with Flex and some embedded fonts... To explain...
I have a small Flex video player that displays a text message at the end of the video. The text is dynamically loaded when the player starts... I had originally embedded the font like this:
[Embed(source='fonts/times.ttf', fontFamily='Times New Roman', mimeType='application/x-font', advancedAntiAliasing='true', unicodeRange='englishRange')]
private var _times_str:String;
It rendered the text fine... However we now want to load the font dynamically also... I have done this with the CSS to SWF function and it loads the style swf fine... The only issue is the layout is now all screwed up... Here is the code that draws the TextField:
// Configure the TextFormat object
textFormat = new TextFormat();
textFormat.font = GetFontName(slice.font);
textFormat.size = slice.size;
textFormat.align = slice.align;
textFormat.color = slice.color;
// Configure the TextField
textField.multiline = false;
textField.selectable = false;
textField.antiAliasType = AntiAliasType.ADVANCED;
textField.width = slice.width;
textField.height = slice.height;
textField.x = slice.x;
textField.y = slice.y;
textField.alpha = slice.alpha;
textField.embedFonts = true;
textField.text = slice.text;
textField.setTextFormat(textFormat);
As you can see in the images below, with textField.embedFonts set to true the text is pushed off to one side, however when it is set to false it looks fine...
http://philliphodges.co.uk/temp/images/player.jpg
Anybody have an idea on how to fix this...
Thanks in advance,
Phil