Original Post
The text problem I am having is trying to draw text for a clock display on
top of a window. We have code to get the device context for the drawing area
like this:
IDirect3DSurface9 * surface = NULL;
texture->GetTexture()->GetSurfaceLevel(0,&surface);
if(surface)
{
surface->GetDC(&hdc);
surface->Release();
}
GetTexture() returns an IDirect3DTexture9 *. When the actual drawing
happens, we use a LOGFONT structure, like so:
LOGFONT lfont;
memset(&lfont, 0, sizeof(LOGFONT));
lstrcpy(lfont.lfFaceName, "Arial");
lfont.lfHeight = -8;
lfont.lfWeight = 400;
lfont.lfItalic = false;
lfont.lfCharSet = ANSI_CHARSET;
lfont.lfPitchAndFamily = DEFAULT_PITCH;// | FF_SWISS; lfont.lfQuality =
NONANTIALIASED_QUALITY; //DEFAULT_QUALITY;
lfont.lfOutPrecision = OUT_DEFAULT_PRECIS;
lfont.lfClipPrecision = CLIP_DEFAULT_PRECIS; HFONT textFont =
CreateFontIndirect(&lfont); HFONT oldFont = (HFONT)SelectObject(dc,
textFont);
And then the text is output with
TextOut(dc, 0/*xline*/, 0/*yline*/, buffer, length);
I have played with pretty much all of the LOGFONT fields, but the text is
always displayed way too large. The lfHeight = -8 should give an 8 point
font, but it comes in about the size of a 20 or 30 point font.
But despite the large size, the text is very jagged, so it looks like an 8
point font blown up to 30 point size or something like that.
Make any sense? I have about run out of ideas, so if you can shed any light
that would be great.
Thanks,
Dan