Picture

Erik Zuurbier F.S.A.Zuurbier@inter.nl.net
Sun, 9 Jul 2000 14:20:07 +0200


I am writing  a program that compiles an sgml file and produces another
file that contains precise drawing instructions, either for a Picture in a
Window, or for a Picture on a Print. As they have different dimensions and
resolutions, the resulting drawing instructions are different.

When the program prepares the resulting file, it has to consult the Picture
many times, by setting the picture font, and then retrieving the width of a
string:

PrepareFile :: File .... Picture -> (*File,Picture)
PrepareFile sgmlFile ... picture
	# ...
	  picture	= SetFont myFont picture
	  (stringWidth,picture)	= PictureStringWidth myString picture
	  ...
	= (drawFile,picture)

At the end I need the drawFile, not the picture.

But the problem is that there is no way to call PrepareFile. The only way
to get
hold of a Picture is through:

DrawInWindow :: !WindowId ![DrawFunction] !(IOState s) -> IOState s
:: DrawFunction	:== Picture -> Picture

for Window pictures, or through:

print	::	!Bool !Bool
			.(PrintInfo !*Picture -> ([DrawFunction],!*Picture))
			!PrintSetup !*printEnv
		->	(!PrintSetup,!*printEnv)
		|	PrintEnvironments printEnv

There seems to be no way to involve a picture in a calculation to produce
something other than a picture, such as the file in my case.

Have I overlooked a function in the IOInterface 0.8.1?
Has this been cured in the Object IO system?

Regards Erik Zuurbier