Fixed Pitch Fonts...

The SDI application I’m working on has a fixed window size of (0, 0, 640, 480) with no title bar, tool bar, client edge… i.e. just a 640x480 plain white box. My application has the requirements of having 30 rows of text each having 80 characters. It’s not uncommon for adjacent text to have different foreground and background colors and it’s important that my font is uniform in width and height so that the background colors meet flush and the characters all line up vertically and horizontally. I’m trying to set up a font using LOGFONT that will accomplish this. Basically each character needs to be 8x16. I also need to setup a font that is a double sized character (16x32) that exactly takes up the width and height of 4 smaller font characters. How do I accomplish this? I have tried using lfPitchAndFamily = FIXED_PITCH but still when I output a ‘W’ and an ‘i’ with background colors different than the windows color they have different widths.
Who is Participating?
ThamazConnect With a Mentor Commented:
Ok. Thanks & Gd.Lk.
What font name did you specify in the LOGFONT. You must use a non-proportional font like Curier OR CurierNew.

May be you can try to create the LOGFONT struct from the Stock Object SYSTEM_FIXED_FONT, OEM_FIXED_FONT or ANSI_FIXED_FONT and then change the size.

KMFDMAuthor Commented:
I didn’t specifically name a font. I modified the following values: lfHeight, lfWidth, and lfWeight. I’ll give those suggestions a try. Also, when modifying the font’s height and width should I use negative or positive numbers for fixed fonts?
GetObject(GetStockObject(ANSI_FIXED_FONT), sizeof(l_MyFont), &l_MyFont);

// Here you have l_MyFont with the data of the ANSI FIXED FONT
// & you can change the Height & the With with positive numbers.
// & create a new font from the LOGFONT struct.

Try with the 3 fixed fonts, but I recomden you to use the ANSI_FIXED_FONT because is standard btw computers.

KMFDMAuthor Commented:

Your comments helped a lot, thanks... Post an answer and I'll give you the points, ok?

See Ya,

All Courses

From novice to tech pro — start learning today.