BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: font sizing problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Patrick Shields
Guest





PostPosted: Wed Feb 01, 2006 7:06 pm    Post subject: Re: font sizing problem Reply with quote



"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.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.