Mega Code Archive

 
Categories / Delphi / Examples
 

Installing a font from delphi

Question: How can I install a font from my Delphi application? Answer: Just copy a file into Windows\Fonts directory (see SHGetSpecialFolderLocation for CSIDL_FONTS) As an alternative see the AddFontResource function: // Adding the font .. AddFontResource(PChar('XXXFont.TTF')); SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0); // .. removing the font RemoveFontResource(PChar('XXXFont.TTF')); SendMessage(HWND_BROADCAST, WM_FONTCHANGE, 0, 0);