Loading font at runtime for TLF in Flex 3.3
Hey flexers,
I have an app that's using the Flex 3.3 SDK. We pulled the text layout swc from Flex 4 and are using a text flow in our app. Previous to this we had been using the old TextField.
How do I go about loading in a font swf at runtime and getting a text flow to use it? I've tried several things as posted on the forum and around the web and it never actually takes effect in the text flow. Here are a couple questions I came up with along the way though:
When I compile the font swf from the font css, do I need to have embedAsCFF=true?
Should I be able to use StyleManager.loadStyleDeclarations() to load in the font swf? When I do, I get the following error:
VerifyError: Error #1014: Class mx.modules::ModuleBase could not be found.
Any idea why or know how I would load in the font swf?
Let me clarify a bit. Here it says that I need to set embedAsCFF=true to use the font with FTE:
http://help.adobe.com/en_US/flex/using/WS0FA8AEDB-C69F-4f19-ADA5-AA5757217624.html
It's my understanding that in order to use embedAsCFF=true I need to be using the Flex 4 sdk. However, when I convert the CSS to a SWF and attempt to load it into my Flex 3.3 app using StyleManager.loadStyleDeclarations() I get the error:
VerifyError: Error #1014: Class mx.modules::ModuleBase could not be found.
It would appear it's because I'm attempting to load a font "module" that was built in Flex 4 into an app built in Flex 3.3. Is it possible to load a Flex 4 module into a Flex 3.3 app? Is there some other workaround?
Similar Messages
-
Im having a requirement to load fonts at runtime and display them in a RichEditableText, The text in the RichEditableText could have multiple formats so I use the RichEditableText's setFormatOfRange() method to set the font.
I use a CSS compiled as a SWF to load the fonts, Fonts render when the font is set via the -setStyle() method as demonstrated in the code below
Im using Flash Builder 4 with SDK version 4 to compile the app(Using the default Spark Theme).
Below is the CSS file (fontCSS.css)- You might need to copy fonts from the Widows Font folder for this in a fodler named fonts,
/* CSS file fontCSS.css*/
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face{
src: url("fonts/Articulate.TTF");
fontFamily: "Articulate123";
embedAsCFF: true;
@font-face{
src: url("fonts/AGENCYB.TTF");
fontFamily: "Agency123";
embedAsCFF: true;
Right Click on the CSS file, in Flash Builder 4 and select "Compile CSS to SWF".
Run the MXML application below and you should see the issue Im trying to describe.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import flash.utils.describeType;
import flashx.textLayout.formats.TextLayoutFormat;
import mx.collections.ArrayCollection;
import mx.events.CalendarLayoutChangeEvent;
import mx.events.FlexEvent;
import mx.events.StyleEvent;
import spark.events.IndexChangeEvent;
private var swfLoader:Loader
protected function application1_creationCompleteHandler(event:FlexEvent):void
var cssEventDispatcher:IEventDispatcher=styleManager.loadStyleDeclarations("fontCSS.swf")
cssEventDispatcher.addEventListener(StyleEvent.COMPLETE, onComplete);
private function onComplete(event:Object):void
fontList.dataProvider=new ArrayCollection(Font.enumerateFonts())
protected function fontList_changeHandler(event:IndexChangeEvent):void
var tlformat:TextLayoutFormat=new TextLayoutFormat()
tlformat.fontFamily=fontList.selectedItem.fontName
textEditor.setFormatOfRange(tlformat,0,5)
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Label text="Please select a font from the list below"/>
<s:List id="fontList" change="fontList_changeHandler(event)">
</s:List>
<s:RichEditableText id="textEditor2"
fontSize="30"
fontFamily="{fontList.selectedItem.fontName}" >
<s:p>Hello - fontFamily set via css binding</s:p>
</s:RichEditableText>
<s:RichEditableText id="textEditor"
fontSize="30"
>
<s:p>Hello - fontFamily set via setFormatOfRange()</s:p>
</s:RichEditableText>
</s:Application>
tried to use an external SWF with the fonts compiled in them Via AS3, that too dosent seem to work, The setStyle() also refuse the work with the below SWF
here is the AS3 project code for your reference
FontEmbedder.as
package
import flash.display.Sprite;
import flash.system.Security;
import flash.text.Font;
public class FontEmbedder extends Sprite
public function FontEmbedder()
Security.allowDomain("*")
[Embed(source="/fonts/Articulate.TTF", fontName="Articulate123", embedAsCFF="true")]
public var articulateFont:Class;
[Embed(source="/fonts/AGENCYB.TTF", fontName="Agency123", embedAsCFF="true")]
public var agencyFont:Class;
We ve been wrecking our heads off to figure out a solution for this. Ultimately decided to post a question here.
Your feedback will be highly appreciated.
Below are snapshots of how the 2 fonts are rendered
Regards.Hi Alex,
I did read through your blog the other day, This must have been thepost you were referring to,
http://blogs.adobe.com/aharui/2010/03/flex_and_embedded_fonts.html
The post is explanatory, but how would we implement this successfully wth code?
A working AS3 code example of your explanation would be more than helpful.
Regards -
How To register fonts at runtime in flex 4 ?
Hi Guys
I stuck in a problem .Actually i want to register fonts at runtime here is sample of code i am using :
private function loadFont(url:String):void{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, fontLoaded);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.addEventListener(IOErrorEvent.DISK_ERROR, ioDiskHandler);
loader.addEventListener(IOErrorEvent.NETWORK_ERROR, ioNetworkHandler);
loader.addEventListener(IOErrorEvent.VERIFY_ERROR, ioVerifyHandler);
loader.load(new URLRequest(url));
//===============================================================================
// funtion fontLoaded :: called after font loaded by loadewr class
private function fontLoaded(evt:Event):void
var fontLib:Class
//trace("loaded " + "<<>> "+fontCounter);
//FlexGlobals.topLevelApplication.fontArr[fontCounter];
if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Arial") {
fontLib = evt.target.applicationDomain.getDefinition("fontArial") as Class;
//Font.registerFont(fontLib.Arial_2);
Font.registerFont(fontLib._Arial);
Font.registerFont(fontLib._Arial_bold);
Font.registerFont(fontLib._Arial_italic);
Font.registerFont(fontLib._Arial_bolditalic);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "A Little Pot") {
fontLib = evt.target.applicationDomain.getDefinition("fontAlittlePot") as Class;
Font.registerFont(fontLib._Alittlepot);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Book Antiqua") {
fontLib = evt.target.applicationDomain.getDefinition("fontBookAntiqua") as Class;
//Font.registerFont(fontLib.Arial_2);
Font.registerFont(fontLib._BookAntiqua);
Font.registerFont(fontLib._BookAntiqua_bold);
Font.registerFont(fontLib._BookAntiqua_italic);
Font.registerFont(fontLib._BookAntiqua_bolditalic);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Fine Hand LET") {
fontLib = evt.target.applicationDomain.getDefinition("fontFineHand") as Class;
Font.registerFont(fontLib._FineHand);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "NewBskvll BT") {
fontLib = evt.target.applicationDomain.getDefinitionByName("fontNewBaskerVille") as Class;
Font.registerFont(fontLib._NewBaskervilleBt);
Font.registerFont(fontLib._NewBaskervilleBt_bold);
Font.registerFont(fontLib._NewBaskervilleBt_italic);
Font.registerFont(fontLib._NewBaskervilleBt_bolditalic);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Segoe Print") {
fontLib = evt.target.applicationDomain.getDefinition("fontSegoePrint") as Class;
Font.registerFont(fontLib._SegoePrint);
Font.registerFont(fontLib._SegoePrint_bold);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "SF Burlington Script SC") {
fontLib = evt.target.applicationDomain.getDefinition("fontSFBurlingtonScriptSC") as Class;
Font.registerFont(fontLib._SFBurlingtonScriptSC);
Font.registerFont(fontLib._SFBurlingtonScriptSC_bold);
Font.registerFont(fontLib._SFBurlingtonScriptSC_italic);
Font.registerFont(fontLib._SFBurlingtonScriptSC_bolditalic);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Pica") {
fontLib = evt.target.applicationDomain.getDefinition("fontPica") as Class;
Font.registerFont(fontLib._Pica);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Signature") {
fontLib = evt.target.applicationDomain.getDefinition("fontSignature") as Class;
Font.registerFont(fontLib._Signature);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Verdana") {
fontLib = evt.target.applicationDomain.getDefinition("fontVerdana") as Class;
Font.registerFont(fontLib._Verdana);
Font.registerFont(fontLib._Verdana_bold);
Font.registerFont(fontLib._Verdana_italic);
Font.registerFont(fontLib._Verdana_bolditalic);
Font.enumerateFonts();
} else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "SFBurlingtonScript") {
fontLib = evt.target.applicationDomain.getDefinition("fontSFBurlingtonScript") as Class;
Font.registerFont(fontLib._SFBurlingtonScript);
Font.registerFont(fontLib._SFBurlingtonScript_bold);
Font.registerFont(fontLib._SFBurlingtonScript_italic);
Font.registerFont(fontLib._SFBurlingtonScript_bolditalic);
Font.enumerateFonts();
else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Paper Cuts") {
fontLib = evt.target.applicationDomain.getDefinition("fontPapercuts") as Class;
Font.registerFont(fontLib._Papercuts);
Font.enumerateFonts();
else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Sansation") {
fontLib = evt.target.applicationDomain.getDefinition("fontSansation") as Class;
Font.registerFont(fontLib._Sansation);
Font.registerFont(fontLib._Sansation_bold);
Font.enumerateFonts();
else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Times New Roman") {
fontLib = evt.target.applicationDomain.getDefinition("fontTimes") as Class;
Font.registerFont(fontLib._Times);
Font.registerFont(fontLib._Times_bold);
Font.registerFont(fontLib._Times_italic);
Font.registerFont(fontLib._Times_bolditalic);
Font.enumerateFonts();
else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "Handserif") {
fontLib = evt.target.applicationDomain.getDefinition("fontHanSrf") as Class;
Font.registerFont(fontLib._Handserif);
Font.enumerateFonts();
else if(FlexGlobals.topLevelApplication.fontArr[fontCounter].label == "WC RoughTrad") {
fontLib = evt.target.applicationDomain.getDefinition("fontWCRoughTrad") as Class;
Font.registerFont(fontLib._WCRoughTrad);
Font.enumerateFonts();
//var xmlNode:XML = new XML("<font name='"+ FlexGlobals.topLevelApplication.fontArr[fontCounter].label +"' load='true'/>")
//FlexGlobals.topLevelApplication.fontLoadStatusXML.appendChild(xmlNode);
if(fontCounter < totalFonts-1) {
fontCounter++;
//FlexGlobals.topLevelApplication.taSetText.text += "\nloading "+ FlexGlobals.topLevelApplication.fontArr[fontCounter].label;
this.loadFont(FlexGlobals.topLevelApplication.fontArr[fontCounter].path);
It is working in flex 3 but not working in flex 4 .. Need help ..
Regards
MohitHi Flex harUI
can u elaborate a bit more regarding . i didnt understand .actually i am using richeditable text area instead of textarea . this is the only difference apart from flex 3 and flex 4.
Regards
Mohit Verma -
my itunes will not open! is giving me error7(windows error 1114) RUNING TIME ERROR, PROGRAM FILES\ITUNESHELPER.EXE R6034 An application has made an attempt to load the C runtime library incorrectly. I must contact the application support team for imformation and i tried downloading itunes like 10 times and is saying the same thing. Please help! i need to sync my ipads and ipods thank you!
Follow the instructions of tt2 given in https://discussions.apple.com/thread/5822086
-
Just did the iTunes update that iTunes said was available, now iTunes won't open. I just keep getting a Runtime Error message.
R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the apps support team for more info.
Is anyone else having this problem?
I tried to re-install and got the following message: iTunes was not installed correctly. Please reinstall iTunes. Error 7 (Windows error 1114)
Does this mean I have now lost everything?I just had the same error:
R6034
An application has made an attempt to load the C runtime library incorrectly. Please contact the apps support team for more info.
I went to http://support.apple.com/kb/ht1925 and did a complete removal and reinstallation of iTunes. You MUST follow the directions here exactly...it's more than just iTunes that must be removed, and it MUST be done in the order in which the support article says. I followed the exact instructions, and iTunes is back on my machine (no more C runtime error) and you do NOT lose your music...it's all in my library, as it was before.
Good luck! -
I tried downloading the new update for my desktop PC I get the following error messages:
Visual C++ Runtime library
R6034
an application has made an attempt to load the C runtime library incorrectly Error 7 Windows Error 1114Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
(99907) -
How can I fix the Runtime Error R6034 so that I can correctly install iTunes on my PC ? I get a notice that states ' An application has made an attempt to load the C runtime library incorrectly - Please contact the application's support team for more info
Hey Debbiered1,
Follow the steps in this link to resolve the issue:
iTunes 11.1.4 for Windows: Unable to install or open
http://support.apple.com/kb/TS5376
When you uninstall, the items you uninstall and the order in which you do so are particularly important:
Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer:
iTunes
Apple Software Update
Apple Mobile Device Support
Bonjour
Apple Application Support (iTunes 9 or later)
Important: Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects.
Let us know if following that article and uninstalling those components in that order helped the situation.
Welcome to Apple Support Communities!
Take care,
Delgadoh -
DOwnload finished but got X RedCircle Runtime Error!
PROGRAM: C:\Program Files(x86)\iTunes\iTunes.exe
R6034
An application has made an attempt to load the C runtime library incorrectly. Need Support Team to give Resolution to me and others?
I have downloaded M/S approved software to correct runtime errors but cannot get iTunes to run again to upgrade ITunes
and Backup and Sync Iphone, Ipad, IPod Touch. Pleaase can you advise what to do next.
I am concerned about my Library of music as unable to access or protect music as downloads are not CDs to redo if "My Music\I Tunes is lost or corrupted?
Help is appreciated Thanx.Hi Aspden37,
If you are having issues with iTunes after an attempted update, you may find the following article helpful:
iTunes 11.1.4 for Windows: Unable to install or open
http://support.apple.com/kb/TS5376
Regards,
- Brenden -
When I finished backing up my iphone 5 to my hp pavilion laptop I got an error message R6034. Itunes shut down and I have not been able to reinstall it. The error message says an application has made an attempt to load the C runtime library incorrectly. My computer is more than 5 years old and I have never had this problem before. I tried unsuccessfully to reinstall itunes. Any ideas?
bdaumenHello iTunes_Bad_Update,
The following article provides information and troubleshooting steps that can help get iTunes back up and running.
iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
http://support.apple.com/kb/TS1717
Cheers,
Allen -
The other day I was prompted to update itunes. I started to, and it crashed my itunes. Then I tried to uninstall itunes, so that I could turn around and re-install it again. Now I can not install itunes. I get Runtime Error! message. R6034. For the last two hours I have tried deleting itunes, moving the .dll files to the desktop, restarting the computer (more times than I can count), deleting the temp files, updating my internet explorer, using the fix it program,.....
The two messages that I am getting are:
Runtime Error! Program:c\Program Files (x86)\itunes\Tunes.exe R6034 An application has made an attempt to load the c runtime library incorrectly. Please contact the application's support team for more information.
Also: Service to 'Apple Mobile Device' (Apple Moblie Device) failed to start. Verify that you have sufficient priviledges to start system services.I too was getting the same message regarding R6034. After many frustrating hours I went to the iTunes support page and clicked on "install and update." When that page came up I scrolled on to "removing and reinstalling iTunes......" There they tell you what files need to be removed and what order to do it in so you can reinstall iTunes. My iTunes works now and I didn't lose any music.
About the Apple Mobile Device, well that's one of the files that has to be uninstalled. When you reinstall iTunes the Apple Mobile Device is automatically reinstalled.
Hope this works for you as it did for me. Warning: it takes about an hour to do all this. -
Font embedding for TLF in flex4
Hi - We are in the situation where in embedded fonts are not working for TLF. We embed the fonts in the css file with embedAsCFF as false. It shows the fonts fine in the mx combobox component but not in TLF.
We tried to do a AS way of embeding font as below in the initial mxml, so that it gets available when textregion is created dynamically.
[Embed(source="/assets/fonts/font1.ttf", mimeType="application/x-font-truetype", fontName="CrownRoman",
embedAsCFF="true")]
public static const font1:Class;
and Font.registerFont(font1);
But this is not helping either. Fonts are not getting embedded.
I tried to use(as explained in one of the solutions in the internet)
var uic:UIComponent = UIComponent(FlexGlobals.topLevelApplication);
textFlow.flowComposer.swfContext = ISWFContext(uic.getFontContext(textLayoutFormat.fontFamily, false, false, true));
but it gives me complier error "Attempted access of inaccessible method getFontContext through a reference with static type mx.core:UIComponent"
Pls help me in solving this. Its very critical. Any help is appreciated. Can anyone share some example.
Let me know if you need more details.Add import mx.core.mx_internal at the END of your imports
then call getFontContext like this: mx_internal::getFontContext(textLayoutFormat.fontFamily, false, false, true); -
Microsoft Visual C++ Runtime Library Runtime Error! Program: C:\Program Files (x86)\iTunes\iTunes.exe R6034 An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Program Files (x86)...
R6034
An application has made an attempt to load the C runtime library incorrectly.
Please contact the application's support team for more information.
OKClick here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components; this won't normally affect its library, but that should be backed up anyway.
(99146) -
I did an auto-update on itunes today and now itunes is unresponsive..it gives this error "An application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information."
Wouldn't apple check before releasing new version, I see so many people with same issue..its such a waste of time for everyone now to fix it.
Is there any other way to fix before I try to un-install everything and re-install back?Hello iTunes_Bad_Update,
The following article provides information and troubleshooting steps that can help get iTunes back up and running.
iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
http://support.apple.com/kb/TS1717
Cheers,
Allen -
I can't download the itunes on my PC , have it before but now appear a note like this:
RUNTIME ERROR
PROGRAM C;/PROGRAM FILES (X86)/ ITUNES/ITUNES.EXE
R6034
AN APPLICATION HAS MADE AN ATTEMPT TO LOAD THE C RUNTIME LIBRARY INCORRECTLY
PLEASE CONTACT THE APPLICATION SUPPORT TEAM FOR MORE INFORMATION
WHAT I NEED TO DO?
THANK YOU
RODRIGOClick here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
(99467) -
When I try to install the update for iTunes, I keep getting the message "the application attempted to load the C runtime library incorrectly. Contact the vendor. I don't know if it's related, but my Microsoft Outlook is totally f*k up. What's going on?
Hey I finally got an older vesion of itunes to work!!! 10.7 x64 for windows 7
After uninstalling all apple products even quicktime
I had to delete everything from (program files, and program files x64, program data,)
And all downloads from apple, and I went in to search deleted other stuff from apple, and itunes
But definently not my itunes library and Playlist
Down loaded 10.7 x64 for windows 7, but checked (do not start when done)
Then I emptied my recycling bin and restarted my PC
I ran geek tech tool box same as reg cure pro, also PC Tools registry cleaner, and CC Cleaner
Then I emptied my recycling bin and restarted my PC
And wallah... It finally works, and I Love the older version anyways.
Easier to download and transfer music!!!!!
Maybe you are looking for
-
Pop Ad tabs include ad, when I close it asks if I'm sure I want to leave the page. I say yes and then there is another survey ad that says I may have won something. This whole process requires at least 4 denials before I can get the page to close. Pe
-
I have Firefox for U3 on my Verbatim stick to run on whatever computer I happen to be using. Lately every time I try to open F'fox a window comes up saying "Firefox is installing your updates and will start in a few moments." The status bar indicates
-
Different No. Ranges for the GR in one client.
The rquirement is as follows: We have two different company codes in one client . These two company codes have their respective plants assigned to it. The GR No. range should be different for different plants as this is the requirement for the client
-
IPhone 3G- I'm so frustrated- please help!
I was super excited about this new phone and purchased my new 3G on the 20th and have been on a roller coaster of emotions ever since. On one hand I'm impressed with cool apps such as "Shazam" that allows me to capture which song just played on the r
-
Not able to sync it stops abruptly
i am not able to sync after connecting to i tune it stops abruptly