DIRECTORY Font USING [Create, CreateScaled, FONT, Name, RequestedTransformation], Imager USING [Concat], ImagerExtras USING [ShowChar], IP USING [Any, Integer, MasterError, NameFromVector, OperatorRep, State, Transformation, Vector, VectorRep, VectorShape], IPFont USING [], Rope USING [ROPE]; IPFontImpl: CEDAR PROGRAM IMPORTS Font, Imager, ImagerExtras, IP EXPORTS IPFont = BEGIN OPEN IP; ROPE: TYPE ~ Rope.ROPE; FONT: TYPE ~ Font.FONT; CharData: TYPE ~ REF CharDataRep; CharDataRep: TYPE ~ RECORD[font: FONT, code: CARDINAL]; CharDo: PROC[self: State, data: REF] ~ { char: CharData ~ NARROW[data]; font: FONT ~ char.font; ImagerExtras.ShowChar[self.imager, char.code, char.font]; }; fontShape: VectorShape ~ [l: 0, n: CARDINAL.LAST]; FontShape: PROC[data: REF] RETURNS[VectorShape] ~ { RETURN[fontShape]; }; FontGet: PROC[data: REF, j: Integer] RETURNS[Any] ~ { font: FONT ~ NARROW[data]; IF j NOT IN[0..CARDINAL.LAST] THEN MasterError[$boundsFault, "Font vector index out of bounds."]; RETURN[NEW[OperatorRep _ [class: $Char, do: CharDo, data: NEW[CharDataRep _ [font: font, code: j]]]]]; }; VectorFromFont: PUBLIC PROC[font: FONT] RETURNS[Vector] ~ { RETURN[NEW[VectorRep _ [class: $Font, shape: FontShape, get: FontGet, data: font]]]; }; FontFromVector: PUBLIC PROC[v: Vector] RETURNS[font: FONT _ NIL] ~ { SELECT v.class FROM $Font => font _ NARROW[v.data]; ENDCASE => MasterError[$unimplemented, "Can't fabricate a FONT yet."]; }; FindFont: PUBLIC PROC[self: State, v: Vector] RETURNS[Vector] ~ { name: ROPE ~ NameFromVector[v]; font: FONT ~ Font.CreateScaled[fontName: name, scale: 1]; RETURN[VectorFromFont[font]]; }; FindFontVec: PUBLIC PROC[self: State, v: Vector] RETURNS[Vector] ~ { MasterError[$unimplemented, "FINDFONTVEC is not implemented."]; RETURN[NIL]; }; ModifyFont: PUBLIC PROC[v: Vector, m: Transformation] RETURNS[Vector] ~ { oldFont: FONT ~ FontFromVector[v]; fontName: ROPE ~ oldFont.Name[]; oldTransformation: Transformation ~ oldFont.RequestedTransformation[]; newTransformation: Transformation ~ Imager.Concat[m, oldTransformation]; newFont: FONT ~ Font.Create[fontName, newTransformation]; RETURN[VectorFromFont[newFont]]; }; END. VIPFontImpl.mesa Last edited by: Doug Wyatt, February 27, 1984 4:44:57 pm PST ʘšœ™J™—šœ™Jšœ,™,J˜—šÏk ˜ Jšœœœ!˜GJšœœ ˜Jšœ œ ˜Jšœœq˜yJšœœ˜Jšœœœ˜J˜—Jšœ œ˜Jšœ˜&Jšœ˜Jšœœœœ˜J™Jšœœœ˜Jšœœœ˜J˜Jšœ œœ ˜!Jš œ œœœœ˜7J˜šÏnœœœ˜(Jšœœ˜Jšœœ ˜J˜9J˜J˜—Jšœ#œœ˜2J˜šž œœœœ˜3Jšœ ˜J˜J˜—šžœœœœ ˜5Jšœœœ˜š œœœœœ˜"Jšœ>˜>—šœœ)˜3Jšœœ)˜2—Jšœ˜J˜—š žœœœœœ ˜;JšœœJ˜TJ˜J˜—š žœœœ œœœ˜Dšœ ˜Jšœœ ˜Jšœ?˜F—J˜J˜—šžœœœœ ˜AJšœœ˜Jšœœ/˜9Jšœ˜J˜J˜—šž œœœœ ˜DJ˜?Jšœœ˜ J˜J˜—šž œœœœ ˜IJšœ œ˜"Jšœ œ˜ JšœF˜FJšœH˜HJšœ œ,˜9Jšœ˜ J˜J˜—Jšœ˜—…—€ ò