- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
Jugoslav
lf%lfHeight = NINT(4.5 * GetDeviceCaps(hDC,LOGPIXELSY) / 72)I hope that you can achieve the "right" size by experimenting with the multiplier.
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page