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) 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" Êv˜Jšœ*™*Jšœ,™,Jšœ8™8J˜šÏk ˜ Jšœ˜J˜J˜J˜J˜ J˜ J˜J˜J˜J˜J˜—šÏbœœœ˜ JšœX˜_—Jš˜Jšœ œ˜ J˜šÏnœœ˜2šœ˜Jšœœ ˜.—Jšœœœœ9˜JJšœœ!˜*Jšœœ<˜HJšœœ˜ šœœ˜J˜2Jš˜J˜—J˜!J˜Sš˜J˜2—Jšœ˜J˜—šŸ œœ˜1Jšœ˜Jšœœ ˜Jšœœ ˜Jšœœ˜Jšœ œ˜Jšœ%˜%Jšœ;˜;Jšœ œ7˜GJšœœœœ1˜GJš œœœœ(œ-˜kšœ˜Jšœœ˜šœœ˜%Jšœœ˜'J˜J˜—šœ˜ Jšœ˜Jšœ˜Jšœ˜Jšœ˜Jšœ˜—Jšœ%˜%Jšœ˜J˜—Jšœ˜J˜—š Ÿœœ œœœ˜KJš˜š œœœ œœ˜!šœœ˜$šœ˜Jšœœ˜$šœ œ$˜3Jšœ˜Jšœ˜Jšœ˜Jšœ>˜>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˜—…—È$