Evo dela koda:
Recimo, moj font file se zvao "mssscyu1.fnt" a ime fonta je MS Sans Serif CYU1
Code:
procedure TMain.FormCreate(Sender: TObject);
begin
// Instaliraj font runtime
sPath := ExtractFilePath (ParamStr(0));
iFontLoaded := AddFontResource (PChar(sPath + 'mssscyu1.fnt'));
if iFontLoaded > 0 then begin
SendMessage(
HWND_BROADCAST, // handle of destination window
WM_FONTCHANGE, // message to send
0, // first message parameter
0 // second message parameter
);
Font.Name := 'MS Sans Serif CYU1';
end;
....
end;
ZATIM IDE TVOJ CODE
a zatim:
Code:
procedure TMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
if iFontLoaded > 0 then
RemoveFontResource (PChar(sPath + 'mssscyu1.fnt'));
end;
Goran Pilipović fka bluesman