PrePressFontFormat.mesa
Copyright © 1984, Xerox Corporation. All rights reserved.
Doug Wyatt, October 9, 1984 9:35:05 am PDT
DIRECTORY
PrincOps USING [zEXCH],
Scaled USING [Value];
PrePressFontFormat: CEDAR DEFINITIONS
~ BEGIN
BYTE: TYPE ~ [0..377B];
BCPLDOUBLE:
TYPE ~
MACHINE
DEPENDENT
RECORD[highbits, lowbits:
CARDINAL];
A BCPL doubleword; order of the halves is the reverse of the Mesa convention.
CardFromDouble:
PROC[
BCPLDOUBLE]
RETURNS[
LONG
CARDINAL]
~ TRUSTED MACHINE CODE { PrincOps.zEXCH };
FractionFromDouble:
PROC[
BCPLDOUBLE]
RETURNS[Scaled.Value]
~ TRUSTED MACHINE CODE { PrincOps.zEXCH };
BCPLREAL:
TYPE ~
MACHINE
DEPENDENT
RECORD[w0, w1:
CARDINAL];
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): BCPLDOUBLE, -- starting address in file of the segment (in words!)
segmentLength(6:0..31): BCPLDOUBLE -- 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): BCPLDOUBLE, -- starting address in file of the segment (in words!)
segmentLength(6:0..31): BCPLDOUBLE, -- 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): BCPLDOUBLE,
segmentLength(2:0..31): BCPLDOUBLE,
expirationDate(4:0..31): BCPLDOUBLE
];
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): BCPLDOUBLE, -- x width (signed fraction)
wy(2:0..31): BCPLDOUBLE, -- 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 ~ BCPLDOUBLE;
missingFilePos: RelFilePos ~ [
CARDINAL.
LAST,
CARDINAL.
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 ~ [w0: 0, w1:
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.