Is there a way to get a list of installed fonts to populate a combobox in FMX?
Google AI suggests TFont.GetFamilies but that seems to be a hallucination.
I see that TMS have a ready made font combobox, but that’s not in my price range.
Another search turned up this code, but LFontManager.GetCustomFontInfoCount is zero in Windows. I’ve not tried on Android yet.
procedure GetInstalledFontFamilies(FontList: TStringList);
var
I: Integer;
LFontManager: IFMXFontManagerService;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXFontManagerService, LFontManager) then
begin
for I := 0 to LFontManager.GetCustomFontInfoCount - 1 do
begin
FontList.Add(LFontManager.GetCustomFontInfo(I).FamilyName);
end;
FontList.Sort; // Optional: Sort the list alphabetically
end;
end;