Solved

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

Posted on 1998-11-19
4
176 Views
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,
DEFAULT_CHARSET, OUT_CHARACTER_PRECIS,
CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH |
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 ???

Thanx
0
Comment
Question by:yletour
4 Comments
 
LVL 8

Expert Comment

by:Answers2000
Comment Utility
Try DRAFT_QUALITY and stick to true type
0
 
LVL 2

Expert Comment

by:wyy_cq
Comment Utility
you create two font types, one for 640*480,one for 800*600, you can select the proper font according to the video setting.


0
 

Author Comment

by:yletour
Comment Utility
This solution does not answer to the question.  How can I know if the user has Large Fonts or not enabled ?
0
 
LVL 6

Accepted Solution

by:
snoegler earned 200 total points
Comment Utility
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 :)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
font missing in acrobat 3 63
maxBlock challenge 30 99
sumHeights2  challenge 7 75
unix example issues 18 44
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now