denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Denemo-devel] Windows Font, API Call


From: denemo
Subject: [Denemo-devel] Windows Font, API Call
Date: Sun, 7 Feb 2010 00:33:19 +0100 (CET)

Hi.

I just stumbled upon this. Its unverified but could be nice to have. No
more trouble with fonts. Maybe this is even possible without
admin-rights.

I just included the Delphi example as it was written. Don't know if it
helps

Quote:

There's a windows API call "AddFontResource" (and a companion
"RemoveFontResource") which can temporarily enable a font from any
directory. Either should be followed with a WM_FONTCHANGE to all top
level windows to make the font immediately available.

Here's the Delphi thread that executes adding portable fonts in
geek.menu:

procedure TRegisterFontsThread.Execute;
var
srchRecord: TSearchRec;
baseDir: string;
begin
baseDir := ExtractFileDir(Application.ExeName) + '\Data\PortableFonts\';
if FindFirst(baseDir + '*.ttf',faAnyFile,srchRecord)=0 then
repeat
AddFontResource(pAnsiChar(baseDir + srchRecord.Name));
until FindNext(srchRecord)<>0;
FindClose(srchRecord);
sendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0 );
end;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]