function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
FontType: Integer; Data: Pointer): Integer; stdcall;
begin
TStrings(Data).AddObject(LogFont.lfFaceName, Pointer(FontType and TRUETYPE_FONTTYPE <> 0));
Result := 1;
end;
---
function EnumFontsProc2(AFontLoader: TcxFontLoader; const ALogFont: TLogFont;
AFontType: DWORD): Integer;
var
AFaceName: string;
begin
AFaceName := ALogFont.lfFaceName;
if (AFontLoader.FontList.IndexOf(AFaceName) = -1) and
IsValidFontCondition(AFontLoader.FFontTypes, ALogFont, AFontType) then
begin
if ALogFont.lfCharSet = SYMBOL_CHARSET then
AFontType := AFontType or SYMBOL_FONTTYPE;
if ALogFont.lfPitchAndFamily = FIXED_PITCH then
AFontType := AFontType or FIXEDPITCH_FONTTYPE;
AFontLoader.FontList.AddObject(AFaceName, TObject(Integer(AFontType)));
end;
if AFontLoader.Terminated then
Result := 0
else
Result := 1;
end;
function EnumFontsProc1(var ALogFont: TLogFont;
var ATextMetric: TTextMetric; AFontType: DWORD;
AData: LPARAM): Integer; stdcall;
begin
Result := EnumFontsProc2(TcxFontLoader(AData), ALogFont, AFontType);
end;
---
function QRRTFEnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
FontType: Integer; Data: Pointer): Integer; stdcall;
var
S: TStrings;
Temp: string;
Family: integer;
begin
S := TStrings(Data);
Temp := LogFont.lfFaceName;
Family := LogFont.lfPitchAndFamily shr 4;
if (S.Count = 0) or (AnsiCompareText(S[S.Count-1], Temp) <> 0) then
S.AddObject(Temp, TObject(Family));
Result := 1;
end;
---
function EnumFontCharsets(var EnumLogFont: TEnumLogFontEx;
PTextMetric: PNewTextMetricEx; FontType: Integer; Data: LPARAM): Integer;
export; stdcall;
var s: String;
l,cs: Integer;
begin
Result := 1;
cs := EnumLogFont.elfLogFont.lfCharSet;
if cs<>MAC_CHARSET then begin
l := StrLen(EnumLogFont.elfScript);
SetLength(s,l);
Move(EnumLogFont.elfScript, PChar(s)^, l);
for l := 0 to TRVFontCharsetComboBox(Data).Items.Count-1 do begin
if Integer(TRVFontCharsetComboBox(Data).Items.Objects[l])=cs then
exit;
if AnsiCompareText(TRVFontCharsetComboBox(Data).Items[l],s)>0 then begin
TRVFontCharsetComboBox(Data).Items.InsertObject(l,s,TObject(cs));
exit;
end;
end;
TRVFontCharsetComboBox(Data).Items.AddObject(s, TObject(cs));
end;
end;
---
function EnumFontsProc(var ALogFont: TLogFont; var ATextMetric: TTextMetric;
AFontType: DWORD; AData: LPARAM): Integer; stdcall;
begin
if ALogFont.lfCharSet = SYMBOL_CHARSET then
AFontType := AFontType or SYMBOL_FONTTYPE;
if ALogFont.lfPitchAndFamily = FIXED_PITCH then
AFontType := AFontType or FIXEDPITCH_FONTTYPE;
FFontList.AddObject(ALogFont.lfFaceName, TObject(Integer(AFontType)));
Result := 0;
end;
---
|