Microsoft KB Archive/228099

{|
 * width="100%"|

PRB: wglUseFontOutlines Does Not Handle DBCS

 * }

Q228099

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), on platform(s):
 * Microsoft Windows 98
 * Microsoft Windows NT Server version 4.0
 * Microsoft Windows NT Workstation version 4.0

-

SYMPTOMS
On Windows 98, the OpenGL function wglUseFontOutlines does not work with DBCS or UNICODE strings. On Windows NT, UNICODE strings work; however, DBCS strings do not.

CAUSE
DBCS strings are not handled by the glCallLists function, which is used to draw the display list built by wglUseFontOutlines. The reason is that a DBCS string contains characters that are one byte or two bytes each depending on the high byte. Because DBCS strings are not a consistent length, glCallLists does not parse them.

RESOLUTION
On Windows NT, however, UNICODE strings can be used with wglUseFontOutlines. You can convert the desired DBCS character set to a UNICODE character set using the MultiByteToWideChar function. You can pass a character string with the DBCS characters desired to MultiByteToWideChar. Then, pass the resulting UNICODE string to wglUseFontOutlines. The listbase you pass to wglUseFontOutlines is the index of the first display list in your character set. You need to determine the numeric value of the first UNICODE character in your character set to pass to wglUseFontOutlines. You must set the display list base to the same base using glListBase prior to calling glCallLists. Finally, you need to convert the actual string you are going to use to UNICODE as well.

Instead of the above, you can render one display list at a time using the glCallList function. The glCallLists function does not work correctly because it needs to step through multiple indices.

MORE INFORMATION
On Windows 98, you cannot use DBCS or UNICODE strings with wglUseFontOutlines and glCallLists. UNICODE is supported on Windows NT. For Windows NT, the following steps can be followed to use a DBCS string:


 * 1) Convert DBCS character set to UNICODE using MultiByteToWideChar.
 * 2) Build the display lists using wglUseFontOutlines. You need to know the UNICODE index range for the DBCS character set for the "first" and "count" parameters of wglUseFontOutlines.
 * 3) Set the display list base to the same base used in step 2 using glListBase.
 * 4) Convert the output string from DBCS to UNICODE using MultiByteToWideChar.
 * 5) Call glCallLists with the UNICODE string.

Additional query words:

Keywords : kbGDI kbOSWinNT400 kbOpenGL kbSDKPlatform kbOSWin98

Issue type : kbprb

Technology : kbAudDeveloper kbWin32sSearch kbWin32API