Getting typeface and Windows name of font that is not installed

后端 未结 2 854
我在风中等你
我在风中等你 2021-01-22 03:23

Can someone tell me how can I get the typeface name of a font? And how can I take the Windows name of the font having the typeface name?

Like \"arialblackno1.ttf\" that

2条回答
  •  不要未来只要你来
    2021-01-22 04:08

    Actually, i have a little idea about what exactly are you asking (terms!)

    procedure TForm14.FormCreate(Sender: TObject);
    var
      DC: HDC;
      Font: HFONT;
      LogFont: TLogFont;
    begin
      DC := GetDC(HWND_DESKTOP);
      Win32Check(DC <> 0);
      Font := GetCurrentObject(DC, OBJ_FONT);
      Win32Check(Font <> 0);
      Win32Check(GetObject(Font, SizeOf(LogFont), @LogFont) > 0);
      ShowMessage(LogFont.lfFaceName);
      Win32Check(ReleaseDC(HWND_DESKTOP, DC) = 1);
    end;
    

提交回复
热议问题