Embedding a font in a DX widget
. . or any other file type
Wednesday, June 6, 2007 by ZubaZ | Discussion: DesktopX

I don't know why they hate me though.
I think they must. (I know RomanDA does but we're old friends so I'm ok with his hate.)How do I know they hate me? Because they make me install fonts packaged in the zip instead of doing the work for me when they build the widget. You see, you can embed any filetype inside the widget and then reference that file. You can embed fonts, or pdfs (as a help file), or a batch file, or whatever. I have two widgets I made for flash games. But here's the deal, they were both on-line games and I wanted them to be able to run locally with a cool-as-hell interface. So I grab a frame object, slap a web browser activeX object, download the swf files and embed it in the activeX object. Ta-da! I have a game I can take with me wherever I go. I can pass it around to my friends and family (with permission of course). No internet access needed!
Brad wrote a pretty good tutorial and put it in the DX on-line documentation. It was kinda hidden away there so here is a direct link.
Stop being haters and embed the fonts.
*Make sure the font license permits you to redistribute it. In the case of DesktopX, the font WON'T be installed into other machines, but it will just loaded at runtime when the object or widget is loaded. This usually permitted by most font licenses.
Reply #2 Wednesday, June 6, 2007 10:27 PM
Sounds interesting. I could be more interested in this if I could find this direct link you mention to read more about this. And, if I had an example with some more meat in it, that would really help.
Reply #4 Wednesday, June 6, 2007 11:32 PM
This widget has the font I mentioned above; it's my handwriting so you can't have it installed previously.

Reply #5 Thursday, June 7, 2007 12:19 AM
I think I understand the steps involved here, but what do you mean by embed it in the activeX object? Link the .swf file to the activeX object the same as the font file is embedded in the documentation example? I think this is what you mean. If this is right, I have to give this a try. Thanks.
Reply #6 Thursday, June 7, 2007 1:01 AM
Here is the script I use for one of my swf players:
- 'Called when the script is executed
- Sub Object_OnScriptEnter
- Set objFSO = CreateObject("Scripting.FileSystemObject")
- If objFSO.FileExists(workFolder & "bloodmobile.swf") = False Then
- objFSO.CopyFile Object.Directory & "bloodmobile.swf", workFolder & "virtual-bubblewrap-distv1.1.swf"
- End If
- Control.Navigate2 Object.Directory & "bloodmobile.swf"
- End Sub
- 'Called when the script is terminated
- Sub Object_OnScriptExit
- End Sub
I have no idea at this point where I got the code from or what I was doing with the virtual bubble wrap swf [Fun objects though - couldn't get permission to redistribute]. It was all cut and paste and trial and error until I got SOMETHING to work.
I think it'll work with just the Control.Navigate2 Object.Directory & "bloodmobile.swf"
Reply #8 Thursday, June 7, 2007 7:35 AM
You always steal my thunder... new DX Tutorial King
Reply #9 Thursday, June 7, 2007 7:41 AM
So can you make the code snippet better and make me look bad? That would be great!
Reply #10 Thursday, June 7, 2007 8:01 AM
I have had problems with embedded fonts not working 100% of the time. So when i make a gadget (for sale) i make a SETUP.exe file using a free program called Inno Setup that allows you to install fonts, programs, etc. It works great.
Reply #11 Thursday, June 7, 2007 9:36 AM
I think some fonts got come protection data in it that will prevent apps from embedding it.
Reply #13 Thursday, June 7, 2007 3:22 PM
Reply #14 Friday, June 8, 2007 2:04 AM
Reply #15 Tuesday, June 3, 2008 11:13 PM
Reply #16 Tuesday, June 3, 2008 11:16 PM
Reply #17 Tuesday, June 3, 2008 11:34 PM
I think that if you add it in one object it's stored in cache and other objects can use it . . but I'm not sure. Sorry.
Reply #18 Wednesday, June 4, 2008 11:31 AM
If that is true, I can embed it into one button, then all the buttons can use it from there? I will investigate this further. Thanx!
Reply #19 Wednesday, June 4, 2008 11:46 AM
Reply #20 Wednesday, June 4, 2008 4:11 PM
Awesome! Thanx, milksama and Zubaz!
Hey, while we're at it, can we make text to be click through? Just a question while I am waiting for a reply to a PM for Romanda.
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!








Reply #1 Wednesday, June 6, 2007 9:53 PM