summaryrefslogtreecommitdiff
path: root/src/corelib/x11/gfx_x11.pas
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-11 14:45:24 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-08-11 14:45:24 +0000
commit74bfea219da3b719ae61b445fc04c40948e2bca4 (patch)
treebfe016fa5a84e63b1214a3506d99df47f9d43692 /src/corelib/x11/gfx_x11.pas
parentebafc605dc3551b20ec7a8fd6f1d8f068222c86a (diff)
downloadfpGUI-74bfea219da3b719ae61b445fc04c40948e2bca4.tar.xz
* Implemented fpgApplicatio.GetFontfaceList (GDI untested)
Diffstat (limited to 'src/corelib/x11/gfx_x11.pas')
-rw-r--r--src/corelib/x11/gfx_x11.pas34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index 03f3c945..f11bfd38 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -181,6 +181,7 @@ type
InputContext: PXIC;
LastClickWindow: TfpgWinHandle; // double click generation
LastWinClickTime: longword;
+ function DoGetFontFaceList: TStringList; override;
public
constructor Create(const aparams: string); override;
destructor Destroy; override;
@@ -480,6 +481,39 @@ begin
SizeOf(FComposeBuffer) - 1, @Result, @FComposeStatus));
end;
+function TfpgApplicationImpl.DoGetFontFaceList: TStringList;
+var
+ pfs: PFcFontSet;
+ ppat: PPFcPattern;
+ n: integer;
+ s: string;
+ pc: PChar;
+ fl: TStringList;
+begin
+ pfs := XftListFonts(Display, DefaultScreen, [FC_SCALABLE, FcTypeBool, 1, 0, FC_FAMILY, 0]);
+
+ if pfs = nil then
+ Exit; //==>
+
+ Result := TStringList.Create;
+
+ GetMem(pc, 128);
+ n := 0;
+ ppat := pfs^.fonts;
+ while n < pfs^.nfont do
+ begin
+ XftNameUnparse(ppat^, pc, 127); //XftNameUnparse does not free the name string!
+ s := pc;
+ Result.Add(s);
+ inc(PChar(ppat), sizeof(pointer));
+ inc(n);
+ end;
+ FreeMem(pc);
+ FcFontSetDestroy(pfs);
+
+ Result.Sort;
+end;
+
constructor TfpgApplicationImpl.Create(const aparams: string);
var
wa: TXWindowAttributes;