View Full Version : Help me please.... Install fonts automatically when CD is just start.
scliem
09-23-2006, 09:54 AM
I'm doing an assignment that using autoplay media studio 6 now. In that assignment, I put some extra fonts that I download from the internet. To make sure my project can run and work properly in every one computer, hence I put all of these fonts into my CD.
My problem is,
How to make my CD can auto install all of these fonts when my project at Preload state? What the source code that I should put?
I read the help file and try many times already but still not successfull..
Hope some one can help to solve my problem, thanks!
Here is an example for Dungeon font:
result = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", "Dungeon (TrueType)", true);
if result=="" then
result = System.GetUserInfo();
if result.IsAdmin==true then
File.Copy(_SourceFolder.."\\dungeon.ttf", Shell.GetFolder(SHF_FONTS), true, false, false, true, nil);
System.RegisterFont(Shell.GetFolder(SHF_FONTS).."\\Dungeon.ttf", "Dungeon (TrueType)", true);
end
end
Unzip the attachment and put the .ttf file in the cd root to test it.
scliem
09-24-2006, 12:04 AM
I get it already, thanks!!
scliem
09-24-2006, 04:19 AM
Sorry, here got a problem again..
After I apply this code to preload page:
--get the destination directory (in this case, where the fonts are stored)
fonts_dir = Shell.GetFolder(SHF_FONTS);
--copy the file from your cd to the user's font directory
File.Copy("AutoPlay\\Docs\\HDZB_5.TTF", fonts_dir .. "\\HDZB_5.TTF", false, true, false, true, nil);
--register the font with windows
System.RegisterFont(fonts_dir .. "\\HDZB_5.TTF", "HDZB_5", true);
--copy the file from your cd to the user's font directory
File.Copy("AutoPlay\\Docs\\HDZB_27.TTF", fonts_dir .. "\\HDZB_27.TTF", false, true, false, true, nil);
--register the font with windows
System.RegisterFont(fonts_dir .. "\\HDZB_27.TTF", "HDZB_27", true);
When the CD is started, all of the fonts are copy to windows fonts folder, but..
It can't view the fonts of my project! I don't know what happen, just success half part only.
Can you answer me again?
Thanks!!
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.