Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Fixed Pitch Fonts...

Posted on 1999-06-25
Medium Priority
Last Modified: 2013-12-02
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.
Question by:KMFDM
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

ID: 1307917
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.


Author Comment

ID: 1307918
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?

Expert Comment

ID: 1307919
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.


Author Comment

ID: 1307920

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

See Ya,


Accepted Solution

Thamaz earned 400 total points
ID: 1307921
Ok. Thanks & Gd.Lk.

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question