ImagerFont.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
Michael Plass, February 25, 1986 3:33:14 pm PST
Doug Wyatt, January 23, 1986 5:20:31 pm PST
DIRECTORY
Basics USING [BYTE],
BasicTime USING [GMT, nullGMT],
ImagerBox USING [Extents],
ImagerTransformation USING [Transformation],
Rope USING [ROPE],
Vector2 USING [VEC];
ImagerFont: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
VEC: TYPE ~ Vector2.VEC;
Transformation: TYPE ~ ImagerTransformation.Transformation;
Xerox characters and strings
XChar: TYPE ~ MACHINE DEPENDENT RECORD [set: Basics.BYTE, code: Basics.BYTE];
nullXChar: XChar ~ [377B, 377B];
An XChar is a 16-bit Xerox character code. See the Xerox Character Code Standard.
XCharProc: TYPE ~ PROC [char: XChar];
XStringProc: TYPE ~ PROC [charAction: XCharProc];
MapRope: PROC [rope: ROPE,
start: INT ← 0, len: INTINT.LAST, charAction: XCharProc];
MapText: PROC [text: REF READONLY TEXT,
start: NAT ← 0, len: NATNAT.LAST, charAction: XCharProc];
These assume the Xerox string encoding; they treat '\377 as an escape code.
See the Xerox Character Code Standard, section 6, and the Interpress Standard, section 2.5.3.
Fonts
UName: TYPE ~ REF UNameRep; -- canonicalized, like ATOMs
UNameRep: TYPE ~ RECORD [name: ROPE, typeface: REF];
name is the universal name, with version part (see Interpress 3.0, section 4.9.2)
e.g. "xerox/xc1-1-1-0/helvetica"
typeface narrows to an ImagerTypeface.Typeface.
Font: TYPE ~ REF FontRep; -- canonicalized, like ATOMs
FontRep: TYPE ~ RECORD [uName: UName, charToClient: Transformation];
charToClient transforms from character to client coordinates
Find: PROC [name: ROPE] RETURNS [Font];
Find the font with the given hierarchical name.
It's safe to use RefText.TrustTextAsRope for the name.
Modify: PROC [font: Font, m: Transformation] RETURNS [Font];
Modify a font by post-concatenating the given transformation.
Scale: PROC [font: Font, s: REAL] RETURNS [Font];
Equivalent to Modify[font, ImagerTransformation.Scale[s]].
FindScaled: PROC [name: ROPE, s: REAL] RETURNS [Font];
Equivalent to Modify[Find[name], ImagerTransformation.Scale[s]].
Metrics
Extents: TYPE ~ ImagerBox.Extents; -- RECORD [leftExtent, rightExtent, descent, ascent: REAL];
CorrectionType: TYPE ~ MACHINE DEPENDENT {mask(0), space(1), none(2), (3)};
Contains: PROC [font: Font, char: XChar] RETURNS [BOOL];
Returns TRUE iff the character exists in the font.
NextChar: PROC [font: Font, char: XChar] RETURNS [next: XChar];
Returns next char in the font, or nullXChar.
Call with nullXChar to get first char in font.
Escapement: PROC [font: Font, char: XChar] RETURNS [VEC];
Returns escapement vector for the character.
Amplified: PROC [font: Font, char: XChar] RETURNS [BOOL];
Returns TRUE iff the character is an 'amplifying' character.
Correction: PROC [font: Font, char: XChar] RETURNS [CorrectionType];
Returns the type of correction, if any, for the character.
BoundingBox: PROC [font: Font, char: XChar] RETURNS [Extents];
Returns a true bounding box for the character mask (not necessarily as tight as possible).
FontBoundingBox: PROC [font: Font] RETURNS [Extents];
Returns a bounding box for all character bounding boxes superimposed.
Kern: PROC [font: Font, char, successor: XChar] RETURNS [VEC];
Returns kerning adjustment between char and successor, or [0, 0].
NextKern: PROC [font: Font, char, successor: XChar] RETURNS [XChar];
Returns next successor that kerns with char.
Call with successor=nullXChar to get first one.
Ligature: PROC [font: Font, char, successor: XChar] RETURNS [XChar];
Returns a ligature formed from char and successor, or nullXChar.
NextLigature: PROC [font: Font, char, successor: XChar] RETURNS [XChar];
Returns next successor that has a ligature with char,
Call with successor=nullXChar to get first one.
StringEscapement: PROC [font: Font, string: XStringProc] RETURNS [VEC];
RopeEscapement: PROC [font: Font, rope: ROPE,
start: INT ← 0, len: INTINT.LAST] RETURNS [VEC];
TextEscapement: PROC [font: Font, text: REF READONLY TEXT,
start: NAT ← 0, len: NATNAT.LAST] RETURNS [VEC];
StringBoundingBox: PROC [font: Font, string: XStringProc] RETURNS [Extents];
RopeBoundingBox: PROC [font: Font, rope: ROPE,
start: INT ← 0, len: INTINT.LAST] RETURNS [Extents];
TextBoundingBox: PROC [font: Font, text: REF READONLY TEXT,
start: NAT ← 0, len: NATNAT.LAST] RETURNS [Extents];
END.