Create a font that is always the same size, regardless of the video settings

Posted on 1998-11-19
Last Modified: 2013-12-02
I create fonts usign the following method :

int pts = 12;
int height = -((pDC->GetDeviceCaps(LOGPIXELSY) * pts) / 72);
CFont font;
font.CreateFont(height, 0, 0, 0, (bBold ? FW_BOLD : FW_NORMAL), (char)bItalic, (char)bUnderline, 0,
FF_DONTCARE, fontName);

This is fine in the normal case, but if I go in my video settings (Start~Settings~Control Panel~Display~Settings). There is an option for Font Size, which will let you select "Large fonts". Also, with some video card drivers, it is possible to select a ratio of the normal size for a font (120% of normal, for example).  So when I create a font with a given number of points, I end up with many different possible font sizes...

What I need is a way to create a font that wont be affected by this setting (ie the font will alway be the same number of pixels high for a given pts setting).  Is there a way I can go around that setting ???

Question by:yletour
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

Expert Comment

ID: 1325000
Try DRAFT_QUALITY and stick to true type

Expert Comment

ID: 1325001
you create two font types, one for 640*480,one for 800*600, you can select the proper font according to the video setting.


Author Comment

ID: 1325002
This solution does not answer to the question.  How can I know if the user has Large Fonts or not enabled ?

Accepted Solution

snoegler earned 200 total points
ID: 1325003
Use GetDeviceCaps(LOGPIXELSX)/GetDeviceCaps(LOGPIXELSY) on the display dc.
It will return the DPI settings - which are equal to the DPI selected in the 'Display Properties'.
So 120 DPI = 125% of usual size, ...
Hope this is still of interest :)

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Doc'in system (example?) BA 7 127
wordcount challenge 11 163
Work with App store 7 121
listing all the respondents to a twitter feed - Java 5 44
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
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…

732 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