--UnifiedFonts.mesaUnifiedFontInterface--MichaelPlass,October21,19821:06pmDIRECTORYRope,Graphics;UnifiedFonts:CEDARDEFINITIONS=BEGINROPE:TYPE=Rope.ROPE;Context:TYPE=Graphics.Context;ThisinterfaceisdesignedtobeusedinconjunctionwithCedarGraphics,andperhapssomedayitwillbecomeintegratedwiththatpackage.FONT:TYPE=REFFontRec;AFONTdescribesafont,thatis,acollectionofrelatedgraphicalobjects.Eachobject,orcharacter,inthecollectionisreferredtobyanindexoftypeCHARACTER.Therearevariousattributesofafontthatmaybeaccessedthroughthisinterface;someofthempertaintothefontasawhole,andotherspertaintotheindividualcharacters.ThisinterfaceisdesignedtobeusedinconjunctionwithCedarGraphics,andperhapssomedayitwillbecomeintegratedwiththatpackage.Theactualgraphicalobjectscontainedinafontmayormaynotbelocallyavailable.Forhardcopyapplications,theexactgraphicaldescriptionstypicallyresideattheprintserver,andcannotbeassumedtobeavailable.Ontheotherhand,thegraphicaldescriptionsforfontstobeusedonthescreenmustbelocallyavailable.Inanycase,somesortofreasonableapproximationisattemptedforlocaluse.Afontisideallyavailableinallsizesandrotations;however,notallprintserversarecapableoflivinguptothisideal.Therefore,amechanismisprovidedforfindingoutwhattransformationsareavailable(easy)forafontonaparticular(kindof)outputdevice.TheassociationbetweenCHARACTERcodesandtheimagesisoftenjumbled,duetohistoricalreasonsandthenaturalslownessinthepropagationofstandards.Asasteptowardsuntanglingthismess,thisinterfaceprovidesawaytofindouttheXeroxCharacterCodeforacharacterinagivenfont,andviceversa.FromName:PROCEDURE[fontName:ROPE]RETURNS[FONT];Thisgetsatleastthefontmetricinformationfromacentralizeddatabase.ThefontnameisanInterpresshierarchialfontname,andencodesallofthefamily,face,anddesignsizeinformation.Thefontwillbeinasizedesignedforone-unitbaselinespacing,whichisprobablynotrightformostapplications.Name:PROCEDURE[font:FONT]RETURNS[fontName:ROPE];Thisextractsthenameofthefont.MayreturnNILifthefontisunnamed.Transformation:TYPE=RECORD[m11,m12,m21,m22:REAL];ATransformationspecifiesthematrixforthelineartransformationusedtoscale,rotate,andskewfonts.ScaleandRotateareusefulforbuildingupthemostcommontransformations.Rotate:PROCEDURE[transformation:Transformation_identity,degrees:REAL]RETURNS[Transformation];Scale:PROCEDURE[transformation:Transformation_identity,magnification:REAL]RETURNS[Transformation];identity:Transformation=[1.0,0.0,0.0,1.0];ModifyFont:PROCEDURE[font:FONT,transformation:Transformation];Thisappliesthegiventransformationtothefont,tomakeitbethedesiredsizeandorientation.Thisisequivalenttoapplyingthetransformationtothedisplaycontextbeforethecharactersaredisplayed.1p a  #q ^ co@"Or [q:[C[G Yn rYnYnR qXYnr W UqUr UUqcUHUrUUqU TArTAgTAqTATAs R t!# *- 7`:>DiE P p NRqNRrNRNRq#NRrNRNRqNRNRs L  ! ')o-39<@B Jv << "&g( * 5F9);}@% FG IJtd4!$5 *9-/F27>8;/>?@E Gk\  E t!# *- 7`:>DiE DB  B+#F$&!(+-0249 ?B% @  k '-0248/@qCEt =8V "%N(+.0O 6 ?A^ ;> :1 Q WR"w% +40358c<?CE 8f" %'4,.3V59B 6ua %)z+/ 5) $5'*w,1A26;>? 3?C "N$ ,- 467:?} FB 1f!#[& (t*1+1.5\s819S1; A[ (w W#%+F0j59|:@kBF& u $iqz$irx$i$iq$iy$ir$i$iq$ir$i $iq%$i&T$ir-S$i.'$iq0d$i0$is"9) #&+ ../146p " q "r " "qa "rF " "q" "# "&h)-6r0 "1 "q3 "4; "s h  Q#%.'z+S 4k7|9 <AC t[s>ts\ !#)*->0}5u 4q4r44q44" ,w.3hr8494q;4r<4=4q1u q8r6q7! +-=2 r;<q>r?@q1X  ># "%Eu = q =r ==q= =rs= ,=q"=#=-Ds q $&.(z+-I02M46i:=@5  ] i #% ,=-0.49=? FM 5 v) VTVm$fCurrentTransformation:PROCEDURE[font:FONT]RETURNS[transformation:Transformation]=INLINE{RETURN[font.currentTransformation]};Usefulforfindingouthowthefonthasbeentransformed.DeviceType:TYPE=ROPE;Tellswhatkindofdevicetotailortheeasytransformationsfor."Ideal"asadevicetypewillallowanytransformation.ThenameofaprintservermayfunctionasaDeviceType,whentheimplementationissmartenoughtoallowthis.EasyTransformations:PROCEDURE[font:FONT,deviceType:DeviceType,transformationProc:TransformationProc];TransformationProc:TYPE=PROCEDURE[transformation:Transformation]RETURNS[quit:BOOLEAN_FALSE];anyTransformation:Transformation=[0,0,0,0];EasyTransformationsenumeratesthetransformationsofthefontthatareeasyonthespecifieddevice.Ifanytransformationisallowed,anyTransformationwillbeincludedinthelistofeasytransformations.Thetransformationsareallexpressedrelativetothefontascurrentlymodified.SubstituteForDevice:PROCEDURE[font:FONT,deviceType:DeviceType,transformation:Transformation];Changesthefonttoonethatisavailableonthespecifieddevice.Anattemptwillbemadetomakeareasonablesubstitution.Contains:PROCEDURE[font:FONT,char:CHAR]RETURNS[BOOLEAN];TRUEiffthecharacterexistsinthefont.NSCode:PROCEDURE[font:FONT,char:CHAR]RETURNS[nsCode:INT];unassignedNSCode:INT=255;nonexistentNSCode:INT=65535;ReturnstheNetworkSystemscodeforthespecifiedcharacter;unassignedNSCodeisreturnedforcharactersthathavenosuchcodeassigned,andnonexistentNSCodeisreturnedforcharactersthatdonotexistinthefont.CharCode:PROCEDURE[font:FONT,nsCode:INT]RETURNS[char:CHAR];ReturnstheCHARACTERcodeforthespecifiedNetworkSystemscode;NULisreturnedforcharactersthatdonotexistinthefont.DrawChar:PROCEDURE[font:FONT,char:CHAR,context:Context];DisplaysasinglecharacterthroughGraphics.FontMetricsFontMetricCode:TYPE={xHeight,slant,underlineOffset,underlineThickness};GetFontMetric:PROCEDURE[font:FONT,characterMetricCode:CharacterMetricCode]RETURNS[REAL];CharacterMetricsCharacterMetricCode:TYPE={widthX,widthY,leftExtent,rightExtent,descent,ascent,centerX,centerY,superscriptX,superscriptY,subscriptX,subscriptY};GetCharacterMetric:PROCEDURE[font:FONT,characterMetricCode:CharacterMetricCode,char:CHAR]RETURNS[REAL];Kern:PROCEDURE[font:FONT,char1,char2:CHAR]RETURNS[REAL];Returnstheamounttoaddtothecharacter'swidthtokernthischaractertothesuccessorcharacter.2u b&qb&rb&jb&q"ab&"b&r&,b&&b&q)cb&r*Jb&+b&q0;b&0b&:\D{r1`qH`r`q`C`s^T|tM #k%) p \0 qQ\0rO\0\0q\0r\0_\0q\0sZr_im"$'149v;/BW$ _"F#'~u TqTrT5Tq!,T!Tr$T%Tq(.T) T 0 81RuPZqPZrPZPZqgPZr LPZ PZq'PZ(MPZ2 r<*PZA(IO !"kt'I(RIs3MI45I57=>AC?DG%5')/4N58?;<Bu EWq"EWr EWEWq EW!!EWr$EW%BEWq'EW(EW 0_ 8X1CsAO!&(*0m5M7=r;==q===r=]=q =!=r%A=& =q(=r)=*U=q/r=r/=q5v=5=s;~C{ =!$/u 9kq9kr9k9kq9k9krX9k9kq 9k!l9kr$9k%9kq(N9kr)59k* 9kq/&9k/9kr49k5a9kq79k7f9k7r77q775r5T5q`5E5s42k !#<%d'- t3424?42s?f42?42@F02 Q"J= Z#u)'t+2,2s82829>A 09+u .Sq.Sr.S.Sq.S.SrK.S.Sq!.S"_.Sr'.S(7.Sq).Sr*.S+.Sq0.S1.Sr4.S5h.Sq7.S8Y.Ss,wk,6,s,, "C$)/48H;=RB* Q"k!O#u (\q(\r(\(\q(\(\rw(\0(\q!(\"(\r&(\&(\q)l(\*H(\/s&{t#t #3 2q S#C&1 u  qrqr!o"(q$%2r@Aq1rhqt Xq %+ 1 9U>C1(  (p / u qrq !r$%8q'(6Cr1qrqEqbrq Bu ^q ^r ^ ^q| ^ ^rG ^ ^q~ ^[ ^#sr' ^(x ^q+ ^r+ ^, ^q1 ^r2A ^q5[ ^5 ^s kR 1"} )E,.14W:B;>3 v)TVm$cLigature:PROCEDURE[font:FONT,char1,char2:CHAR]RETURNS[CHAR];ReturnsNULifthereisnoligatureforthetwocharacters.DerivedCharacterMetricsThefollowingproceduresaccesssomemetricsthatareusefulwhenthefullgeneralityoftheGetCharacterMetricprocedureisnotneeded.Accessthroughtheseprocedureswillbespeedierthanthroughthegeneralmachanism.Width:PROCEDURE[font:FONT,char:CHAR]RETURNS[REAL];Returnsthemagnitudeofthewidthvector.PosExtent:PROCEDURE[font:FONT,char:CHAR]RETURNS[REAL];Returnsthemagnitudeofthemaximumextentofthecharacterinthedirection90degreescounterclockwisetothewidthvector.ForunrotatedLatinalphabets,thisistheInterpressascentortheTEXheight.NegExtent:PROCEDURE[font:FONT,char:CHAR]RETURNS[REAL];Returnsthemagnitudeofthemaximumextentofthecharacterinthedirection90degreesclockwisetothewidthvector.ForunrotatedLatinalphabets,thisistheInterpressdescentortheTEXdepth.PressCompatibilityStuffPressFontSpecification:TYPE=RECORD[family:ROPE,face:PressFontFace,size:INTEGER,rotation:INTEGER];PressFontFace:TYPE=[0..256);GetPressFontSpecification:PROCEDURE[FONT]RETURNS[PressFontSpecification];ImplementorPrivateStuffFontRec:TYPE=PRIVATERECORD[name:ROPE,currentTransformation:Transformation,bc,ec:CHAR,nsCode:NSCodeRec,--somestuffgoeshereforWidth,PosExtent,NegExtent,Kern,andLigature.DrawCharProc:PROCEDURE[font:FONT,char:CHAR,context:Context],data:REFANY];NSCodeRec:TYPE=PRIVATERECORD[code:SEQUENCElength:NATOFCARDINAL];END.INLINEbodiesaredownheretoavoidclutteruntiltheinterfacelooksright.Contains=INLINE{RETURN[NSCode[font,char]#nonexistentNSCode]};NSCode=INLINE{RETURN[IFchar>=font.bcANDchar<=font.ecTHENfont.nsCode[char-font.bc]ELSEnonexistentNSCode]};CharCode=INLINE{RETURN[IFnsCode<255ANDNSCode[font,0C+nsCode]=nsCodeTHEN0C+nsCodeELSEFindCharCode[font,nsCode]]};3u b&qb&rb&b&qb&b&rnb&'b&q b&!b&%r)b&*b&q-,b&r.b&.b&q4b&r4hb&q7b&8#b&s`}#%(I* t ]+ms Zg DR"'g*9,0|36J8 >@ X4 #(T,15* ;>o@>E_ W, u TqTrTKTqBTTr TTqDT !Tr#T$uTq'Tr'T(Tq-Tr.>Tq1XT1TsRk#u Puq%Pur"PuPuqPu$PurPuDPuq!Pu"Pur&(Pu&Puq)Pur*hPu+.N2 8U: DK|K6K|Cu Hq\HrZHHqHrH|Hq!H"Hr&`H'+Hq)Hr*H+tHq0Hr0Hq4H4qHsGVk&M*m,.]4H58:=?E}!S#)- 368:P @EMGDCD>t @ u =q=r=d=q=r= =q%?=