<> <> DIRECTORY ImagerFont USING [Extents], MathTypes USING [FormatClass], Vector USING [VEC]; MathBox: CEDAR DEFINITIONS ~ BEGIN <> <<>> VEC: TYPE ~ Vector.VEC; FmtClass: TYPE ~ MathTypes.FormatClass; <<>> <> <> <<>> BOX: TYPE ~ REF BoxRep; -- external abstract type BoxRep: TYPE; -- internal concrete rep BoxType: TYPE ~ {absolute, relative}; <<>> <> Scale: PROC[b: BOX, v: VEC] RETURNS[BOX]; <> <<>> Inside: PROC[b: BOX, x, y: REAL] RETURNS[BOOL]; <> << Otherwise returns FALSE.>> <<>> AlignHorizontal: PROC[box1: ImagerFont.Extents, offset1: REAL, box2: BOX, offset2: REAL] RETURNS[REAL]; <> << points (offset1 * WIDTH[box1]) and (offset2 * WIDTH[box2]) are aligned.>> << Offsets are measured from the left edge of a box.>> << Returns the x offset for box1.>> <<>> AlignVertical: PROC[box1: ImagerFont.Extents, offset1: REAL, box2: BOX, offset2: REAL] RETURNS[REAL]; <> << (offset1 * HEIGHT[box1]) and (offset2 * HEIGHT[box2]) are aligned.>> << Offsets are measured from the bottom edge of a box.>> << Returns the y offset for box1.>> <<>> RelToAbsBox: PROC[relBox, parentBox: BOX] RETURNS[BOX]; <> <> << by positioning it relative to parentBox>> <> MakeBox: PROC[tag: ATOM, aliases: LIST OF ATOM, formatClass: FmtClass, type: BoxType, extents: ImagerFont.Extents _ [0.0, 0.0, 0.0, 0.0], offset: VEC _ [0.0, 0.0], subscriptHint, superscriptHint: BOX _ NIL] RETURNS[BOX]; <> ChangeOffset: PROC[box: BOX, newOffset: VEC] RETURNS[BOX]; <> ChangeExtents: PROC[box: BOX, newExtents: ImagerFont.Extents] RETURNS[BOX]; <> <<>> ChangeType: PROC[box: BOX, newType: BoxType] RETURNS[BOX]; <> <<>> ChangeFormatClass: PROC[box: BOX, newFormatClass: FmtClass] RETURNS[BOX]; <> <<>> ChangeSubHint: PROC[box: BOX, subscriptHint: BOX] RETURNS[BOX]; <> ChangeSuperHint: PUBLIC PROC[box: BOX, superscriptHint: BOX] RETURNS[BOX]; <> <<>> <<>> <<>> <> Width: PROC[b: BOX] RETURNS[REAL]; <> Height: PROC[b: BOX] RETURNS[REAL]; <> <<>> Tag: PROC[b: BOX] RETURNS[ATOM]; <> <<>> Aliases: PROC[b: BOX] RETURNS[LIST OF ATOM]; <> <<>> FormatClass: PROC[b: BOX] RETURNS[FmtClass]; <> Extents: PROC[b: BOX] RETURNS[ImagerFont.Extents]; <> <<>> Offset: PROC[b: BOX] RETURNS[VEC]; <> <<>> Origin: PROC[b: BOX] RETURNS[VEC]; <> Type: PROC[b: BOX] RETURNS[BoxType]; <> << Else returns absolute.>> <<>> SubscriptHint: PROC[b: BOX] RETURNS[BOX]; <> << Returns NIL if no hint exists.>> SuperscriptHint: PROC[b: BOX] RETURNS[BOX]; <> << Returns NIL if no hint exists.>> <<>> <<>> <<>> <> GetBox: PROC[tag: ATOM, boxes: LIST OF BOX, useAliases: BOOL _ TRUE] RETURNS[BOX]; <> << If useAliases = TRUE, then checks for BOX in boxes with alias tag.>> << SIGNALS boxNotFound if no association exists.>> MapBoxList: PROC[boxes: LIST OF BOX, proc: PROC[b: BOX] RETURNS[BOX]] RETURNS[LIST OF BOX]; <> << BOX in boxes. Element positions in list are not preserved.>> <<>> <<>> <> boxNotFound: ERROR; wrongBoxType: ERROR; END.