also ich mache das so (registriert eine Font die in einer
DLL als Ressource liegt) temporär für die akteulle EXE ....
ist einfach rauskopiert, bitte den rest ergänzen ....
Delphi-Quellcode:
function AddFontFromRes(
handle : THandle;
const ResName: PChar) : THandle;
var
Res : TResourceStream;
ResFontCount : DWord;
Buffer : PChar;
Size : integer;
begin
Res := TResourceStream.Create(
handle, ResName, '
RT_FONT');
try
Size := Res.Size + 1;
Buffer := AllocMem(Size);
Res.
Read(Buffer^, Size);
finally
Res.Free;
end;
ResFontCount := 1;
Result := AddFontMemResourceEx(Buffer, Size,
nil, @ResFontCount);
FreeMem(Buffer, Size);
end;
var
fontHandle :
array of THandle;
fontNames :
array of string;
function RegisterFont(
handle : THandle; Typ,
Name : PChar; Parameter : integer) : Boolean;
stdcall;
begin
setlength(fontHandle, length(fontHandle)+1);
setlength(fontNames, length(fontNames)+1);
fontHandle[length(fontHandle)-1] := AddFontFromRes(
handle,
Name);
fontNames[length(fontNames)-1] :=
Name;
Result := TRUE;
end;
procedure RegisterResourceFonts(ressourceDLL : THandle);
begin
EnumResourceNames(ressourceDLL, '
RT_FONT', @RegisterFont, 0);
end;