[comp.sys.mac.programmer] Help on Tabs

jerry@csd4.milw.wisc.edu (Jerry Lieberthal) (07/22/88)

Well, I finally have time to do a little MAC programming.  I am trying to
write a C program to print special forms on an Imagewriter II.  There is
no problem with vertical spacing; I have a routine that does that correctly.

Does anyone have a neat little subroutine to calculate how to tab to a
certain column before using "drawstring"?  I know that a certain box is in
column 44 of line 5, but am having trouble getting it there.  Originally I
started by using widMax of fontinfo, and then trying to estimate by number
of characters how many horizontal points to move across.  Is there a better
(easier) way?

Thanks in advance,

- jerry
  jerry@csd4.milw.wisc.edu
  University Of Wisconsin-Milwaukee
  College of Engineering

bob@eecs.nwu.edu (Bob Hablutzel) (07/22/88)

Probably the easiest thing to do is to figure out the location of the box,
and issue a _DrawString.  By "figuring out" I mean taking a guess at the
location, and adjusting until it looks right. You don't want to rely on the
width of the character, as the character fonts may not be monospaced.

As a first guess - 44 columns by, say 6 pixels for a character, is 264, while
5 lines by about 11 pixels is 55. Try moving to (55,264).

Bob Hablutzel
Disclaimer - The university usually disagrees with me. I'm usually right.