Solved

Font size

Posted on 2004-09-14
6
458 Views
Last Modified: 2013-12-03
How to konw the exact size of a font from the point size to implement in an IFont->put_size?

For example:

Point size 8 is actually 8.25
Point size 9 is actually 9
Point size 10 is actually 9.75
Point size 11 is actually 11.25
Point size 12 is actually 12
Point size 14 is actually 14.25

Thanks
0
Comment
Question by:DAE
  • 2
6 Comments
 
LVL 16

Expert Comment

by:nonubik
ID: 12062651
HRESULT put_Size(
  CY size  //Size of the font
);
size of the font expressed in a 64-bit CY variable. The upper 32-bits of this value contains the integer point size and the lower 32-bits contains the fractional point size.
0
 

Accepted Solution

by:
curero earned 125 total points
ID: 12483750
 
   lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);

   (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/fontext_1wmq.asp )
0
 

Author Comment

by:DAE
ID: 12560800
I need exactly the opposite.

I have the Height of the font, but I need to convert that Height in to PointSize (Not the rounded PointSize the exact PointSize). See my original post.
0
 

Expert Comment

by:curero
ID: 12566624
Well, not sure if I understood you, but if  ' height = f (point_size) ' and the function f  is bijective then you can calculate point_size=inverse_f( height).
   
 double  dPointSize = (double)(-lfHEight * 72)/GetDeviceCaps(hDC, LOGPIXELSY);

 Am I missing something?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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…

920 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

11 Experts available now in Live!

Get 1:1 Help Now