Click here to Skip to main content
13,301,591 members (94,641 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a requirement wherein I have to check whether a given font file is already installed or not. From the font file, I have extracted the "Font Name", "Font Family Name" and "Post Script Name". In windows, I have to check for the registry entries in SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts. But I have noticed that for some fonts the registry entries have "Font Name" and for some (especially Adobe Fonts) have "Post Script Name".
For example, comic.ttf has "Font Name" "Comic Sans MS" and "Post Script Name" "ComicSansMs". The registry value is for "Comic Sans MS".
But for some other fonts, like MinionPro-Regular.otf(which is an adobe file), the "Font Name" is "Minion Pro" the "Post Script Name" is "MinionPro-Regular" and the registry value is for "MinionPro-Regular".

What is the the thumb rule governing the Font lookup? Does it vary from font type to font type?

Any help will be deeply appreciated.

Thanks And Regards
Posted 20-Feb-13 8:24am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you have the name of the font file, then you could just perform a quick check against the C:\Windows\Fonts directory and see if the file already exists there.
If I remember correctly, any font file placed in this folder will automatically get added to the registry so it is a valid way to check if the font is installed.
However, if you need to use the registry, you might find the EnumFontFamiliesEx[^] interface helpful.
Sergey Alexandrovich Kryukov 20-Feb-13 19:55pm
About the directory: this is not really so, probably it was the case with older Windows versions, as far as I could remember them. Now it requires some installation, and the procedure can be easily found in documentation.

But of course, with the registry data, you can solve the problem like this, in principle. However, it's not a maintainable approach. OP can use EnumFontFamiliesEx and related Windows API.
Sergey Alexandrovich Kryukov 20-Feb-13 19:57pm
So, I basically answered, please see.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You need to use the Windows API EnumFontFamiliesEx and other related "Font and Text Functions". Please see:[^].

Some code sample:[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 20 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100