Delphi-Quellcode:
function EnumFontSizes(var EnumLogFont: TEnumLogFont; PTextMetric: PNewTextMetric; FontType: Integer; Data: LPARAM): Integer; export; stdcall;
var s: String;
i,v,v2: Integer;
fd: TMyFontDialog;
begin
fd := Pointer(Data);
if (FontType and TRUETYPE_FONTTYPE)<>0 then begin
fd.lbGrad.Items.Add('8');
fd.lbGrad.Items.Add('9');
fd.lbGrad.Items.Add('10');
fd.lbGrad.Items.Add('11');
fd.lbGrad.Items.Add('12');
fd.lbGrad.Items.Add('14');
fd.lbGrad.Items.Add('16');
fd.lbGrad.Items.Add('18');
fd.lbGrad.Items.Add('20');
fd.lbGrad.Items.Add('22');
fd.lbGrad.Items.Add('24');
fd.lbGrad.Items.Add('26');
fd.lbGrad.Items.Add('28');
fd.lbGrad.Items.Add('36');
fd.lbGrad.Items.Add('48');
fd.lbGrad.Items.Add('72');
Result := 0;
end
else begin
v := Round((EnumLogFont.elfLogFont.lfHeight-PTextMetric.tmInternalLeading)*72 /
fd.PixelsPerInch);
s := IntToStr(v);
Result := 1;
for i := 0 to fd.lbGrad.Items.Count-1 do begin
v2 := StrToInt(fd.lbGrad.Items[i]);
if v2=v then
exit;
if v2>v then begin
fd.lbGrad.Items.Insert(i,s);
exit;
end;
end;
fd.lbGrad.Items.Add(s);
end;
end;
Thx to Sergey Tkachenko (
www.trichview.com) und marabu