I am using SWF font library classes (done with FlashDevelop) to be able to have dynamically embedded fonts in an application. All text/graphic components are drawing styles from a plain (non-swf) CSS file, which supplies all the text/label components with a generic font name, to which the dynamic font is imported.
Example: User is using Arial.
App imports ArialFont.swf which has embedded:
- Arial Regular
- Arial Bold
- Arial Regular with embedAsCFF=false
and maps them to an internal generic font name:
- MyFont (regular)
- MyFont (bold)
- MyFontCFF (embedAsCFF=false)
This is working perfectly, for the dynamically generated components.
However, the s:Label components that are laid out with MXML in the application are loading before the fonts are properly loaded and embedded, and they are displaying with Times New Roman (system default), even though the embedded fonts are now loaded and ready.
Is there a way for me to force these static s:Label components to update their view to include the newly embedded fonts?
Message was edited by: jethroq :: Reason: clarification
See the embedded font post on my blog to make sure everything is set up correctly. However, you might just need a call to the undocumented styleManager[“styleDeclarationsChanged”]();
Flex SDK Team
Adobe System, Inc.
Thank you for the response! I will try this first thing in the morning after checking out your blog.
Flex harUI's answer was spot on; just called styleManager.styleDeclarationsChanged(); in a component after the fonts were loaded and registered, and everything worked perfectly. Thank you!