OldTEditFormat.mesa Edited by McGregor on January 27, 1983 3:02 pm
Edited by Paxton on December 2, 1982 2:48 pm
Edited by Plass on February 1, 1983 9:15 am
DIRECTORY
NodeStyle USING [Ref, TabStop],
TEditCompile USING [maxCharsPerLine],
TEditDocument USING [LineBreak, TEditDocumentData],
TextEdit USING [Offset, RefTextNode],
TextNode USING [Location],
UnifiedFonts USING [FONT, FixedUnit];
TEditFormat: CEDAR DEFINITIONS = BEGIN
TEditDocumentData: TYPE = TEditDocument.TEditDocumentData;
Dimension: TYPE = UnifiedFonts.FixedUnit;
FormatLine:
PROC [tdd: TEditDocumentData,
node: TextEdit.RefTextNode,
startOffset: TextEdit.Offset,
nodeStyle: NodeStyle.Ref, lineWidth: Dimension,
buildBitmap:
BOOL ←
FALSE]
RETURNS [LineInfo] ;
LineInfo: TYPE = REF LineInfoRec ;
LineInfoRec:
TYPE =
MACHINE DEPENDENT RECORD [
chars: ARRAY [0..TEditCompile.maxCharsPerLine) OF CharInfo,
nextPos: TextNode.Location,
yOffset: Dimension ← [0],
ascent: Dimension ← [0],
descent: Dimension ← [0],
width: Dimension ← [0],
nChars: INTEGER ← 0,
indent: Dimension ← [0],
leading: Dimension ← [0],
break: TEditDocument.LineBreak ← wrap,
filler: PRIVATE [0..16384) ← 0 -- left over bits
];
The chars field in the LineInfoRec is first so that simple pointer arithmetic can be used to get fast sequential access to the CharInfo fields
CharInfo:
TYPE =
MACHINE DEPENDENT RECORD [
filler: [0..256) ← 0, -- UnifiedFonts expects unpacked characters
char: CHAR ← '\000, -- 8 bits
width: Dimension ← [LAST[INT]],
vShift: Dimension ← [0],
font: UnifiedFonts.FONT ← NIL, -- NIL if same as previous
tab: NodeStyle.TabStop ← NIL,
strikeout: BOOL ← FALSE, -- 1 bit
underlining: BOOL ← FALSE, -- 1 bit
runLength: [0..LAST[CARDINAL]/4] ← 1 -- font and vshift doesn't change for at least this much
];
END.
Michael Plass, February 1, 1983 9:15 am: conversion to UnifiedFonts