Flex 4 TLF and embedded font loaded as a module not working
this problem is really killing me so any help will be really great :)
I have a flex 4 application that loads a flex module. In this module I 'register' a bunch of fonts. I have a Spark textArea in this module that wants to use one of these fonts via its text flow which is created using:
textArea.textFlow = TextConverter.importToFlow(htmlText, TextConverter.TEXT_FIELD_HTML_FORMAT);
I 'register' the font using:
[Embed(source='/assets/fonts/book/HogarthScrD-Regular.ttf', embedAsCFF="true",fontName='HogarthScrD')]
public static var _HogarthScrD:Class;
Where the html text is:
var htmlText:String = "<TEXTFORMAT LEADING="2"><P ALIGN="CENTER"><FONT FACE="HogarthScrD" SIZE="19" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>My html Text</B></FONT></P></TEXTFORMAT>";
I know the font 'HogarthScrD' exists as a debug on to the array of Font.enumerateFonts(); show me that 'HogarthScrD' is one of the element and is of type cff
I have read loads of documents around this and have failed to find a solution :( I read this artical: http://blogs.adobe.开发者_JAVA百科com/aharui/2010/03/flex_and_embedded_fonts.html tho I understand what it is saying I am not sure i know how to implement this... Even if someone can point me to the example will be useful!
I was thinking it was because it was importing from HTML text, so I just typed some text and used the emebedded font that doesn't work also.
Thanks a million in advance!
Ok I got this to work. The problem was alot more trivial. Aren't they ever! The mere fact that the HTML was a string was causing the problem. If I use the same 'String' but as of type XML it works just fine..
so instead of what I have before just change the type to XML and get rid of the quotes!
var htmlText:XML =<TEXTFORMAT LEADING="2"><P ALIGN="CENTER"><FONT FACE="HogarthScrD" SIZE="19" COLOR="#000000" LETTERSPACING="0" KERNING="0"><B>My html Text</B></FONT></P></TEXTFORMAT>;
精彩评论