From 74bfea219da3b719ae61b445fc04c40948e2bca4 Mon Sep 17 00:00:00 2001 From: graemeg Date: Sat, 11 Aug 2007 14:45:24 +0000 Subject: * Implemented fpgApplicatio.GetFontfaceList (GDI untested) --- src/corelib/gdi/gfx_gdi.pas | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/corelib/gdi') diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index ee92b156..44923000 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -168,6 +168,7 @@ type FFocusedWindow: THANDLE; LastClickWindow: TfpgWinHandle; // double click generation LastWinClickTime: longword; + function DoGetFontFaceList: TStringList; override; public constructor Create(const aparams: string); override; function DoMessagesPending: boolean; @@ -713,6 +714,31 @@ end; { TfpgApplicationImpl } +function TfpgApplicationImpl.DoGetFontFaceList: TStringList; + //------ + function MyFontEnumerator(var LogFont: ENUMLOGFONTEX; var TextMetric: NEWTEXTMETRICEX; + FontType: Integer; data: LPARAM): Integer; stdcall; + var + sl: TStringList; + s: string; + begin + sl := TStringList(data); + s := LogFont.elfLogFont.lfFaceName; + if ((sl.Count = 0) or (sl.Strings[sl.Count-1] <> s)) then + sl.Add(s); + Result := 1; + end; + +var + LFont: TLogFont; +begin + Result := TStringList.Create; + FillChar(LFont, sizeof(LFont), 0); + LFont.lfCharset := DEFAULT_CHARSET; + EnumFontFamiliesEx(Display, @LFont, @MyFontEnumerator, LongInt(result), 0); + Result.Sort; +end; + constructor TfpgApplicationImpl.Create(const aparams: string); begin FIsInitialized := False; -- cgit v1.2.3-70-g09d2