DIRECTORY
BasicTime USING [GMT, nullGMT],
IO USING [STREAM],
Imager USING [Context],
ImagerFont USING [CorrectionType, Extents, Font, Substitution, XChar],
ImagerFontWorks USING [MapCharProc],
ImagerMaskCache USING [CharMask, MakeCharMaskProc],
ImagerTransformation USING [Transformation],
Prop USING [PropList],
Rope USING [ROPE],
Vector2 USING [VEC];
VEC: TYPE ~ Vector2.VEC;
ROPE: TYPE ~ Rope.ROPE;
XChar: TYPE ~ ImagerFont.XChar;
CorrectionType: TYPE ~ ImagerFont.CorrectionType;
Extents: TYPE ~ ImagerFont.Extents;
Font: TYPE ~ ImagerFont.Font;
Transformation: TYPE ~ ImagerTransformation.Transformation;
Typeface: TYPE ~ REF TypefaceRep;
TypefaceRep:
TYPE ~
RECORD [
class: TypefaceClass,
data: REF,
name: ROPE ¬ NIL,
alternateMetrics: ROPE ¬ NIL,
created: BasicTime.GMT ¬ BasicTime.nullGMT,
info: InfoTable ¬ NIL, -- for character set 0
fontExtents: REF Extents ¬ NIL,
propList: Prop.PropList ¬ NIL
];
TypefaceClass: TYPE ~ REF TypefaceClassRep;
TypefaceClassRep:
TYPE ~
RECORD [
type: ATOM,
AlternateMetrics: PROC [self: Typeface, alternateMetrics: ROPE] RETURNS [Typeface],
Contains: PROC [self: Typeface, char: XChar] RETURNS [BOOL],
NextChar: PROC [self: Typeface, char: XChar] RETURNS [next: XChar],
Escapement: 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],
MakeCharMask: ImagerMaskCache.MakeCharMaskProc ¬ NIL,
MapChar: ImagerFontWorks.MapCharProc ¬ NIL,
propList: Prop.PropList ¬ NIL
];
InfoTable: TYPE ~ REF InfoTableRep;
InfoTableRep: TYPE ~ PACKED ARRAY BYTE OF Info;
Info:
TYPE ~
PACKED
RECORD [
exists: BOOL ¬ FALSE,
amplified: BOOL ¬ FALSE,
correction: CorrectionType ¬ none,
hasKerns: BOOL ¬ FALSE,
hasLigatures: BOOL ¬ FALSE,
spare1, spare2: BOOL ¬ FALSE
];
Version: TYPE ~ REF VersionRep;
VersionRep:
TYPE ~
RECORD [
createDate: BasicTime.GMT, -- for version checking against typeface.created
type: ATOM -- for version checking against typeface.class.type
];
FindTypeface:
PROC [name:
ROPE, substitution: ImagerFont.Substitution, versionHint: Version ¬
NIL]
RETURNS [Typeface];
Finds the typeface with the specified universal name.
The versionHint is used by the FD typeface implementation to find a particular version.
SelectAlternateTypefaceMetrics:
PROC [typeface: Typeface, alternateMetrics:
ROPE]
RETURNS [Typeface];
Makes a new Typeface with the named alternate metrics
ReverseMetrics:
PROC [typeface: Typeface]
RETURNS [Typeface];
Makes a new Typeface with metrics for ShowBackward; there is no name, so it will not externalize properly.
TypefaceFromFont:
PROC [font: Font]
RETURNS [Typeface];
Pulls the Typeface from the font.
MakeFont:
PROC [typeface: Typeface, m: Transformation]
RETURNS [Font];
Makes a font from the Typeface and a Transformation
MaskChar: Moved to ImagerFontWorks
MaskChar:
PROC [font: Font, char: XChar, context: Imager.Context];
Also provided here for compatibility; clients should migrate to ImagerFontWorks
CaptureChar: Moved to ImagerFontWorks
GeneralCaptureCharMask: ImagerMaskCache.MakeCharMaskProc;
Implements typeface.class.MakeCharMask in terms of typeface.class.Mask; does not fill in font, char, escapement or flags (this is done in CaptureChar, which also selects the appropriate MakeCharMaskProc to use).
Creator: TYPE ~ REF CreatorRep;
CreatorRep:
TYPE ~
RECORD [proc: CreatorProc, data:
REF];
CreatorProc:
TYPE ~
PROC [self: Creator, name:
ROPE, substitute:
BOOL]
RETURNS [Typeface];
RegisterCreator:
PROC [creator: Creator, before:
BOOL ¬
FALSE];
The registered creators are called in order until one of them responds with a non-NIL typeface. They are each called with substitute~FALSE first, and if they all fail and if font substitution was requested, they are called again with substitute~TRUE. If before~TRUE, the creator is added to the front of the list of registered creators; otherwise it is added to the end.
CreatorFromFileExtension:
PROC [extension:
ROPE, createProc:
PROC [stream:
IO.STREAM]
RETURNS [Typeface]]
RETURNS [Creator];
An aid for typeface implementations that are based on files with a particular extension.
FlushTypefaceCaches:
PROC;
Flushes the caches held by the typeface implementation.
FlushFontCaches:
PROC;
Flushes the caches held by the font implementation.
SetSubstitutionFont:
PROC [defaultFont:
ROPE];
Sets the font to be used for substitution calls. Initialized to Modern in ImagerTypefaceImpl.