<> <> DIRECTORY MathBox USING [BOX], MathTypes USING [Style], Imager USING [Context], ImagerFont USING [Extents], Rope USING [ROPE], Vector USING [VEC]; MathRules: CEDAR DEFINITIONS ~ BEGIN <> <<>> VEC: TYPE ~ Vector.VEC; ROPE: TYPE ~ Rope.ROPE; BOX: TYPE ~ MathBox.BOX; Style: TYPE ~ MathTypes.Style; <> <> AtomBoxProc: TYPE ~ PROC[value: ROPE, style: Style] RETURNS[ImagerFont.Extents]; <> AtomPaintProc: TYPE ~ PROC[value: ROPE, style: Style, context: Imager.Context, absBox: BOX]; <> <> CompoundBoxProc: TYPE ~ PROC[boxes: LIST OF BOX] RETURNS[LIST OF BOX]; <> CompositionProc: TYPE ~ PROC[boxes: LIST OF BOX] RETURNS[BOX, LIST OF BOX]; <> AtomToASRopeProc: TYPE ~ PROC[value: ROPE] RETURNS[ROPE]; <> <> Alignment2D: TYPE ~ RECORD [ tag: ATOM, -- id of box to be aligned hAttach: Alignment, -- horizontal alignment vAttach: Alignment -- vertical alignment ]; Alignment: TYPE ~ RECORD [ tag: ATOM, -- id of box to align with offset1: Offset, -- relative offset of box to be aligned offset2: Offset -- relative offset of box to align with ]; Offset: TYPE ~ RECORD [ wrt: {left, right, top, bottom, center, origin} _ left, -- offset w.r.t. location pos: REAL _ 0.0 -- relative position (deviation from w.r.t. point) ]; TaggedOffset: TYPE ~ RECORD [ tag: ATOM, offset: Offset ]; <> Size: TYPE ~ {normal, script, scriptscript, big}; <> AlignHorizontal: PROC[box1: ImagerFont.Extents, offset1: Offset, box2: BOX, offset2: Offset] RETURNS[REAL]; <> << Returns x offset for box1.>> AlignVertical: PROC[box1: ImagerFont.Extents, offset1: Offset, box2: BOX, offset2: Offset] RETURNS[REAL]; <> << Returns y offset for box1.>> <> Compose: PROC[boxes: LIST OF BOX, alignments: LIST OF Alignment2D, hOrigin, vOrigin: TaggedOffset] RETURNS[BOX, LIST OF BOX]; <> << Returns information expected from a CompositionProc.>> <<>> ComposeMatrix: PROC[nRows, nCols: NAT, boxes: LIST OF BOX, spaceBox, openSymBox, closeSymBox: BOX] RETURNS[BOX, LIST OF BOX, BOX, BOX]; <> << Returns information expected by Format, preserving input row&col orderings.>> <<>> RowColFromAtom: PROC[rc: ATOM] RETURNS[NAT, NAT]; <> <> << SIGNALS badFormat if rc does not conform to the format $r#c#>> <<>> AtomFromRowCol: PROC[row, col: NAT] RETURNS[ATOM]; <> <> ComputeSize: PROC[base, adjustment: Size] RETURNS[Size]; <> <<>> VecFromSize: PROC[size: Size] RETURNS[VEC]; <> <> unable: ERROR[reason: ATOM]; badFormat: ERROR; END.