Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Can't control font size adequately

michael_green
Beginner
514 Views
Hi All,
I'm trying to emulate the output of a certain commercial package used for the display of Postscript plot files. I'm having difficulty controlling the appearance of text strings. The commercial package makes the apparent length of a certain string longer or shorter according to viewing scale - the variation is very smooth.
When I try to do the same thing using ...
lf%lfHeight = -MulDiv(isize,GetDeviceCaps(hDC,LOGPIXELSY),72)
... for setting up the font, I find that I don't have sufficient control. For example, when isize equates to 5, the string is much too long, but at isize=4, the string is too short.
The package and my program are using the same font (Times Roman) on the same hardware, so I guess there's much more to this than just setting the logical font's height. Please can someone enlighten me.
With many thanks in advance,
Mike
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
514 Views
Well, font handling can be quite delicate... instead of diving into details (which I'm not too competent with, too), I'd just point out that MulDiv is a mere "macro" function for calculating a*b/c (I think, without the risk of potential overflow). Since you're on the safe side of an overflow, instead, you can use normal floating-point expression (Windows API avoids floats wherever possible), like:
lf%lfHeight = NINT(4.5 * GetDeviceCaps(hDC,LOGPIXELSY) / 72)
I hope that you can achieve the "right" size by experimenting with the multiplier.

Jugoslav
0 Kudos
Reply