In early Jan 2000, I asked if anyone knew how to use the Windows API functions to get the exact size of text strings before placing them on a mapper. At first no one had a clue. Then I whined and groused some more, said it couldn't be done by mortals, impossible, etc. Well, since nobody believes me anyway when I say something can't be done, soon some suggestions and guesses started coming in to hint that some mortals at least know there's a way. Thanks to Martin Higham, Richard Burkman, Richard Herrington, and especially Carol Sheehan for getting particularly close to the whole answer. Piecing together the clues, and poking around in some too-big books on the Windows API, I have an answer that works now. I've posted working 32-bit mapbasic source code that shows one way to do this (see TextDemo.zip at http://www.directionsmag.com/tools/default.asp?a=file&id=240), so if anyone's interested they can try it out. Although this demo doesn't appear to do a whole lot more than MapInfo's CreateText() function, it does get the same results, and it shows some of the inner workings about manipulating text graphics under the surface of Windows. These lower-level functions can be exploited if you want to build routines to plot text on a curve or output mixed style text, or if you wanted to work back from mapped text and calculate its point size, and so on. On lat/long "projections" it matches perfectly what you get with CreateText(), and on real projections, it's very close (I haven't tracked down the source of the slight error, but I suspect it has something to do with how I'm scaling between map units and window units.) If anyone has any better ideas or suggestions for improving TextDemo (like how can I use dwcbk32d.ocx from MapBasic to set up a callback function to get the EnumFonts() functions to work?), I'd be interested in your ideas. Thanks for all the help; as usual, this list is a gold mine! - Bill Thoen ---------------------------------------------------------------------- To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
