반응형
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
// 콜백 함수
function EnumFamToLines(lplf: PLOGFONT; lpntm: PNEWTEXTMETRIC;
FontType: DWORD; Lines: LPARAM): Integer; stdcall;
begin
// 아래는 한글문자세트의 가변 피치(variable pitch)의 폰트를 열거합니다
// 또한 고정 피치인지 조사하려면 lfPitchAndFamily 의 하위 4 비트를
// 조사하면 됩니다
// FIXED_PITCH 1 (고정 피치)
// VARIABLE_PITCH 2 (가변 피치)
// 기타 다른 상수는 rtlwinwindows.pas 를 참고해 보세요
with lplf^ do
if (lfCharSet = HANGEUL_CHARSET) and (lfPitchAndFamily and $0F = VARIABLE_PITCH) then
TStrings(Lines).Add(lplf.lfFaceName);
Result := 1;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Clear;
EnumFontFamilies(Canvas.Handle, nil, @EnumFamToLines, LongInt(Memo1.Lines));
end;
end.
반응형