VFontsImpl.mesa; Written by S. McGregor
Last Edited by McGregor, July 21, 1983 10:53 am
Michael Plass, August 16, 1983 9:19 am
Doug Wyatt, September 30, 1983 6:51 pm
DIRECTORY
RefText USING [Append, New],
Rope USING [ROPE],
RopeInline USING [InlineFlatten],
Font USING [CreateScaled],
VFonts;
VFontsImpl: CEDAR MONITOR
IMPORTS Font, RefText, RopeInline
EXPORTS VFonts = BEGIN
prefix: REF TEXT = "Xerox/PressFonts/";
postfix: REF TEXT ← "/MRR";
scratch: REF TEXT ← RefText.New[100];
EstablishFont: PUBLIC ENTRY PROC [family: Rope.ROPE, size: CARDINAL, bold, italic: BOOLFALSE, defaultOnFailure: BOOLTRUE] RETURNS [VFonts.FONT] = BEGIN
scratch.length ← prefix.length;
TRUSTED {RefText.Append[scratch, LOOPHOLE[RopeInline.InlineFlatten[family]]]};
postfix[1] ← IF bold THEN 'B ELSE 'M;
postfix[2] ← IF italic THEN 'I ELSE 'R;
RefText.Append[scratch, postfix];
RETURN[Font.CreateScaled[scratch, size, $Screen]];
END;
defaultFont: PUBLIC VFonts.FONT;
RefText.Append[scratch, prefix];
defaultFont ← EstablishFont["Tioga", 10];
END.