PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

fonts in regular old windows

I've been trying to duplicate the text header effect in a dialog (the bold and blue title). And everything that I've tried has failed to reproduce the correct font.

Reading through the docs it says its Tahoma Bold 8pt, when I try to get 8pt it looks very small, and when I try 9pt its too big.

What am I missing?
Nevermind, I got it working finally. Instead of trying to build it, I just tried pulling it from the control and that seems to work.

Code:

HFONT font = (HFONT)SendMessage((HWND)lParam, WM_GETFONT, 0, 0);

LOGFONT lf;
GetObject(font, sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
globalBoldFont = CreateFontIndirect(&lf);

SelectObject((HDC)wParam, globalBoldFont);
Did you try specifying the font size as a negative value? I would take a look at the size value after you GetObject to see what was going on.

Dan East
Yeah I was using a forumla of the form -(([pt size] * sys dots per inch)) / 72) or something like that. I just pulled that from a sample.

That was just one of the problems, it also was not the font face that standard text headers had. I actually think the font is different (on the ipaq at least) check out Regional Settings in the control panel, and look at the e. Compare that to the e below, both the header (bold blue) and the subheader (black bold) use the same font, which is different than the rest. And after coming from the PPC2002 docs which went to great depths to describe the elements and what to use, they all said Tahoma.

Just looking at the code again, 6 lines, 3 casts. Is this why its so not fun programming on windows?