IF header.format.kerned =
T
THEN {
boundingBox: PDStrikeFormat.BoundingBox;
body: PDStrikeFormat.Body;
xInSegment, prevXInSegment: CARDINAL;
xInSegmentOffset: INT;
widthEntryOffset: INT;
widthEntry: PDStrikeFormat.WidthEntry;
bodyOffset: INT;
ReadBlock[@boundingBox, SIZE[PDStrikeFormat.BoundingBox]];
bodyOffset ← wordIndex;
ReadBlock[@body, SIZE[PDStrikeFormat.Body]];
fontAscent ← body.ascent;
fontDescent ← body.descent;
strike ← [
sOrigin: -body.ascent,
fOrigin: 0,
sMin: 0,
fMin: 0,
sSize: body.ascent+body.descent,
fSize: body.raster*Environment.bitsPerWord,
pointer: buffer+wordIndex,
rast: body.raster,
lines: body.ascent+body.descent
];
wordIndex ← wordIndex + strike.rast*strike.lines;
widthEntryOffset ← wordIndex+(header.max-header.min+3)*SIZE[CARDINAL];
IF widthEntryOffset # bodyOffset + body.length THEN ERROR BadFont;
ReadBlock[@prevXInSegment, SIZE[CARDINAL]];
xInSegmentOffset ← wordIndex;
FOR char:
CHAR
IN [header.min..header.max]
DO
charPixels: PDInterpBitmap.BitmapDesc ← strike;
ReadBlock[@xInSegment, SIZE[CARDINAL], xInSegmentOffset];
xInSegmentOffset ← xInSegmentOffset + SIZE[CARDINAL];
ReadBlock[@widthEntry, SIZE[PDStrikeFormat.WidthEntry], widthEntryOffset];
widthEntryOffset ← widthEntryOffset + SIZE[PDStrikeFormat.WidthEntry];
IF widthEntry # PDStrikeFormat.nullWidthEntry
THEN {
IF widthEntry.width > header.maxwidth THEN ERROR BadFont;
charPixels.fOrigin ← widthEntry.offset+boundingBox.fbbox-prevXInSegment;
charPixels.fMin ← prevXInSegment;
charPixels.fSize ← xInSegment-prevXInSegment;
IF char
IN [bc..ec]
THEN {
charBitmap[char] ← charPixels;
charWidth[char] ← widthEntry.width;
};
};
prevXInSegment ← xInSegment;
ENDLOOP;
ReadBlock[@xInSegment, SIZE[CARDINAL], xInSegmentOffset];
xInSegmentOffset ← xInSegmentOffset + SIZE[CARDINAL];
ReadBlock[@widthEntry, SIZE[PDStrikeFormat.WidthEntry], widthEntryOffset];
widthEntryOffset ← widthEntryOffset + SIZE[PDStrikeFormat.WidthEntry];
IF widthEntry # PDStrikeFormat.nullWidthEntry
THEN {
strike.fOrigin ← widthEntry.offset+boundingBox.fbbox-prevXInSegment;
strike.fMin ← prevXInSegment;
strike.fSize ← xInSegment-prevXInSegment;
defaultCharBitmap ← strike;
defaultCharWidth ← widthEntry.width;
}
ELSE ERROR BadFont;
}