Font.mesa
Copyright © 1984, Xerox Corporation. All rights reserved.
Michael Plass, July 31, 1984 10:58:40 am PDT
Doug Wyatt, October 9, 1984 2:54:11 pm PDT
DIRECTORY
ImagerTransformation USING [Transformation],
Prop USING [PropList],
Rope USING [ROPE],
Vector2 USING [VEC];
Font: CEDAR DEFINITIONS
~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
VEC: TYPE ~ Vector2.VEC;
Transformation: TYPE ~ ImagerTransformation.Transformation;
FONT: TYPE ~ REF FontRep;
FontRep:
TYPE ~
RECORD[
class: Class,
data: REF,
name: ROPE,
charToClient: Transformation,
props: Prop.PropList
];
Class: TYPE ~ REF ClassRep;
ClassRep:
TYPE ~
RECORD[
Modify: PROC[font: FONT, m: Transformation] RETURNS[FONT],
Contains: PROC[font: FONT, char: Char] RETURNS[BOOL],
NextChar: PROC[font: FONT, char: Char] RETURNS[next: Char],
Width: PROC[font: FONT, char: Char] RETURNS[VEC],
Amplified: PROC[font: FONT, char: Char] RETURNS[BOOL],
Correction: PROC[font: FONT, char: Char] RETURNS[CorrectionType],
BoundingBox: PROC[font: FONT, char: Char] RETURNS[Extents],
Ligature: PROC[font: FONT, char, successor: Char] RETURNS[Char],
NextLigature: PROC[font: FONT, char, successor: Char] RETURNS[Char],
Kern: PROC[font: FONT, char, successor: Char] RETURNS[VEC],
NextKern: PROC[font: FONT, char, successor: Char] RETURNS[Char],
CharInfo: PROC[font: FONT, char: Char, key: ATOM] RETURNS[OptionalReal],
MaskChar: PROC[font: FONT, char: Char, imager: REF -- Imager.Context --]
];
Char: TYPE ~ CARDINAL;
nullChar: Char ~
CARDINAL.
LAST;
CorrectionType:
TYPE ~ {none, space, mask};
Extents:
TYPE ~
RECORD[leftExtent, rightExtent, descent, ascent:
REAL];
OptionalReal:
TYPE ~
RECORD[exists:
BOOL, value:
REAL];
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]].
Contains:
PROC[font:
FONT, char: Char]
RETURNS[
BOOL];
TRUE iff the character exists in the font.
NextChar:
PROC[font:
FONT, char: Char]
RETURNS[next: Char];
Returns next char in the font, or nullChar.
Call with nullChar to get first char in font.
BoundingBox:
PROC[font:
FONT, char: Char]
RETURNS[Extents];
Returns a true bounding box for the character mask (not necessarily as tight as possible).
Width:
PROC[font:
FONT, char: Char]
RETURNS[
VEC];
Amplified:
PROC[font:
FONT, char: Char]
RETURNS[
BOOL];
Correction:
PROC[font:
FONT, char: Char]
RETURNS[CorrectionType];
Kern:
PROC[font:
FONT, char, successor: Char]
RETURNS[
VEC];
Returns kerning adjustment between char and successor, or [0, 0].
NextKern:
PROC[font:
FONT, char, successor: Char]
RETURNS[Char];
Returns next successor that kerns with char.
Call with successor=nullChar to get first one.
Ligature:
PROC[font:
FONT, char, successor: Char]
RETURNS[Char];
Returns a ligature formed from char and successor, or nullChar.
NextLigature:
PROC[font:
FONT, char, successor: Char]
RETURNS[Char];
Returns next successor that has a ligature with char,
Call with successor=nullChar to get first one.
CharInfo:
PROC[font:
FONT, char: Char, key:
ATOM]
RETURNS[OptionalReal];
Escape hatch for getting other information not included above.
MaskChar:
PROC[font:
FONT, char: Char, imager:
REF
-- Imager.Context --];
Applies the character mask.
PutProp:
PROC[font:
FONT, key:
REF, value:
REF];
GetProp:
PROC[font:
FONT, key:
REF]
RETURNS[value:
REF];
Register:
PROC[prefix:
ROPE, find:
PROC[
ROPE]
RETURNS[
FONT]];
Register a procedure responsible for finding fonts whose names have the given prefix.
END.