Article View: comp.os.ms-windows.programmer.misc
Article #1723Re: Window's co-ordinates ?
From: John Grant
Date: Mon, 14 Dec 1992 00:32
Date: Mon, 14 Dec 1992 00:32
39 lines
2200 bytes
2200 bytes
In article <13DEC199204274690@vms1.iscs.nus.sg> nuscss1@vms1.iscs.nus.sg (Vax BULLET-IN-Board SysOps) writes: > Hi Gurus, > > I have this app in which some text is positioned and printed > in a window using the TextOut function. Mapping mode is the > default MM_TEXT. In normal VGA mode, it > works flawlessly. BUT, when I switch to SuperVGA with LARGE fonts, > the text are wrongly positioned ! However, SuperVGA with SMALL fonts > presents no such problem. > > I'm really puzzled at this. Does the way Windows handles coordinates > differ with different font sizes ? I've always thought that TextOut > uses the logical coordinates, and therefore, Windows should be able > to take care of any differences. Apparently I was mistaken. > > Any advice/tips/help would be greatly appreciated. > Thanx. > > BTW, I've tried this out on a Paradise SuperVGA and a Taiwanese > Tseng Labs SuperVGA card, installed the 800x600 large font drivers, > and both had the same problem. In MM_TEXT mode, 1 logical unit = 1 physical unit (pixel). If you have more pixels in a higher res card, then you also have more logical units. You should use a different mapping mode like MM_ISOTROPIC where you can set specific logical co-ordinate limits which map to the physical limits. Use GetClientRect to get the size of the window and then map perhaps x=[0,1000] y=[0,1000] logical units to the physical no. of pixels. I forget how to do this, but Petzold's "Programming Windows 3.1" shows how. I think it uses things like SetWindowExt, SetViewportExt,SetWindowOrg etc. Then you can use logical co-ordinates [0,1000] and it will always come out right. -- John A. Grant jagrant@emr1.emr.ca Airborne Geophysics Geological Survey of Canada, Ottawa
Technical Details
Message-ID:
<1992Dec14.003236.14795@emr1.emr.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrantReferences:
<13DEC199204274690@vms1.iscs.nus.sg>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!nott!emr1!jagrant From: jagrant@emr1.emr.ca (John Grant) Subject: Re: Window's co-ordinates ? Message-ID: <1992Dec14.003236.14795@emr1.emr.ca> Organization: Energy, Mines, and Resources, Ottawa References: <13DEC199204274690@vms1.iscs.nus.sg> Date: Mon, 14 Dec 1992 00:32:36 GMT Lines: 39