DIRECTORY Graphics USING [Context], NodeStyle USING [Ref, TabStop, FontUnderlining], Scaled USING [Value, zero], TEditDocument USING [TEditDocumentData, LineBreak], TextEdit USING [Offset, RefTextNode], TextLooks USING [Looks], TextNode USING [Location], Font; TEditFormat: CEDAR DEFINITIONS = BEGIN TEditDocumentData: TYPE = TEditDocument.TEditDocumentData; LineInfo: TYPE = REF LineInfoRec; LineInfoRec: TYPE = RECORD [ charInfo: CharInfo, formatInfo: FormatInfo, positionInfo: PositionInfo, startPos, nextPos: TextNode.Location, xOffset: Scaled.Value, xmin, ymin, xmax, ymax: INTEGER, nChars: NAT, break: TEditDocument.LineBreak ]; CharNumber: TYPE = [0..LAST[CARDINAL]/SIZE[CharInfoEntry]-8); CharInfo: PUBLIC TYPE = REF CharInfoRec; CharInfoRec: PUBLIC TYPE = RECORD [ seq: SEQUENCE maxLength: CharNumber OF CharInfoEntry ]; CharInfoEntry: TYPE = RECORD [ char: CHAR, formatNumber: FormatNumber, width: Scaled.Value ]; FormatNumber: TYPE = [0..LAST[CARDINAL]/SIZE[FormatInfoEntry]-16); FormatInfo: PUBLIC TYPE = REF FormatInfoRec; FormatInfoRec: PUBLIC TYPE = RECORD [ length: FormatNumber _ 0, seq: SEQUENCE maxLength: FormatNumber OF FormatInfoEntry ]; FormatInfoEntry: TYPE = RECORD [ looks: TextLooks.Looks, font: Font.FONT _ NIL, tab: NodeStyle.TabStop _ NIL, vShift: Scaled.Value _ Scaled.zero, strikeout, underlining: NodeStyle.FontUnderlining _ None ]; PositionInfo: PUBLIC TYPE = REF PositionInfoRec; PositionInfoRec: PUBLIC TYPE = RECORD [ seq: SEQUENCE maxLength: CharNumber OF INTEGER ]; FormatLine: PROC [self: LineInfo, tdd: TEditDocumentData, node: TextEdit.RefTextNode, startOffset: TextEdit.Offset, nodeStyle: NodeStyle.Ref, lineWidth: Scaled.Value, forPaint: BOOLEAN _ FALSE, doLigsAndKern: BOOLEAN _ FALSE ]; Paint: PROC [lineInfo: LineInfo, context: Graphics.Context, whiten: BOOLEAN _ FALSE]; Resolve: PROC [lineInfo: LineInfo, x: INTEGER] RETURNS [loc: TextNode.Location, xmin, width: INTEGER, rightOfLine: BOOLEAN]; CharPosition: PROC [lineInfo: LineInfo, offset: TextEdit.Offset] RETURNS [x, width: INTEGER]; Allocate: PROC RETURNS [lineInfo: LineInfo]; Release: PROC [lineInfo: LineInfo]; END. jTEditFormat.mesa Copyright (C) 1984, Xerox Corporation. All rights reserved. Edited by Plass on December 26, 1984 9:18:05 am PST Edited by McGregor on January 27, 1983 3:02 pm Edited by Paxton on December 2, 1982 2:48 pm A (perhaps slightly generous) bounding box for the line. Paints the line with its origin at the current position. The LineInfo must have been created with forPaint: TRUE. Finds the character pointed to. Finds the position of the indicated character. Returns FIRST[INTEGER] or LAST[INTEGER] if the character occurs before or after the line, respectively. This is how to get working space. Keeps a small cache of storage. A promise that the client is done with this LineInfo. Use whenever possible to save on allocations. Michael Plass, February 1, 1983 9:15 am: conversion to UnifiedFonts Michael Plass, December 26, 1984: conversion to Imager Κ:˜Jšœ™J™