-- Text.mesa
-- Last changed by Doug Wyatt, August 21, 1980 1:25 PM

DIRECTORY
Vector USING [Vec],
Clipper USING [Handle];

Text: DEFINITIONS = {

Handle: TYPE = LONG POINTER TO Object;

-- Client interface for a Text object

Info: TYPE = RECORD [size, origin, width: Vector.Vec];

CharInfo: PROCEDURE[self: Handle, c: CHARACTER,
info: POINTER TO Info] = INLINE {
self.procs.CharInfo[self,c,info]
};
StringInfo: PROCEDURE[self: Handle, s: LONG STRING,
info: POINTER TO Info] = INLINE {
self.procs.StringInfo[self,s,info]
};
FontInfo: PROCEDURE[self: Handle,
info: POINTER TO Info] = INLINE {
self.procs.FontInfo[self,info]
};
DrawChar: PROCEDURE[self: Handle, c: CHARACTER,
origin: Vector.Vec, clipper: Clipper.Handle]
RETURNS[Vector.Vec] = INLINE {
RETURN[self.procs.DrawChar[self,c,origin,clipper]]
};
DrawString: PROCEDURE[self: Handle, s: LONG STRING,
origin: Vector.Vec, clipper: Clipper.Handle]
RETURNS[Vector.Vec] = INLINE {
RETURN[self.procs.DrawString[self,s,origin,clipper]]
};
Free: PROCEDURE[selfPtr: LONG POINTER TO Handle] = INLINE {
IF selfPtr↑#NIL THEN selfPtr↑.procs.Free[selfPtr]
};

-- Actual representation for a Text interface

Object: TYPE = RECORD [
procs: LONG POINTER TO READONLY Procs,
data: LONG POINTER TO Data
];

Procs: PRIVATE TYPE = RECORD [
CharInfo: PROCEDURE[self: Handle, c: CHARACTER,
info: POINTER TO Info],
StringInfo: PROCEDURE[self: Handle, s: LONG STRING,
info: POINTER TO Info],
FontInfo: PROCEDURE[self: Handle,
info: POINTER TO Info],
DrawChar: PROCEDURE[self: Handle, c: CHARACTER,
origin: Vector.Vec, clipper: Clipper.Handle]
RETURNS[Vector.Vec],
DrawString: PROCEDURE[self: Handle, s: LONG STRING,
origin: Vector.Vec, clipper: Clipper.Handle]
RETURNS[Vector.Vec],
Free: PROCEDURE[selfPtr: LONG POINTER TO Handle]
];

Data: PRIVATE TYPE;

}.