PrePressFontFormat.mesa
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Doug Wyatt, March 7, 1985 2:32:05 pm PST
DIRECTORY
Basics USING [BYTE, CARD, SwapHalves],
RealConvert USING [BcplReal];
PrePressFontFormat: CEDAR DEFINITIONS
IMPORTS Basics
~ BEGIN
BYTE: TYPE ~ Basics.BYTE;
CARD: TYPE ~ Basics.CARD;
BcplCard: TYPE ~ MACHINE DEPENDENT RECORD[highbits: CARDINAL, lowbits: CARDINAL];
A BCPL doubleword (unsigned); order of the halves is the reverse of the Mesa convention.
BcplInt: TYPE ~ MACHINE DEPENDENT RECORD[highbits: INTEGER, lowbits: CARDINAL];
A BCPL doubleword (signed); order of the halves is the reverse of the Mesa convention.
CardFromBcpl: PROC[x: BcplCard] RETURNS[CARD]
~ TRUSTED INLINE { RETURN[Basics.SwapHalves[LOOPHOLE[x]].lc] };
BcplFromCard: PROC[x: CARD] RETURNS[BcplCard]
~ TRUSTED INLINE { RETURN[LOOPHOLE[Basics.SwapHalves[[lc[x]]]]] };
IntFromBcpl: PROC[x: BcplInt] RETURNS[INT]
~ TRUSTED INLINE { RETURN[Basics.SwapHalves[LOOPHOLE[x]].li] };
BcplFromInt: PROC[x: INT] RETURNS[BcplInt]
~ TRUSTED INLINE { RETURN[LOOPHOLE[Basics.SwapHalves[[li[x]]]]] };
BcplReal: TYPE ~ RealConvert.BcplReal;
A BCPL floating point number; use RealConvert to convert to Mesa REAL.
IXType: TYPE ~ MACHINE DEPENDENT {
end(0), -- end of index part
name(1), -- NameIndexEntry follows
spline(2), -- StdIndexEntry follows
character(3), -- CharacterIndexEntry follows
width(4), -- StdIndexEntry follows
orbit(5), -- CharacterIndexEntry follows
multipleCharacter(6), -- MultipleCharacterIndexEntry follows
(17B)
};
IXHeader: TYPE ~ MACHINE DEPENDENT RECORD[
type(0:0..3): IXType, -- type of entry
length(0:4..15): [0..7777B] -- length of entry, including this header
];
NameIndexEntry: TYPE ~ MACHINE DEPENDENT RECORD[ -- ix.type = name
code(0:0..15): CARDINAL, -- numeric code for this name
chars(1): PACKED ARRAY[0..20) OF BYTE -- name as a BCPL string: first byte is length
];
StdIndexEntry: TYPE ~ MACHINE DEPENDENT RECORD[ -- ix.type = spline, width
family(0:0..7): BYTE, -- family name, using a name code
face(0:8..15): BYTE, -- face encoding
bc(1:0..7): BYTE, -- beginning character
ec(1:8..15): BYTE, -- ending character
size(2:0..15): CARDINAL, -- size in micas
rotation(3:0..15): CARDINAL, -- rotation in minutes of arc anticlockwise
segmentSA(4:0..31): BcplCard, -- starting address in file of the segment (in words!)
segmentLength(6:0..31): BcplCard -- length of the segment (in words!)
];
CharacterIndexEntry: TYPE ~ MACHINE DEPENDENT RECORD[ -- ix.type = character, orbit
family(0:0..7): BYTE, -- family name, using a name code
face(0:8..15): BYTE, -- face encoding
bc(1:0..7): BYTE, -- beginning character
ec(1:8..15): BYTE, -- ending character
size(2:0..15): CARDINAL, -- size in micas
rotation(3:0..15): CARDINAL, -- rotation in minutes of arc anticlockwise
segmentSA(4:0..31): BcplCard, -- starting address in file of the segment (in words!)
segmentLength(6:0..31): BcplCard, -- length of the segment (in words!)
resolutionX(8:0..15): CARDINAL, -- 10 * resolution in scan lines per inch
resolutionY(9:0..15): CARDINAL -- 10 * resolution in bits per inch
];
MultipleCharacterIndexEntry: TYPE ~ MACHINE DEPENDENT RECORD[ -- ix.type=multipleCharacter
family(0:0..7): BYTE, -- family name, using a name code
face(0:8..15): BYTE, -- face encoding
bc(1:0..7): BYTE, -- beginning character
ec(1:8..15): BYTE, -- ending character
size(2:0..15): CARDINAL, -- size in micas
rotation(3:0..15): CARDINAL, -- rotation in minutes of arc anticlockwise
resolutionX(4:0..15): CARDINAL, -- 10 * resolution in scan lines per inch
resolutionY(5:0..15): CARDINAL, -- 10 * resolution in bits per inch
numSegs(6:0..15): CARDINAL -- number of segments
-- segs: ARRAY[0..numSegs) OF DatedSegmentEntry
];
DatedSegmentEntry: TYPE ~ MACHINE DEPENDENT RECORD[
segmentSA(0:0..31): BcplCard,
segmentLength(2:0..31): BcplCard,
expirationDate(4:0..31): BcplCard
];
CharacterSegment: TYPE ~ RECORD[
charData: CharacterDataArray[ec-bc+1],
directory: DirectoryArray[ec-bc+1]
-- followed by rasters, pointed to by the directory
];
CharacterData: TYPE ~ MACHINE DEPENDENT RECORD[
wx(0:0..31): BcplInt, -- x width (signed fraction)
wy(2:0..31): BcplInt, -- y width (signed fraction)
bbox(4:0..15): INTEGER, -- x offset for bounding box
bboy(5:0..15): INTEGER, -- y offset for bounding box
bbdx(6:0..15): INTEGER, -- width of bounding box (scan lines)
bbdy(7:0..15): INTEGER -- height of bounding box (bits) or missingCharacter
];
missingCharacter: INTEGER ~ -1;
value of bbdx in CharacterData for a missing character
CharDataArray: TYPE ~ RECORD[SEQUENCE COMPUTED CARDINAL OF CharacterData];
RelFilePos: TYPE ~ BcplInt;
missingFilePos: RelFilePos ~ LOOPHOLE[INT.LAST];
DirectoryArray: TYPE ~ RECORD[SEQUENCE COMPUTED CARDINAL OF RelFilePos];
RasterDefn: TYPE ~ MACHINE DEPENDENT RECORD[
raster(0:0..5): [0..77B], -- words per scan line
lines(0:6..15): [0..1777B] -- number of scan lines
-- bits: ARRAY[0..lines) OF ARRAY[0..raster) OF WORD
];
WidthSegment: TYPE ~ MACHINE DEPENDENT RECORD[
fbbox(0:0..15): INTEGER, -- x offset for font bounding box
fbboy(1:0..15): INTEGER, -- y offset for font bounding box
fbbdx(2:0..15): INTEGER, -- x width for font bounding box
fbbdy(3:0..15): INTEGER, -- y height for font bounding box
xWidthFixed(4:0..0): [0..1], -- 1 if all x widths equal
yWidthFixed(4:1..1): [0..1], -- 1 if all y widths equal
spare(4:2..15): [0..37777B] -- unused
-- xwidths: WidthArray[IF xWidthFixed THEN 1 ELSE ec-bc+1]
-- ywidths: WidthArray[IF yWidthFixed THEN 1 ELSE ec-bc+1]
];
WidthArray: TYPE ~ RECORD[SEQUENCE COMPUTED CARDINAL OF INTEGER];
missingWidth: INTEGER ~ LOOPHOLE[100000B];
value of WidthArray entry for a missing character
SplineSegment: TYPE ~ RECORD[
splineData: SplineDataArray[ec-bc+1],
directory: DirectoryArray[ec-bc+1]
-- followed by spline codes, pointed to by the directory
];
SplineData: TYPE ~ MACHINE DEPENDENT RECORD[
wx(0:0..31): BcplReal, -- width in x direction or missingSpline
wy(2:0..31): BcplReal, -- width in y direction
xmin(4:0..31): BcplReal, -- left edge of bounding box
ymin(6:0..31): BcplReal, -- bottom edge of bounding box
xmax(8:0..31): BcplReal, -- right edge of bounding box
ymax(10:0..31): BcplReal -- top edge of bounding box
];
missingSpline: BcplReal ~ LOOPHOLE[BcplCard[0, CARDINAL.LAST]];
value of wx in SplineData for a missing character
SplineDataArray: TYPE ~ RECORD[SEQUENCE COMPUTED CARDINAL OF SplineData];
SplineCode: TYPE ~ MACHINE DEPENDENT {
moveTo(1), drawTo(2), drawCurve(3),
endDefinition(177776B), newObject(177777B)
};
SplineCommand: TYPE ~ MACHINE DEPENDENT RECORD[code: SplineCode];
SplineCoords: TYPE ~ MACHINE DEPENDENT RECORD[
x(0:0..31): BcplReal,
y(2:0..31): BcplReal
];
END.