Click to See Complete Forum and Search --> : True Type Fonts
June 10th, 1999, 05:17 AM
Hi,
I'm regurarly working with fonts and I'm kinda sick of opening the fontviewer for every font when I want a preview of it without installing the font in Windows.
So I decided to create a fontviewer using VC++ and MFC.
On of the first things I came across is the following:
How do I show an external True Type Font file in a window without installing the font in Windows? When it is not possible to use the font without installing the font how can I temporarily install and remove the font?
Thanks in advance.
Regards,
Patrick
Steve Dwire
June 10th, 1999, 09:26 AM
From Platform SDK:
----------------
AddFontResource
The AddFontResource function adds the font resource from the specified file to the system font table. The font can subsequently be used for text output by any Win32-based application.
int AddFontResource(
LPCTSTR lpszFilename // pointer to font-resource filename
);
----------------
RemoveFontResource
The RemoveFontResource function removes the fonts in the specified file from the system font table.
BOOL RemoveFontResource(
LPCTSTR lpFileName // pointer to font-resource filename
);
June 11th, 1999, 05:33 AM
Thanks Steve,
Right after I posted this message I found them too. I should have looked further befre crying out for help.
Now the only problem I have is how to use it. In order to use it I need the facename within Windows.
The AddResource function doesn't give me this name. Nor is there any function (not that I know of) that gives me this name.
Any Ideas???
Thanks in advance,
Patrick
Steve Dwire
June 11th, 1999, 08:54 AM
This will take a bit more work. In your MSDN library, look under Specifications\True Type 1.0 Font Files...\The TrueType Font File\Data Types. It goes into detail about the format of a TrueType font file. You can manually extract the name that way, but it's a pain.
Feneck
June 11th, 1999, 09:10 AM
hello.
I would like exactly the same thing....
If you want that your font be used by the other, don' t forget to put
SendMessage(HWND_BROADCAST,WM_FONTCHANGE,0,0);
in your code to say it to the others.
In response to the other mail :
This will take a bit more work. In your MSDN library, look under Specifications\True Type 1.0 Font Files...\The TrueType Font File\Data Types. It goes into detail about the format of a TrueType font file. You can manually extract the name that way, but it's a pain.
It seems not very easy !! Another idea ?
If I found a response, I'll post a mail back, if you find, thanks to reply to me:
sch@sogetek.fr
Stéphane
June 11th, 1999, 09:13 AM
Thanks.
I think you're right about the crime part.
This is not going to be an easy job.
Regards,
Patrick
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.