Embedding a font in a DX widget

. . or any other file type

Wednesday, June 6, 2007 by ZubaZ | Discussion: DesktopX

I love DX; think it's the greatest thing since sliced bread.  I think that the work of the coders that hang out in th forums is above average; every single one of them. 

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.
First Previous Page 1 of 2 Next Last
Bichur
Reply #1 Wednesday, June 6, 2007 9:53 PM
/bichur takes notes...
BigDogBigFeet
Reply #2 Wednesday, June 6, 2007 10:27 PM
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.


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.
ZubaZ
Reply #3 Wednesday, June 6, 2007 10:59 PM

Updated with link.  Sorry.    

 

ZubaZ
Reply #4 Wednesday, June 6, 2007 11:32 PM
And now with a link to my second DX Widget: Browser Central

This widget has the font I mentioned above; it's my handwriting so you can't have it installed previously. 
BigDogBigFeet
Reply #5 Thursday, June 7, 2007 12:19 AM
download the swf files and embed it in the activeX object


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.  
ZubaZ
Reply #6 Thursday, June 7, 2007 1:01 AM
BDBF,

Here is the script I use for one of my swf players:

Code: vbscript
  1. 'Called when the script is executed
  2. Sub Object_OnScriptEnter
  3. Set objFSO = CreateObject("Scripting.FileSystemObject")
  4. If objFSO.FileExists(workFolder & "bloodmobile.swf") = False Then
  5. objFSO.CopyFile Object.Directory & "bloodmobile.swf", workFolder & "virtual-bubblewrap-distv1.1.swf"
  6. End If
  7. Control.Navigate2 Object.Directory & "bloodmobile.swf"
  8. End Sub
  9. 'Called when the script is terminated
  10. Sub Object_OnScriptExit
  11. 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"

Quentin94
Reply #7 Thursday, June 7, 2007 6:32 AM
i don't hate you
thanks Zubaz
RomanDA
Reply #8 Thursday, June 7, 2007 7:35 AM
Well i do hate you.. LOL
You always steal my thunder... new DX Tutorial King
ZubaZ
Reply #9 Thursday, June 7, 2007 7:41 AM
Well i do hate you.. LOL

So can you make the code snippet better and make me look bad?  That would be great!
RomanDA
Reply #10 Thursday, June 7, 2007 8:01 AM
no, its good. there are other FLASH Widgets out there so im sure people can find ways of doing it.

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.
thomassen
Reply #11 Thursday, June 7, 2007 9:36 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.


I think some fonts got come protection data in it that will prevent apps from embedding it.
ZubaZ
Reply #12 Thursday, June 7, 2007 10:10 AM
I have never heard that. Interesting.
ZubaZ
Reply #13 Thursday, June 7, 2007 3:22 PM
This would be an interesting game to embed: Starcraft Flash
Fairyy~
Reply #14 Friday, June 8, 2007 2:04 AM
I have always embedded all fonts in DX since Zubaz showed me how to do this long ago. One point to keep in mind is also to check the size of the " Fancy " font you might be using . The average font is 50 kbs and under but some of the fancy fonts can be 500kbs+ and cause the file to be a lot bigger than you would want. If you use a few fonts in a DX Theme it can add up.
PuterDudeJim
Reply #15 Tuesday, June 3, 2008 11:13 PM
Learning here....Thanx Zubaz! That will fix some problems I have been having recently. All I have to do is add the font to the custom files tab?
PuterDudeJim
Reply #16 Tuesday, June 3, 2008 11:16 PM
Will this work for DX themes, not just widgets and objects? Do I need to embed the font into every object that uses it? In most DX themes, that would mean embedding it into twenty or more objects?
ZubaZ
Reply #17 Tuesday, June 3, 2008 11:34 PM
Glad I could teach you something Jim.  Everything else DX related you do better than me. 

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.

PuterDudeJim
Reply #18 Wednesday, June 4, 2008 11:31 AM
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.


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!
ZubaZ
Reply #19 Wednesday, June 4, 2008 11:46 AM
if you add it in one object it's stored in cache and other objects can use it
Confirmed with SD support.  Thanks Milksama!
PuterDudeJim
Reply #20 Wednesday, June 4, 2008 4:11 PM
Confirmed with SD support. Thanks Milksama!


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!



web-wc01