|
|||
|
hello....
i'm using swfkit pro 3.1 to convert my swfs to exes but i'm having trouble with font setting on the app... i was trying to put my own custom fonts on the exe but it doesnt seems to load if the remote computer doesnt have the fonts installed in their systems... i already tried to include the fonts under the Windows --> Fonts (inside swfkit) but the fonts doesnt seems to load.... is there any solution to this maybe a script or something.... thanks |
|
|||
|
The files under "Windows" only work for installers. That is, the files are only packed into the installers. However, there is a way to load a font at runtime so that you need not an installer:
1. in the "initialize" script load the font 2. in the "initialize" script handle the onClose method of the main window to remove the font Code:
dllimport "gdi32.dll" stdcall int AddFontResourceA(String) as AddFontResource;
dllimport "gdi32.dll" stdcall int RemoveFontResourceA(String) as RemoveFontResource;
trace(AddFontResource);
trace(RemoveFontResource);
var fontfile = "c:\\myfont.ttf";
AddFontResource(fontfile);
getMainWnd().onClose() = function () {
RemoveFontResource(fontfile);
}
|
|
|||
|
Sure, add the font files into the "Resources" panel. In the "initialize" script to copy them into the temporary folder
Code:
var fonts = ["font1.ttf", "font2.ttf", "font3.ttf"];
for (var i = 0; i < fonts.length; i++) {
var src = getAdditionalFile(fonts[i]);
var dest = Shell.getSpecialFolder("temp") + "\\" + fonts[i];
(new File(src)).copy(dest);
AddFontResource(dest);
}
getMainWnd().onClose() = function () {
for (var i = 0; i < fonts.length; i++) {
var dest = Shell.getSpecialFolder("temp") + "\\" + fonts[i];
RemoveFontResource(dest);
}
}
|
|
|||
|
it doesnt work...can you tell me where have i done wrong
in the resource panel [img width=700 height=189]http://h1.ripway.com/ptemondous/swf/resource.JPG[/img] and in the initialize script [img width=700 height=370]http://h1.ripway.com/ptemondous/swf/script.JPG[/img] |
|
|||
|
Just as another thought - do you need to embed the font on the user's own computer? How about embedding the font within Flash itself - when the swf is converted to an .exe by SWFKit that font will be fully available in your application.
__________________
:) |
|
|||
|
the code should be
Code:
getAdditionalFile();
dllimport "gdi32.dll" stdcall int AddFontResourceA(String) as AddFontResource;
dllimport "gdi32.dll" stdcall int RemoveFontResourceA(String) as RemoveFontResource;
var fonts = ["CODE2000.ttf", "BLEEDING_COWBOYS.ttf", "ALBUM-AVANTQUELOMBRE.ttf"];
for (var i = 0; i < fonts.length; i++) {
var src = getAdditionalFile(fonts[i]);
var dest = Shell.getSpecialFolder("temp") + "\\" + fonts[i];
(new File(src)).copy(dest);
AddFontResource(dest);
}
getMainWnd().onClose() = function () {
for (var i = 0; i < fonts.length; i++) {
var dest = Shell.getSpecialFolder("temp") + "\\" + fonts[i];
RemoveFontResource(dest);
}
}
return true;
|
|
|||
|
i found another problem.....after a certain launch the fonts not showing on the swf...is there any way to fix this issue??? cos i was just about to publish my exe but got delayed because of this....
thanks |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|