[net.micro.mac] Rotating "fonts" on the LaserWriter

dma@mhuxl.UUCP (Diana M. Abelbeck AT&T Technologies, Inc.) (11/07/85)

[]

Does anyone know how to "draw" rotated text to the LaserWriter?  I don't
mean a rotated bitmap, I do that now, I mean a rotated "font".
(Landscape and Portrait Mode is not my question here.)

MacDraw can do it, and a Quickdraw Picture copied to the clipboard from
MacDraw yields the proper result on the LaserWriter with a simple
DrawPicture() call.

Peeking at the QD Picture results in a type "int" defining the angle of
the character rotation in degrees clockwise from 12 o'clock Before the
DrawString() is performed and a standard BitMap rotation follows the
DrawString() command.

Since QD does not handle rotation, my question is how do you create a
QD picture without a QD rotate call?

This topic only affects the LaserWriter since it is capable of drawing
"fonts" (ala high quality) at any angle, all the other output devices
draw a bitmap and I already rotate the font on a bitmap.

Thanks...

Lonnie Ablebeck
ihnp4!mhuxl!dma

awd@ut-ngp.UTEXAS (Andrew W. Donoho) (11/09/85)

The May 1985 Software Supplement includes a document called,
"Optimizing Code for the LaserWriter."  Along with a lot of other
juicy information about the Macintosh LaserWriter driver, there is a
section called, "QuickDraw Comments for Text Rotation/Justification
and Polygons."  This section containts a complete description of how
to rotate text using the LaserWriter.  Here is some of what is described
there:

Using the PicComment routine to add comments to a picture, an
application can take advantage of features that a printer might have
which are not directly available in QuickDraw, such as rotated text.

CommentType	#	data size	data		description
TextBegin	150	6 bytes		TTxtPicRec	Begin special text
TextEnd		151	none		none		End special text
TextCenter	154	8 bytes		TTxtCenter	Offset for rotation

where TTxtPicRec and TTxtCenter are Pascal records as follows:

TTxtPicRec =	PACKED RECORD
		  tJus: Byte;		{0,1,2,3,4:none,left,center,right,fill)
		  tFlip: Byte;		{0,1,2:none,horizontal,vertical}
		  tRot: Integer;	{0..360:degrees of rotation}
		  tRes: Integer;	{"reserved"}
		END;

TTxtCenter =	PACKED RECORD
		  yInt: Integer;	{Integer part of y offset to center}
		  yFract: Integer;	{Fractional part of y offset to center}
		  xInt: Integer;	{Integer part of x offset to center}
		  xFract: Integer;	{Fractional part of x offset to center}
		END;

Then you can call like this to justify and/or flip text:

PicComment(150,6,@TxtPicRec);		{set justifying}
  DrawString('This text will be justified and flipped.');
PicComment(151,0,NIL);			{end the special effects}

To rotate text, try something like this:

PicComment(150,6,@TxtPicRec);		{set rotating}
PicCommment(154,8,@TxtCenter);		{specify center of rotation}
  DrawString('This text will be rotated.');
PicComment(151,0,NIL);			{end the special effects}

If you want to do any more than these few minimum things, try reading
the Apple document, it is very useful for anyone using the
LaserWriter.

Darin Adler