Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Usman Safdar
  Where is Usman Safdar?
 TS
 Pakistan
 Usman Safdar
 To: Ammar Hadi
  Where is Ammar Hadi?
 Al-Samawah
 Iraq
 Ammar Hadi
 Tags
Subject: RE: Font Embedding in exe
Thread ID: 228779 Message ID: 228898 # Views: 1 # Ratings: 0
Version: Visual FoxPro 7 Category: Distribution and InstallShield
Date: Friday, May 22, 2009 1:01:57 PM         
   


> > Sir, I have a font (Arial_special.ttf) and i have designed my forms in it. But i dont want to distribute it like a normal way (getting installed in Fonts Dir) bcoz some one can easily copy from this location. Is there any way to embed this font in my exe file?? Microsoft Weft do this for web pages by embedding the *.ttf font in *.eot format. Any Sol Plzzz.
> >
> > Regardz
>
> Hi Usman,
>
> I have a suggestion for you.
> First I usually have a table that I include with the exe (you include files by right clicking on them in the project manager and selecting include). This table I use it to save some files like an empty set of the free tables that form my database or some some reports that I want to replace them if they get corrupted.
> so the main structure of that table let it be like this:
>
> mytable (describe m, f_name c(250), myfile m NOCPTRANS)
>
> Save your font during design time in this table like this:
>
>
> insert into mytable values("MYFONT", "Arial_special.ttf",;
>  filetostr("c:\......\Arial_special.ttf")) && the complete path to the font file
> 

>
> Then at the begining of your main program after you opened your tables including myTable, before calling forms:
>
>
> PUBLIC gcFontName
> LOCAL lcFontsFolder
> 
> ON SHUTDOWN DO my_shutdown_routine && see below
> 
> loWSHShell = CREATEOBJECT("WScript.Shell")
> lcFontsFolder=loWSHShell.SpecialFolders("FONTS")
> 
> SELECT mytable
> LOCATE FOR UPPER(ALLTRIM(mytable.describe))="MYFONT"
> gcFontName=ADDBS(lcFontsFolder)+alltrim(mytable.f_name)
> IF !FILE(gcFontName,1)
>   STRTOFILE(mytable.myFile, gcFontName)
> ENDIF
> 

>
> this way you put the font in the fonts folder at run-time.
>
> Now at the end of the app. you can delete this font file by issuing the delete in the shutdown routine.
>
>
> PROCEDURE my_shutdown_routine  && you can put it in the main program
>   LOCAL lcSet
>   lcSet=SET("SAFETY")
>   SET SAFETY OFF
>   CLOSE DATABASES ALL && usually
>   CLOSE TABLES ALL  && usually
>   IF FILE(gcFontName,1)
>     DELETE FILE (gcFontName) && Delete the font file
>   ENDIF
>   SET SAFETY &lcSet
> 
>   QUIT
> ENDPROC
> 

>
> Hope this helps
>
> Ammar Hadi ................IRAQ
>
> My Foxite Weblog
>
> ---------------
> I I I really love foxite
> ___________________________
Thanks Ammar n Koen for replying. i understood Ammar's theme to sum extent. Anywayz i try this out.

Regardz

ENTIRE THREAD

Font Embedding in exe Posted by Usman Safdar @ 5/21/2009 3:15:21 PM
RE: Font Embedding in exe Posted by Koen Piller @ 5/21/2009 6:37:07 PM
RE: Font Embedding in exe Posted by Ammar Hadi @ 5/21/2009 11:46:10 PM
RE: Font Embedding in exe Posted by Usman Safdar @ 5/22/2009 1:01:57 PM
RE: Font Embedding in exe Posted by Tom Saddul @ 5/23/2009 5:51:34 AM
RE: Font Embedding in exe Posted by Ammar Hadi @ 5/23/2009 6:17:45 AM
RE: Font Embedding in exe Posted by Usman Safdar @ 5/25/2009 2:52:34 PM
RE: Font Embedding in exe Posted by Ammar Hadi @ 5/25/2009 6:27:06 PM
RE: Font Embedding in exe Posted by Usman Safdar @ 5/27/2009 12:09:37 PM
RE: Font Embedding in exe Posted by Ammar Hadi @ 5/27/2009 1:39:32 PM
RE: Font Embedding in exe Posted by Usman Safdar @ 6/2/2009 1:49:32 PM
RE: Font Embedding in exe Posted by Usman Safdar @ 6/4/2009 12:10:27 PM
RE: Font Embedding in exe Posted by Tom Saddul @ 5/27/2009 3:57:38 AM