Unresolved EnumFontFamiliesEx function

Issue #65 resolved
Jupp
created an issue

The following original VCL code fails:

function TScreen.GetFonts: TStrings;
var
  DC: HDC;
  LFont: TLogFont;
begin
  if FFonts = nil then
  begin
    FFonts := TStringList.Create;
    DC := GetDC(0);
    try
      FFonts.Add('Default');
{$IF DEFINED(CLR)}
      LFont.lfCharset := DEFAULT_CHARSET;
      EnumFontFamiliesEx(DC, LFont, TFontEnumerator.Create(FFonts).FEnumProc, 0, 0);
{$ELSE}
      FillChar(LFont, sizeof(LFont), 0);
      LFont.lfCharset := DEFAULT_CHARSET;
      EnumFontFamiliesEx(DC, LFont, @EnumFontsProc, Winapi.Windows.LPARAM(FFonts), 0);
{$ENDIF}
      TStringList(FFonts).Sorted := TRUE;
    finally
      ReleaseDC(0, DC);
    end;
  end;
  Result := FFonts;
end;

Comments (1)

  1. Log in to comment