CDTexts.mesa A Chipndale module
by Christian Jacobi July 29, 1983 10:42 am
last edited by Christian Jacobi November 21, 1983 3:26 pm
DIRECTORY
CD,
Rope USING [ROPE],
Graphics USING [FontRef];
CDTexts: CEDAR DEFINITIONS =
BEGIN
TextPtr: TYPE = REF TextRec;
TextRec: TYPE = RECORD [
text: Rope.ROPE,
font: REF FontRec
];
FontRec: TYPE = RECORD [
font: Graphics.FontRef,
baseOffsetX: REAL ← 0.0, --after scaling
baseOffsetY: REAL ← 0.0, --after scaling
scaling: BOOLFALSE,
scale: REAL ← 1,
height: CD.DesignNumber ← -1, --after scaling
whiteBorder: CD.DesignNumber ← 0, --border offset on creation
scaleByReplacingFontAllowed: BOOLFALSE,
levelSubstitute: CD.Level ← CD.combined,
key: ATOMNIL, --unique for the technology
name: Rope.ROPENIL, --if known
technology: CD.Technology←NIL,
properties: CD.Properties ← NIL,
data: REF ANYNIL
];
CreateText: PROC [text: Rope.ROPE, font: REF FontRec, level: CD.Level ← CD.combined] RETURNS [CD.ObPtr];
InstallFont: PROC [font: REF FontRec, key: ATOMNIL, technology: CD.Technology] RETURNS [done: BOOL];
--key and technology overwrite font^
--done means GetFont would find the font
--caller is supposed not to change font^ after Installation
GetFont: PROC[key: ATOM, technology: CD.Technology ← NIL] RETURNS [REF FontRec];
--returns NIL if not found
MakeFont: PROC [
name: Rope.ROPENIL,
scale: REAL ← 1,
height: CD.DesignNumber ← 0,
whiteBorder: CD.DesignNumber ← -1,
baseOffsetX: REAL ← -1,
baseOffsetY: REAL ← -999,
scaleByReplacingFontAllowed: BOOLFALSE,
levelSubstitute: CD.Level ← CD.combined]
RETURNS [REF FontRec];
--returns NIL if not found;
--corrects height, whiteBorder, baseOffsetX, baseOffsetY if not reasonable
END.