Gold mine of Visual C++ tricks!
How to add font to system, programmatically?
![]()
Diablo! It was my favorite game during my childhood. Chopping down monsters, bats… Wow!!! I love it. Every time when i start the program one thing that attracted me is its font.Later when I searched net, i found that there is a font named diablo. But what will happen if the font is not present in the system? The game screen will be wired? The application might be installing the font, if its not present in the system. But how to do it?

![]()
Well, You can use the api – AddFontResource(). You have to provide the path of font file to be added to system. Have a look at the code snippet.
// Path of font to be added.
CString csFontPath = _T( "C:\\Diablo.ttf" );
// Add font to system.
if( 0 == AddFontResource( csFontPath ))
{
// Adding font to system failed.
}
![]()
Well, the latest version of diablo is Diablo III. Its superb! Have a look at it.
![]()
Targeted Audience – Intermediate.
| Print article | This entry was posted by Jijo Raj on October 29, 2008 at 5:25 am, and is filed under Codeproject, Windows APIs. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |