Patrick Shields Guest
|
Posted: Wed Feb 01, 2006 7:06 pm Post subject: Re: font sizing problem |
|
|
"Z" <zingerNOSPAM (AT) wot (DOT) com> wrote:
| Quote: | Hello all,
I have an application and I have to zoom in and out of a document page in
it.
I draw the document in a paintbox.
Sizing the document is no problem (I know how to multiply my zoom
coefficient by the size of the page, and hence by the size of the objects).
However, text that appears on the document is a problem.
At present, I resize the font by first multiplying its size by the
coefficient, then calling a procedure that uses GetWindowExtEx and
GetViewportExtEx in succession in order to provide me with a pixels per inch
value that I can then apply to the font as follows :
Font.PixelsPerInch := 254 {trunc(Screen.Pixelsperinch*2.54) ;
On the screen, this results in blocky, jumpy changes when I zoom in and out.
Whereas of course, I would like to do the sort of precise zoom-in/zoom-out
as Word does.
If somebody could point me to the right method, I'd be grateful.
TIA.
Z
You might take a look at: |
setwindowextEx(...) and setviewportExtEx(...) instead of messing with
font size.
using them something like this:
logX:=getDeviceCaps(paintdc,logpixelsx); {logical pixels/inch}
logY:=getDeviceCaps(paintdc,logpixelsy);
setwindowextEx(paintdc,logX,LogY,nil);
setviewportExtEx(paintdc,round(logX*(magnify/100.0)),round(logY*(magnify/100.0)),nil);
//now draw text etc
where LogX and LogY are logical pixels/inch of paintdc, which is the
display context (Paintbox1.canvas.handle) and magnify is the
magmification in %, 50 = 50% magnification.
These routines can also be used to work with different printer
resolutions (logX,LogY) etc.
|
|