RE: Using uninstalled true type fonts
"Tom Hahn" <[email protected]>
| Newsgroups | gmane.comp.lang.delphi.programming |
|---|---|
| Message-ID | <[email protected]> |
> -----Original Message----- > From: Peter W. [mailto:[email protected]] > Sent: Thursday, July 24, 2003 9:26 PM > To: [email protected] > Subject: [Delphi] Using uninstalled true type fonts > > > I remember hearing some time ago that it is possible to use > Windows true type fonts without them being installed if you have > the .ttf file. That is what I want to do. The reason is that the pc I > use at work does not permit installing fonts. I want to write an > application which uses a richedit to display different fonts and font > sizes including fonts which are not installed but I have on disk. I > will need to be able to print these out. > > How can I do this. Does anyone have some sample code? > Peter: I think this will do what you want. //Using a font in an application when it is not installed in Windows. / Load it in the OnCreate event of a form procedure TForm1.FormCreate(Sender: TObject); begin AddFontResource('c:\FONTS\MyFont.TTF'); SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); end; //Free it before application terminates procedure TForm1.FormClose (Sender: TObject; var Action: TCloseAction); begin RemoveFontResource('C:\FONTS\MyFont.TTF'); SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); end; HTH, Regards, Tom ------------------------ Yahoo! Groups Sponsor ---------------------~--> Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more. http://www.c1tracking.com/l.asp?cid=5510 http://us.click.yahoo.com/GHXcIA/n.WGAA/ySSFAA/i7folB/TM ---------------------------------------------------------------------~-> CodeCoffer - new Delphi code protection Tool! http://www.delphicollection.com/public/CodeCoffer.htm --------------------------------------------------------------- Unsubscribe:[email protected] List owner:[email protected] --------------------------------------------------------------- Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/