Jump to content

Pull font name from font file


Solprov
 Share

Recommended Posts

I'm looking for a function that will pull the font details from a font file (*.ttf). Specifically the font title.

I see ways to pull the filenames from the registry for installed fonts, but I want to get the font name as it would be added to the registry during the font install.

I need to read this directly from the *.ttf file.

Anyone got a udf or function that does this already?

Thanks

Link to comment
Share on other sites

#Include <Array.au3>
#Include <File.au3>
#Include <WinAPIEx.au3>

Opt('MustDeclareVars', 1)

Global $FileList = _FileListToArray(_WinAPI_ShellGetSpecialFolderPath($CSIDL_FONTS), '*.ttf', 1)
Global $FontList[UBound($FileList) - 1][2]

For $i = 1 To $FileList[0]
    $FontList[$i - 1][0] = $FileList[$i]
    $FontList[$i - 1][1] = _WinAPI_GetFontResourceInfo($FileList[$i], 1)
Next

_ArrayDisplay($FontList, '_WinAPI_GetFontResourceInfo')

WinAPIEx.au3

Link to comment
Share on other sites

Thanks, I did see the codeproject link, but couldn't get the GDI programming to work.

The WinAPIEx.au3 looks promising, but I don't want to read from the fonts folder, can it be manipulated to read from any folder?

RDR

Just change the folder path.

Global $FileList = _FileListToArray("C:\Extra Fonts\", '*.ttf', 1)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...