ImagerTypeface.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Doug Wyatt, May 22, 1985 6:26:30 pm PDT
DIRECTORY
Atom USING [PropList],
BasicTime USING [GMT, nullGMT],
FS USING [OpenFile],
Imager USING [Context],
ImagerFont USING [BYTE, CorrectionType, Extents, XChar],
Rope USING [ROPE],
Vector2 USING [VEC];
ImagerTypeface: CEDAR DEFINITIONS
~ BEGIN
VEC: TYPE ~ Vector2.VEC;
ROPE: TYPE ~ Rope.ROPE;
BYTE: TYPE ~ ImagerFont.BYTE;
XChar: TYPE ~ ImagerFont.XChar;
CorrectionType: TYPE ~ ImagerFont.CorrectionType;
Extents: TYPE ~ ImagerFont.Extents;
Typeface: TYPE ~ REF TypefaceRep;
TypefaceRep:
TYPE ~
RECORD [
class: TypefaceClass,
data: REF,
name: ROPE ← NIL,
created: BasicTime.GMT ← BasicTime.nullGMT,
info: InfoTable ← NIL, -- for character set 0
propList: Atom.PropList ← NIL
];
TypefaceClass: TYPE ~ REF TypefaceClassRep;
TypefaceClassRep:
TYPE ~
RECORD[
type: ATOM,
Contains: PROC [self: Typeface, char: XChar] RETURNS [BOOL],
NextChar: PROC [self: Typeface, char: XChar] RETURNS [next: XChar],
Width: PROC [self: Typeface, char: XChar] RETURNS [VEC],
Amplified: PROC [self: Typeface, char: XChar] RETURNS [BOOL],
Correction: PROC [self: Typeface, char: XChar] RETURNS [CorrectionType],
BoundingBox: PROC [self: Typeface, char: XChar] RETURNS [Extents],
FontBoundingBox: PROC [self: Typeface] RETURNS [Extents],
Ligature: PROC [self: Typeface, char, successor: XChar] RETURNS [XChar],
NextLigature: PROC [self: Typeface, char, successor: XChar] RETURNS [XChar],
Kern: PROC [self: Typeface, char, successor: XChar] RETURNS [VEC],
NextKern: PROC [self: Typeface, char, successor: XChar] RETURNS [XChar],
Mask: PROC [self: Typeface, char: XChar, context: Imager.Context],
Path: PROC [self: Typeface, char: XChar, moveTo: ImagerPath.MoveToProc,
lineTo: ImagerPath.LineToProc, curveTo: ImagerPath.CurveToProc,
conicTo: ImagerPath.ConicToProc, arcTo: ImagerPath.ArcToProc],
propList: Atom.PropList ← NIL
];
InfoTable: TYPE ~ REF InfoTableRep;
InfoTableRep: TYPE ~ PACKED ARRAY BYTE OF Info;
Info:
TYPE ~
RECORD [
exists: BOOL ← FALSE,
amplified: BOOL ← FALSE,
correction: CorrectionType ← none,
hasKerns: BOOL ← FALSE,
hasLigatures: BOOL ← FALSE,
spare1, spare2: BOOL ← FALSE
];
Find:
PROC [name:
ROPE]
RETURNS [Typeface];
Finds the typeface with the specified name.
CreateProc:
TYPE ~
PROC [file:
FS.OpenFile]
RETURNS [Typeface];
Register:
PROC [extension:
ROPE, create: CreateProc];
Registers a creation procedure for files with the specified file name extension ("ks", "sd", etc.).
END.