PDA

View Full Version : با چه کدی میشه یک فوت را در پوشه فونت ویندوز نصب کرد(فوری)



hadavinia
دوشنبه 03 مرداد 1384, 21:37 عصر
لطفا راهنمایی کنید

Hamid_PaK
سه شنبه 04 مرداد 1384, 06:02 صبح
یه راهش اینه که خودت تو فولدر فونت ویندوز کپی کنی و بعد فولدر فونت رو تو Explorer بازش کنی بعد فونت نصب میشه ...

vcldeveloper
پنج شنبه 06 مرداد 1384, 01:47 صبح
procedure AddFont(FontFile : string);
var
DestFile : string;
FontDir : string;
begin
//Find Fonts directory
SetLength(FontDir,Max_Path);
GetWindowsDirectory(PAnsiChar(FontDir),Max_Path);
SetLength(FontDir, StrLen(PAnsiChar(FontDir)));
FontDir := FontDir + '\Fonts\';
//Copy font file to the Fonts directory
DestFile := FontDir + ExtractFileName(FontFile);
CopyFile(PAnsiChar(FontFile),PAnsiChar(DestFile),T rue);
//True-Type fonts need a header file to be created before adding them to system
if ExtractFileExt(FontFile) = '.ttf' then
//Create the header file (.fot)
CreateScalableFontResource(0,
PAnsiChar(Copy(DestFile,1,Length(DestFile) - 3) + 'fot'),
PAnsiChar(DestFile),
nil);
//Add font to system
AddFontResource(PAnsiChar(DestFile));
//Notify other windows about new font
SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
end;