PRB: Embedded Read-Only Fonts in Multiple Application Instances on Windows NT, Windows 2000, and Windows XP (230179)
The information in this article applies to:
- Microsoft Windows 2000 Server
- Microsoft Windows 2000 Advanced Server
- Microsoft Windows 2000 Professional
- Microsoft Windows NT Server 4.0
- Microsoft Windows NT Workstation 4.0
- Microsoft Windows XP Professional
- Microsoft Windows XP Home Edition
- the operating system: Microsoft Windows XP 64-Bit Edition
This article was previously published under Q230179 SYMPTOMS
Microsoft Windows Operating Systems provide a feature called Embedded Read Only fonts that an application can use to temporarily install a TrueType font such that only the application can access and use the font. The behavior of this feature on Windows NT 4.0, Windows 2000, and Windows XP may be unexpected. The second and subsequent instances of the application may fail to install the font or may fail to use the font if installation succeeds. This behavior is designed to protect the Embedded Read Only font from misuse by other processes.
CAUSE
The AddFontResource() function will fail to install a hidden font resource file when called by any other process than the process which created the resource file with the CreateScalableFontResource() function.
If a process both creates the hidden font resource file and installs the font resource file, the AddFontResource() function will succeed. However, if the resource file refers to a TrueType font file already in use by another process as a hidden embedded read only font file, the process will be unable to use the font.
RESOLUTION
An application can use embedded read only fonts that are hidden via the CreateScalableFontResource() function in multiple processes ( multiple instances of an application ) by coding each process ( instance of the application ) to use unique copies of both the TrueType font file and the hidden font resource file.
To install unique hidden font resources follow these steps: - Copy the TrueType font file to a temporary file with a unique filename such as "ttfont01.ttf" that can be owned by the instance of the application.
- Call the CreateScalableFontResource() function to create a uniquely named temporary hidden font resource file that can also be owned by the instance of the application.
- Call the AddFontResource() function to install this uniquely named font resource file for this instance of the application.
- Use the font in the application as desired.
- When the instance of the application terminates or is otherwise finished with the font file, it should uninstall the font resource by calling the RemoveFontResource() function until it fails.
- Lastly, the instance of the application should delete the temporary font resource file and the temporary TrueType font file that it created.
STATUS
This behavior is by design.
This design prevents other processes in the system from using private fonts that a process has installed as hidden to presumably protect the font from unlicensed use outside of the application.
REFERENCES
For additional information about this issue on Windows 95 and 98, please see the following article in the Microsoft Knowledge Base:
230210 - PRB: Embedded Read Only Fonts in Multiple Application Instances on Windows 9x
Modification Type: | Minor | Last Reviewed: | 5/10/2006 |
---|
Keywords: | kbDSWGDI2003Swept kbFont kbGDI kbprb KB230179 |
---|
|