I need to know it for a macro, inspired by one developed by Gordon
McComb, which counts lines in a document, but must consider as one every
two lines whose length is bigger than 15,33 inches (one third of a
16-inch line).
I cannot base calculations on number of characters because I must use
variable-pitch fonts, in order to save space.
Any hint would be warmly welcome.
To tell you the truth, I haven't done this since Windows 3.x days.
Windows 95 uses more data structures for its API calls. And though
WPWin 8 is supposed to be able to pass structures to Windows API calls,
I have never gotten that bum Dan Broadhead, who works in the
PerfectScript group, to send me an example of how it works. If Win95
now does this win structures, it's going to complicate things. Time to
get out the Win32 API book...
(The "bum" comment is for Paul, Ray, or Steve who might forward this to
Dan; maybe I'll get that example now... <g>)
-- Gordon
But...I wonder if testing the actual width of the line is really
necessary. If it's character counting, the macro could select a line of
text, poick it up with ?SelectedText, and test its length (there's also
a system var just for returning the length of the selection; may be
faster than using ?SelectedText).
You could then use that value with the ?FontSize system variable to
determine the general metrics of the font. It's not completely
accurate, though, because some proportional fonts are wider or narrower
than "normal" proportional fonts.
If ?FontSize won't work, then perhaps the ?Pos system variable might.
It would tell you the position of the insertion point, in WPUnits.
-- Gordon