Jump to content

Verifying an installed font?


Recommended Posts

Hi all,

How might I go about checking for the existence of a font on a system by its 'friendly' name (and not its filename)?

It doesn't look like I can do this through the registry because I couldn't find any info that works for both 9x and NT/XP systems. It looks like MS Word can do it to an extent but I don't use it on any of my computers.

Link to post
Share on other sites

Thanks for your input Gary -- while I'm not after a dialogue your code may be a step in the right direction.

What I would like to do is determine whether a particular font exists in a usable state on the system. Before your UDF displays the dialogue is it already aware of the fonts installed on the system?

If so, could the code somehow be adapted to just return an array of font names? From here it would be easy to determine if a font is installed on the system by looking through the array for its occurrence.

Link to post
Share on other sites

sorry that isn't what your looking for, you might need to do if os version to determine the fonts installed, on win32 systems they should be listed in "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"

couldn't tell you where on 9x systems

Gary

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to post
Share on other sites

Hm, with some string manipulation that should satisfy me for the moment. Thanks Gary!

Just out of curiosity, I've tested that there is no @Error value if I try to GUISetFont() with a non-existent font. If there were some sort of indication from GUISetFont() that the font was invalid then I could use that for my purposes.

Is this sort of thing easily implementable? I could then write a function as such:

func _fontIsInstalled($font)
    guiCreate("fontTest")
    guiSetFont(9, 100, 4, $font)
    local $exists = not(@error)
    guiDelete()
    return $exists
endFunc
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...