Locating .tff or .fon file for fonts in C:\Windows\Font

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
jwong
Level 2
Level 2
Posts: 27
Joined: Thu Feb 17, 2011 4:58 pm

Locating .tff or .fon file for fonts in C:\Windows\Font

Post by jwong »

Normally each font has entry in the registry under HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts whereby the registry Name is the font name and the registry Data value is the filename of the font (for example courier.ttf).

In my app I use the facename from the LOGFONT structure and the above registry entries to determine the associated ttf file.

When I add a font to the C:\Windows\font, the font correctly appears as an available font in the font dialog, but the entry is not listed in HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts. My question is how do I determine the font file (*.ttf or *.fon) for the fonts in C:\Windows\Font?
User avatar
SpawnHappyJake
Level 5
Level 5
Posts: 272
Joined: Sun Feb 06, 2011 5:57 am

Post by SpawnHappyJake »

Could you have your app read the font files in %SYSTEMROOT%\Fonts directly to determine their names and whether they are *.ttf format or *.fon format as well as using registry values (that may or may not be there)? That way you get all the font files in the %SYSTEMROOT%\Fonts folder as well as any fonts in an obscure folder referenced by the registry. Perhaps even register any font file in %SYSTEMROOT%\Fonts not already registered in the registry.

There was (maybe still is) a bug in WineTricks that does not register font files that it installs. So you definitely want a method not dependent on the registry (you've seen what things dependent on the registry do, right?). Maybe even let the user pick whether they want the program to scan the %SYSTEMROOT%\Fonts folder to find fonts (one optional paramether), register font files found in the %SYSTEMROOT%\Fonts folder not already registered (another optional parameter), use the registry to find fonts (another optional parameter), and maybe even delete registry values that reference non-existant font files (another optional parameter). And so that the user can have any one of those parameters on or off (as opposed to only getting to pick one parameter). I don't know your intentions, but those could be command line options and/or check box options, etc.

Perhaps the ttx dev team could give you a hand parsing font files directly? Or at least view their source code?

Cheers,
Jake
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: Locating .tff or .fon file for fonts in C:\Windows\Font

Post by vitamin »

jwong wrote:When I add a font to the C:\Windows\font, the font correctly appears as an available font in the font dialog, but the entry is not listed in HKLM\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts. My question is how do I determine the font file (*.ttf or *.fon) for the fonts in C:\Windows\Font?
Wine regenerates that registry tree only once on startup. Exit Wine and restart it.
Locked