PRB: wglUseFontOutlines Does Not Handle DBCS

ID: Q228099


The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), on platform(s):
    • Microsoft Windows 98
    • Microsoft Windows NT 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 kbNTOS400 kbOpenGL kbSDKPlatform kbWinOS98
Version : winnt:4.0
Platform : winnt
Issue type : kbprb


Last Reviewed: April 21, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.