Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

antialiasing fonts

Status
Not open for further replies.

thiefmaster

Programmer
Jan 27, 2001
22
0
0
US
Hi. I'm trying to figure out how to antialias a font so that it looks right in comparison to the rest of my bitmap. Here's the code that I'm already using:

Code:
bitm = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP2));
		
GetBitmapDimensionEx(bitm, &size);
GetClientRect (hDlg, &rect);

hdc1 = BeginPaint(hDlg, &ps);
	
memdc = CreateCompatibleDC(hdc1);
SelectObject(memdc,bitm);
BitBlt(hdc1, 0,0, 1000, 1000,memdc,0,0,SRCCOPY);
DeleteDC(memdc);
DeleteObject(bitm);
		
GetClientRect (hDlg, &rect);
		
SetTextColor (hdc1, RGB(180,180,180));
SetBkColor(hdc1, RGB(0,0,0));
		
rect.right -= 10;
rect.bottom -= 10;
rect.left += 10;
rect.top += 5;

hFont = EzCreateFont (hdc1, TEXT ("BN Elements"), 100, 0, 0, FALSE);
		
GetObject (hFont, sizeof (LOGFONT), &lf);
SelectObject (hdc1, hFont);
		
DrawText(hdc1, TEXT("User Name"), -1, &rect, DT_BOTTOM);

EndPaint (hDlg, &ps);

This code works, but the added on text "User Name" is blocky and doesn't like right in comparison to the text already there. (ex. Registered to:) Is there a way to easily anti-alias this font so it looks right compared to the rest of the image? The "BN Elements" is just the font name that I am using. Hopefully, everything else makes sense.

The definition for the font EzCreateFont (from Charles Petzold's book Programming Windows 5th edition) can be found at
Thanks in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top