Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8921637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:35:45+00:00 2026-06-15T06:35:45+00:00

I can get font folder icon like this : var sfi : SHFILEINFO; begin

  • 0

I can get font folder icon like this :

var
sfi : SHFILEINFO;
begin
  SHGetFileInfo('C:\Windows\Fonts\Arial' , 0 , sfi , SizeOf(sfi) , SHGFI_ICON);
  Image1.Picture.Icon.Handle := sfi.hIcon;
end;

but fail like this :

var
sfi : SHFILEINFO;
begin
  SHGetFileInfo('C:\Windows\Fonts\ARIALN.TTF' , 0 , sfi , SizeOf(sfi) , SHGFI_ICON);  
  Image1.Picture.Icon.Handle := sfi.hIcon;
end;

it seem like can’t get font file’s icon but can get font folder , I wonder how to get a font file icon ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:35:46+00:00Added an answer on June 15, 2026 at 6:35 am

    Use Windows Shell to get font file icon :

    Code :

    var
      psfDeskTop : IShellFolder;
      psfFont : IShellFolder;
      pEnumList : IEnumIdList;
      pidFont : PItemIdList;
      pidChild : PItemIdList;
      FontPath : array[0..MAX_PATH - 1] of Char;
      IconFile : array[0..MAX_PATH - 1] of Char;
      pchEaten, dwAttributes, ItemsFetched : ULONG;
      ExtractIcon : IExtractIcon;
      IconIndex : Integer;
      Flags : DWORD;
      Icon : TIcon;
      LH, SH : HICon;
    begin
      FillChar(FontPath, sizeof(FontPath), #0);
      //get C:\Windows\Fonts
      SHGetSpecialFolderPath(0, FontPath, CSIDL_FONTS, False);
      SHGetDesktopFolder(psfDeskTop);
      psfDeskTop.ParseDisplayName(0, nil, FontPath, pchEaten, pidFont,
        dwAttributes);
      //get font folder's interface
      psfDeskTop.BindToObject(pidFont, nil, IID_IShellFolder, psfFont);
      //Enumerate
      psfFont.EnumObjects(0, SHCONTF_FOLDERS or SHCONTF_NONFOLDERS or
        SHCONTF_INCLUDEHIDDEN, pEnumList);
      ItemsFetched := 0;
    
      while pEnumList.Next(1, pidChild, ItemsFetched) = NO_ERROR do
      begin
    
        psfFont.GetUIObjectOf(0, 1, pidChild, IID_IExtractIconW, nil,
          Pointer(ExtractIcon));
    
        Flags := 0;
        LH := 0;
        SH := 0;
    
        if Assigned(ExtractIcon) then
        begin
          IconIndex := 0;
          Icon := TIcon.Create;
          ExtractIcon.GetIconLocation(0, @IconFile, MAX_PATH, IconIndex,
            Flags);
          if (IconIndex < 0) or ((Flags and GIL_NOTFILENAME) = 0) then
            ExtractIconEx(@IconFile, IconIndex, LH, SH, 1)
          else
            ExtractIcon.Extract(@IconFile, IconIndex, LH, SH, MakeLong(32,
              16));
    
          //get font file icon's handle LS for large icon , SH for small icon
          //do something u want 
    
        end;
    
      end;
    
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This explains font metrics I think we can get Font height in SWT like
I can't get @font-face working in any browser on macs. I believe this is
First, I'd like to thank anyone that can get me through this in advance.
I need to get the path of a specific font in my c:/windows/ folder
How can get the LineHeight of a Font given the FontSize? It seems that
Can't seem to get my font working in firefox, seems to work fine in
In webspiders/crawlers how can i get the actual initial rendered size of the font
I have text with font in org.faceless.pdf.PDFFont. How can I get width of it
I can get this to work: [<DllImport(user32.dll)>] extern bool GetClientRect(nativeint, RECT*) let getClientRect hwnd
I am trying to get the Sample text of a font.This is my coding.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.