Jump to content
Sign in to follow this  
bluespirit

Extracting Font Name out of TTF file

Recommended Posts

bluespirit

Hi,

I'm trying to extract the font name out of a .ttf file to enter the correct info into the registry. Anyone know how to do this?

I'm installing the fonts using the AddFontResource DLL call, making a registry entry in the fonts section and then using SendMessage DLL call to broadcast the font change. However, this relies on you already knowing the full font name.

The best I've managed to find is a GetFontName function by Holger but this only works once the font is already installed or in memory.

Thanks for any help,

James

Share this post


Link to post
Share on other sites
rudi

Copying fonts to @Windir & "\Fonts" should automatically perform the installation.

This way the fonts will be correctly installed just after the next reboot. IIRC in this forum someone already dropped a posting how to immediately activate new fonts without using the "regular" way (fonts applet, in control center)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
weaponx

This way the fonts will be correctly installed just after the next reboot. IIRC in this forum someone already dropped a posting how to immediately activate new fonts without using the "regular" way (fonts applet, in control center)

Regards, Rudi.

I must be confused. On XP SP2/SP3 I can drag fonts into the Windows\Fonts folder which will immediately trigger font installation. If I have Photoshop CS3 open when I install a font this way, I don't even have to restart it (Photoshop) for the new fonts to show in the list.

Share this post


Link to post
Share on other sites
bluespirit

Unfortunately copy the font to the windows font folder does not install the font as an entry needs to be made in the registry. Not to mention informing all open applications so a reboot is not required.

Copying using drag & drop in explorer does install the font correctly as explorer does all the necessary processing. However this is a manual operation and I'm trying to copy the font to 100 after effects remote renderers which means I need an automated process that doesn't require a reboot.

Forcing an opening and closing of the fonts folder from control panel does do the trick and this is how im currently doing it. However that trick does not work in Vista, which we are changing to in a few months. So I'm looking for a new method to install fonts remotely over the network.

James

Share this post


Link to post
Share on other sites
rudi

I must be confused. On XP SP2/SP3 I can drag fonts into the Windows\Fonts folder which will immediately trigger font installation.

Just checked it a few days ago: XP SP2 +all hotfixes (April 2008): This is a TTF with a "slashed" zero (similar to the Swedish special character you get for Alt +[numpad]0216 = Ø). This one is used for a ERP system to securely distinguish "0" (zero) from "O" (capital o).

When the TTF is just copied to the font's folder, then it will not work (the edit fields change from 20 x width to 3 x (full GUI width)). When the same font is added using the control panel, fonts applet, it will work immediately.

Maybe for some applications it will work with a simple "copy2fontsfolder", but it obviously isn't the same for the OS as the "regular" way to install fonts.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
bluespirit

Thanks for the info. It's all great stuff, but starting to get a little beyond my capabilities as don't really know C++ or have a compiler!

Share this post


Link to post
Share on other sites
rudi

Thanks for the info. It's all great stuff, but starting to get a little beyond my capabilities as don't really know C++ or have a compiler!

Well, in very simple, all you will have to do to "install" a font is to copy it to ...

@windowsdir & "\fonts"

... folder. For this you can use FileInstall() of Autoit.

At least after the next reboot this font will be available to all Windows Applications.

The TTF file structure seems not to be trivial. I just came across these links:

TTF specs, by Microsoft

TTF, Wikipedia

<edit>

Another explanation

</edit>

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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  

×