AddFontResource function
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 application.
To mark a font as private or not enumerable, use the AddFontResourceEx function.
Syntax
int AddFontResource( __in LPCTSTR lpszFilename );
Parameters
- lpszFilename [in]
-
A pointer to a null-terminated character string that contains a valid font file name. This parameter can specify any of the following files.
To add a font whose information comes from several resource files, have lpszFileName point to a string with the file names separated by a "|" --for example, abcxxxxx.pfm | abcxxxxx.pfb.
Return value
If the function succeeds, the return value specifies the number of fonts added.
If the function fails, the return value is zero. No extended error information is available.
Remarks
Any application that adds or removes fonts from the system font table should notify other windows of the change by sending a WM_FONTCHANGE message to all top-level windows in the operating system. The application should send this message by calling the SendMessage function and setting the hwnd parameter to HWND_BROADCAST.
When an application no longer needs a font resource that it loaded by calling the AddFontResource function, it must remove that resource by calling the RemoveFontResource function.
This function installs the font only for the current session. When the system restarts, the font will not be present. To have the font installed even after restarting the system, the font must be listed in the registry.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | AddFontResourceW (Unicode) and AddFontResourceA (ANSI) |
See also
Send comments about this topic to Microsoft
Build date: 9/7/2011
- 9/28/2011
- Dex Graham
which path in registry to set the name of the font file for it to persist in the system even after restart ?
[tfl - 14 11 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
SQL Server : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.sqlserver%2C&
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
PowerShell : http://groups.google.com/group/microsoft.public.windows.powershell/topics?pli=1
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&
- 10/22/2009
- Saleh Alsanad
- 11/14/2009
- Thomas Lee
