ImagerFDBuild.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, June 6, 1989 4:11:32 pm PDT
This interface describes an internal representation of FD fonts that is easy to build and modify, but which is probably not compact enough for use by the typeface implementation; see also ImagerFDFileFormat and ImagerFDTypeface
DIRECTORY
CardTab USING [Ref],
ImagerBox USING [Extents],
ImagerFDTypeface,
ImagerTransformation USING [Transformation],
Prop USING [PropList],
Rope USING [ROPE],
Vector2 USING [VEC];
=
BEGIN
AmplCorr: TYPE = ImagerFDTypeface.AmplCorr;
TypefaceCell: TYPE = ImagerFDTypeface.TypefaceCell;
TransformationSeq: TYPE = ImagerFDTypeface.TransformationSeq;
Transformation:
TYPE = ImagerTransformation.Transformation;
CharacterDescriptions: TYPE = REF CharacterDescriptionCell;
CharacterDescriptionCell:
TYPE =
RECORD [
-- a list cell for LIST OF CharacterDescription
first: CharacterDescription,
rest: CharacterDescriptions
];
CharacterDescription: TYPE = REF CharacterDescriptionRep;
CharacterDescriptionRep:
TYPE =
RECORD [
These representations may be shared between characters, so clients should treat them as immutable once they have been inserted into the table.
typefaceCell: TypefaceCell,
charToDevice: Transformation, -- NIL means resolution-independent
xcCodeDelta: INT, -- Add to get translated code
bits: AmplCorr,
escapement: Vector2.VEC,
extents: ImagerBox.Extents,
placement: Transformation, -- NIL means identity
propList: Prop.PropList ¬
NIL
Keys are:
$centerX, $centerY, $superscriptX, $subscriptX, $superscriptY, $subscriptY, etc.
];
CDSTable:
TYPE = CardTab.Ref;
-- indexed by character code, value is CharacterDescriptions
FDTable: TYPE = REF FDTableRep;
FDTableRep:
TYPE =
RECORD [
cardTab: CDSTable,
propList: Prop.PropList ¬ NIL,
charToDeviceTransformations: TransformationSeq ¬ NIL -- filled in by Canonicalize
];
Create: PROC RETURNS [FDTable];
Insert: PROC [fdTable: FDTable, code: CARD, cd: CharacterDescriptionRep];
Write:
PROC [fdTable: FDTable, filename: Rope.
ROPE];
Convenience procedure; Canonicalizes fdTable, converts it to FDTypefaceData form, and writes it out to a file.
Read:
PROC [filename: Rope.
ROPE]
RETURNS [FDTable];
May raise ImagerFDTypeface.FormatError
Additional operations
These operations are included here in case the prove to be useful to some clients.
FetchList: PROC [fdTable: FDTable, code: CARD] RETURNS [CharacterDescriptions];
StoreList:
PROC [fdTable: FDTable, code:
CARD, cds: CharacterDescriptions];
Canonicalize:
PROC [fdTable: FDTable];
After this, content equality implies pointer equality for types TypefaceCell, Transformation, CharacterDescription, and CharacterDescriptions, and the CharacterDescriptions are sorted by charToDevice.
This is done as the first phase of Write.
Also fills in fdTable.charToDeviceTransformations.
Conflict: SIGNAL [charCode: CARD, cds: CharacterDescriptions] RETURNS [CharacterDescription]; -- raised by Canonicalize (and Write) when there are multiple, conflicting descriptions for the same character code.
FDTypefaceDataFromCanonicalizedFDTable:
PROC [fdTable: FDTable]
RETURNS [ImagerFDTypeface.Data];
fdTable must be Canonicalized before calling this
FDTableFromFDTypefaceData:
PROC [data: ImagerFDTypeface.Data]
RETURNS [FDTable];
WriteFDTypefaceData:
PROC [data: ImagerFDTypeface.Data, filename: Rope.
ROPE];
Writes out the binary form of the file.