CDTexts.mesa A Chipndale module
Copyright © 1983 by Xerox Corporation. All rights reserved.
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: BOOL ← FALSE,
scale: REAL ← 1,
height: CD.DesignNumber ← -1, --after scaling
whiteBorder: CD.DesignNumber ← 0, --border offset on creation
scaleByReplacingFontAllowed: BOOL ← FALSE,
levelSubstitute: CD.Level ← CD.combined,
key: ATOM ← NIL, --unique for the technology
name: Rope.ROPE ← NIL, --if known
technology: CD.Technology←NIL,
properties: CD.Properties ← NIL,
data: REF ANY ← NIL
];
CreateText: PROC [text: Rope.ROPE, font: REF FontRec, level: CD.Level ← CD.combined] RETURNS [CD.ObPtr];
InstallFont:
PROC [font:
REF FontRec, key:
ATOM←
NIL, 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.ROPE←NIL,
scale: REAL ← 1,
height: CD.DesignNumber ← 0,
whiteBorder: CD.DesignNumber ← -1,
baseOffsetX: REAL ← -1,
baseOffsetY: REAL ← -999,
scaleByReplacingFontAllowed: BOOL ← FALSE,
levelSubstitute:
CD.Level ←
CD.combined]
RETURNS [REF FontRec];
--returns NIL if not found;
--corrects height, whiteBorder, baseOffsetX, baseOffsetY if not reasonable
END.