EntityProc: PressReader.EntityProc = {
-- Xe, Ye, fontSet
xe: INT ← entityTrailer.Xe;
ye: INT ← entityTrailer.Ye;
x: INT ← xe;
y: INT ← ye;
lastShowX, lastShowY: INT ← -1;
currentFont: ShowPress.FontRec; -- will be established by setFont
currentSpaceX, currentSpaceY: INT; -- will be established by setFont
hue: REAL ← 0.0;
saturation: REAL ← 1.0;
brightness: REAL ← 0.0;
skipAlternative, inAlternative: BOOL ← FALSE;
reposition: BOOLEAN ← FALSE;
showCharactersProc: PressReader.ShowCharactersProc = {
xw, yw: INT ← 0;
IF skipAlternative THEN RETURN;
IF lastShowY # y
THEN {
stream.PutChar['\n];
lastShowX ← 2540;
};
IF ABS[x - lastShowX] < 50 THEN NULL
ELSE
FOR i:
INT ← x - lastShowX, i - 175
UNTIL i <= 0
DO
stream.PutChar[' ]
ENDLOOP;
FOR i:
INT
IN [0..text.Length[])
DO
c: CHAR ← text.Fetch[i];
IF c = '
THEN {
xw ← xw+currentSpaceX;
yw ← yw+currentSpaceY;
}
ELSE
IF currentFont.imagerFont #
NIL
THEN {
widthVec: ImagerFont.VEC ~ ImagerFont.Width[currentFont.imagerFont, [0, ORD[c]]];
xw ← xw+Real.RoundLI[widthVec.x];
yw ← yw+Real.RoundLI[widthVec.y];
}
ENDLOOP;
stream.PutRope[text];
x ← x + xw;
y ← y + yw;
lastShowX ← x;
lastShowY ← y;
}; -- showCharactersProc
fontProc: PressReader.FontProc = {
IF skipAlternative THEN RETURN;
currentFont ← fontTable[entityTrailer.fontSet*16+font];
};
positionProc: PressReader.PositionProc = {
IF skipAlternative THEN RETURN;
IF opCode = setX THEN x ← xe + value
ELSE y ← ye + value;
reposition ← TRUE;
};
spacingProc: PressReader.SpacingProc = {
IF skipAlternative THEN RETURN;
SELECT opCode
FROM
setSpaceX, setSpaceXShort => currentSpaceX ← value;
setSpaceY, setSpaceYShort => currentSpaceY ← value;
resetSpace => {
currentSpaceX ← 200;
currentSpaceY ← 0;
};
ENDCASE => ERROR;
IF opCode = resetSpace THEN NULL ELSE NULL;
};
spaceProc: PressReader.SpaceProc = {
showCharactersProc[showCharacterImmediate, 1, " "];
};
colorProc: PressReader.ColorProc = {
IF skipAlternative THEN RETURN;
SELECT opCode
FROM
setHue => NULL;
setSaturation => NULL;
setBrightness => NULL;
ENDCASE => ERROR;
};
showRectangleProc: PressReader.ShowRectangleProc = {
IF skipAlternative THEN RETURN;
NULL;
};
alternativeProc: PressReader.AlternativeProc = {
IF (types = 0)
AND (elBytes = 0)
AND (dlBytes = 0)
THEN
inAlternative ← skipAlternative ← FALSE
ELSE IF inAlternative THEN skipAlternative ← TRUE
ELSE inAlternative ← TRUE;
};
showObjectProc: PressReader.ShowObjectProc = {
NULL;
}; -- showObjectProc
showDotsProc: PressReader.ShowDotsProc = {
NULL;
}; -- showDotsProc
fontProc[0];
pressFile.GetCommands[
showCharactersProc: showCharactersProc,
fontProc: fontProc,
positionProc: positionProc,
spacingProc: spacingProc,
spaceProc: spaceProc,
colorProc: colorProc,
showRectangleProc: showRectangleProc,
alternativeProc: alternativeProc,
showObjectProc: showObjectProc,
showDotsProc: showDotsProc
];
}; -- EntityProc
stream.PutRope["\n\n------------------------------------------------------------------------"];