In order to create a font picker I need to get the list of fonts available to Firemonkey.
As Screen.Fonts doesn’t exist in FireMonkey I thought I’d need to use FMX.Platform ?
eg:
if TPlatformServices.Current.SupportsPlatformService(IFMXSystemFontService, IInterface(FontSvc)) then
begin
edit1.Text:= FontSvc.GetDefaultFontFamilyName;
end
else
edit1.Text:= DefaultFontFamily;
However, the only function available is to return the default Font name.
At the moment I’m not bothered about cross-platform support but if I’m going to move to Firemonkey I’d rather not rely on Windows calls where possible.
The cross platform solution should use the MacApi.AppKit and Windows.Winapi together in conditional defines.
First Add these code to your uses clause:
Then add this code to your implementation:
Now you can use CollectFonts procedure. Don’t forget to pass a non-nil TStringlist to the procedure.A typical usage may be like this.