ExtTextOut not displaying subscript characters
I'm attempting to render the following text using the ExtTextOut
function with the Courier New
font:
C₁C₂C²C³
The superscript characters show up fine, but the subscript characters show up as blocks. If I use the DrawText
function, then the subscript characters show up fine.
I was under the impression that DrawText
internally calls ExtTextOut
. Am I mistaken or does DrawText
perform some extra processing of the string to allow subscript characters to show up?
Is there anything I can do to get ExtTextOut
to display the subscript characters using the Courier New
font?
My code for using ExtTextO开发者_开发问答ut
looks like this:
ExtTextOutW(hdc,x,y,0,0,szText,wcslen(szText),0);
As Hans noted in a comment, DrawText() is nowadays implemented using font linking, but it would appear that ExtTextOut() is not.
If you really want this to work reliably, you'll probably have to do font linking yourself. Some code of mine that solves a similar problem: TextOutput C++ class
If you get rectangles instead of glyphs then the problem is the font you are using. It doesn't have the necessary glyph. Common on XP for example, I don't have it installed anymore to check. Use the Windows charmap.exe applet to find a suitable font. The subscript 2 is Unicode codepoint '\x2082'.
精彩评论