Sign in to follow this  
Followers 0
LxP

Verifying an installed font?

6 posts in this topic

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.

Share this post


Link to post
Share on other sites



Not sure what exactly your trying to do, you might want to look at the UDF _ChooseFont, might not be what your looking for it creates a common dialog for font to be chosen.


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


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.

Share this post


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.

 

Share this post


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

Share this post


Link to post
Share on other sites

I tried using a font name that don't exist and setting GuiCtrlSetFont and GuiSetFont and both returned a 1, so i guess if it can't find the font it uses some default font.


SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Share this post


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
Sign in to follow this  
Followers 0