IIMask.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, August 22, 1986 11:14:25 am PDT
Doug Wyatt, March 7, 1986 2:57:21 pm PST
DIRECTORY
IIFont USING [CorrectionType, XChar],
IISample USING [SampleMap],
Scaled USING [Value],
SF USING [Box, BoxAction, BoxGenerator, Vec];
IIMask: CEDAR DEFINITIONS
~ BEGIN
Box: TYPE ~ SF.Box;
BoxAction: TYPE ~ SF.BoxAction;
BoxGenerator: TYPE ~ SF.BoxGenerator;
SampleMap: TYPE ~ IISample.SampleMap;
Run: TYPE ~ MACHINE DEPENDENT RECORD [fMin: CARDINAL, lastRun: BOOL, fSize: NAT];
Same as PDFileFormat.Run; fMin is relative to fMinBB.
CharMask: TYPE ~ REF CharMaskRep;
CharMaskRep: TYPE ~ MACHINE DEPENDENT RECORD [
font: REF, -- font and char together provide a unique identifier for this mask
char: IIFont.XChar,
sWidth, fWidth: Scaled.Value,
sMinBB, fMinBB: INTEGER,
sSizeBB, fSizeBB: CARDINAL,
metricsValid: BOOL, -- numbers above are invalid if this is true.
amplified: BOOL,
correction: IIFont.CorrectionType,
flag: PACKED ARRAY [0..10) OF [0..1], -- for padding and expansion
data: SELECT rep: * FROM
raster => [bits: SEQUENCE COMPUTED CARDINAL -- sSize*Ceiling[fSize/16.0] -- OF WORD],
runs => [run: SEQUENCE nRuns: CARDINAL OF Run],
uncached => [],
ENDCASE
];
RunProc: TYPE ~ PROC [min: SF.Vec, count: NAT];
BoxesFromBitmap: PROC [bitmap: SampleMap, boxAction: BoxAction];
BoxesFromBits: PROC [base: LONG POINTER, wordsPerLine: NAT, sBits, fBits, sSize, fSize: NAT, sRuns, fRuns: INTEGER, boxAction: BoxAction];
(sBits, fBits) is the min corner of the rectangle in the bitmap.
(sRuns, fRuns) is the min corner of the rectangle in the output coordinate system.
For each run, sMin IN [sRuns..sRuns+sSize) AND fMin IN [fRuns..fRuns+fSize)
RunsFromBoxes: PROC [boxes: BoxGenerator, run: RunProc];
RunsFromCharMask: PROC [charMask: CharMask, run: RunProc, s, f: INTEGER, clip: Box];
The origin of the character mask is at (s, f); all runs will lie within clip.
BitmapFromCharMask: PROC [charMask: CharMask] RETURNS [SampleMap];
END.