DIRECTORY CD, CDApplications, CDTexts, CDOps, CDSequencer, TerminalIO, Rope, CDValue, NMos, CDPanel; NMosTextCommands: CEDAR PROGRAM IMPORTS CDApplications, CDOps, CDSequencer, TerminalIO, CDTexts, Rope, CDValue, CDPanel, NMos = BEGIN FontRec: TYPE = CDTexts.FontRec; CreateTextComm: PROC [comm: CDSequencer.Command] = BEGIN ENABLE TerminalIO.UserAbort => GOTO userAbort; fn: NAT _ MIN[INT[fontNum]-1, CDValue.FetchInt[comm.design, $FontNumber]]; font: REF CDTexts.FontRec _ fontArray[fn]; r: Rope.ROPE _ TerminalIO.RequestRope["Create text\n", "please type: "]; ob: CD.ObPtr; IF Rope.IsEmpty[r] THEN { TerminalIO.WriteRope["empty text not included\n"]; RETURN }; ob _ CDTexts.CreateText[r, font]; CDOps.AddAnObject[design: comm.design, ob: ob, location: comm.pos, orientation: 0]; EXITS userAbort => {TerminalIO.WriteRope["discarded\n"]} END; ScaleTextComm: PROC [comm: CDSequencer.Command] = BEGIN ff: REAL = 1.2599; fff: REAL = ff*ff*ff; first: CD.ApplicationPtr; multiple: BOOL; TerminalIO.WriteRope["Scale text\n"]; [first, multiple] _ CDOps.SelectedApplication[comm.design]; IF multiple THEN TerminalIO.WriteRope["multiple selection; not done\n"] ELSE IF first=NIL THEN TerminalIO.WriteRope["no selection; not done\n"] ELSE IF NOT ISTYPE[first.ob.specificRef, CDTexts.TextPtr] THEN TerminalIO.WriteRope["not text; not done\n"] ELSE { factor: REAL_1.0; n: INT _ TerminalIO.RequestSelection[ choice: LIST[" >>", " >", " <", " <<"], label: "scale" ]; SELECT n FROM 1 => factor _ 1.0/fff; 2 => factor _ 1.0/ff; 3 => factor _ ff; 4 => factor _ fff; ENDCASE => factor _ 1.0; ScaleApp[comm.design, first, factor]; TerminalIO.WriteRope["done\n"] }; END; ScaleApp: PROC [design: CD.Design, aptr: CD.ApplicationPtr, factor: REAL] = BEGIN IF aptr#NIL AND aptr.ob#NIL THEN WITH aptr.ob.specificRef SELECT FROM tp: CDTexts.TextPtr => { font: REF CDTexts.FontRec ~ tp.font; scaledFont: REF CDTexts.FontRec ~ CDTexts.MakeFont[ name: font.name, scale: font.scale*factor, whiteBorder: font.whiteBorder, scaleByReplacingFontAllowed: font.scaleByReplacingFontAllowed, levelSubstitute: font.levelSubstitute ]; IF scaledFont#NIL THEN { txt: CD.ObPtr ~ CDTexts.CreateText[tp.text, scaledFont, aptr.ob.level]; IF txt#NIL THEN { CDOps.DelayedRedraw[design, CDApplications.ARectO[aptr]]; aptr.ob _ txt; CDOps.DelayedRedraw[design, CDApplications.ARectO[aptr]]; }; }; }; ENDCASE => ERROR END; fontNum: NAT = 5; FontRange: TYPE = [0..fontNum); fontArray: ARRAY FontRange OF REF CDTexts.FontRec; ImplCommands: PROC [] = BEGIN CDSequencer.ImplementCommand[$DrawText, CreateTextComm, NMos.nmos]; CDSequencer.ImplementCommand[$ScaleTextS, ScaleTextComm, NMos.nmos]; CDValue.EnregisterKey[$FontNumber, NMos.nmos]; CDPanel.DefineIntEntry[cdValueKey: $FontNumber, tech: NMos.nmos, text: "Font:", min: 0, default: 0, max: fontNum-1]; CDPanel.DefineNewLine[NMos.nmos]; fontArray[0] _ CDTexts.GetFont[key: $CDxCompatibilityFont, technology: NMos.nmos]; fontArray[1] _ CDTexts.MakeFont[scale: 2, name: "Gates32.strike"]; fontArray[2] _ CDTexts.MakeFont[scale: 2, name: "MusicFont10.strike"]; fontArray[3] _ CDTexts.MakeFont[scale: 0.5, name: "OldEnglish18.strike"]; fontArray[4] _ CDTexts.MakeFont[scale: 0.5, name: "TimesRoman36.strike"]; IF fontArray[1]=NIL THEN fontArray[1] _ CDTexts.MakeFont[scale: 2, name: "/ivy/jacobi/chipndale/Gates32.strike"]; IF fontArray[2]=NIL THEN fontArray[2] _ CDTexts.MakeFont[scale: 0.5, name: "/indigo/AltoFonts/Helvetica18.strike"]; IF fontArray[2]=NIL THEN fontArray[2] _ CDTexts.GetFont[key: $CDxCompatibilityFont, technology: NMos.nmos]; IF fontArray[3]=NIL THEN fontArray[3] _ CDTexts.MakeFont[scale: 0.5, name: "/indigo/AltoFonts/Logo18.strike"]; IF fontArray[3]=NIL THEN fontArray[3] _ CDTexts.GetFont[key: $CDxCompatibilityFont, technology: NMos.nmos]; IF fontArray[4]=NIL THEN fontArray[4] _ CDTexts.MakeFont[scale: 0.3, name: "/indigo/AltoFonts/TimesRoman36.strike"]; IF fontArray[4]=NIL THEN fontArray[4] _ CDTexts.GetFont[key: $CDxCompatibilityFont, technology: NMos.nmos]; END; ImplCommands[]; END. "NMosTextCommands.mesa (part of Chipndale) Copyright c 1983 by Xerox Corporation. All rights reserved. by Christian Jacobi June 24, 1983 5:03 pm last edited Christian Jacobi November 23, 1983 9:41 am --further fonts "Template64.strike" "/ivy/jacobi/chipndale/Template64.strike" ʃ˜šœ*™*Jšœ Ïmœ1™˜>Jšœ%˜%J˜—šžœ žœžœ˜Jšœžœ@˜Gšžœžœžœ˜Jšœ9˜9Jšœ˜Jšœ9˜9J˜—J˜—J˜—Jšžœž˜——Jšžœ˜J˜—Jšœ žœ˜Jšœ žœ˜Jšœ žœ žœžœ˜2J˜š  œžœ˜Jšž˜J˜CJšœD˜DJšœ-ž˜.˜@J˜3—J˜!JšœR˜RJšœB˜BJšœF˜FJšœI˜IJšœI˜Išžœžœžœ˜JšœX˜X—JšœM™Mšžœžœžœ˜JšœZ˜Z—šžœžœžœ˜JšœR˜R—šžœžœžœ˜JšœU˜U—šžœžœžœ˜JšœR˜R—šžœžœžœ˜Jšœ[˜[—šžœžœžœ˜JšœR˜R—Jšžœ˜J˜—J˜Jšžœ˜J˜—…—Èm