Flex 4 TLF and embedded font loaded as a module not working

两盒软妹~` 提交于 2019-12-25 01:47:12

问题


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.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!


回答1:


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>;



来源:https://stackoverflow.com/questions/4249625/flex-4-tlf-and-embedded-font-loaded-as-a-module-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!