DIRECTORY Ascii, Atom, Environment, Real, RefText, Rope, SafeStorage, Scaled, UFFontDirReader, UnifiedFonts, UFFileManager, MessageWindow, IO; UnifiedFontsImpl: CEDAR MONITOR IMPORTS Atom, RefText, Rope, SafeStorage, Scaled, UFFontDirReader, UFFileManager, MessageWindow, IO EXPORTS UnifiedFonts = BEGIN OPEN UnifiedFonts; BadFontFileFormat: PUBLIC ERROR = CODE; pZone: PUBLIC ZONE _ SafeStorage.NewZone[initialSize: 0]; rotationFuzz: REAL = 1/3600.0; fontDirFileName: ROPE _ "Default.FontDir"; fontHead: FONT _ NIL; -- all FONTs are linked together, starting here. defaultFont: FONT; DefaultFont: PROCEDURE RETURNS [font: FONT] = { formattingClassInit: REF initProcRec _ NARROW[Atom.GetProp[atom: $Strike, prop: $FontFormattingClass]]; graphicsClassInit: REF initProcRec _ NARROW[Atom.GetProp[atom: $Strike, prop: $FontGraphicsClass]]; IF defaultFont#NIL THEN RETURN [defaultFont]; font _ pZone.NEW[FontRec]; font.name _ "Default"; font.requestedTransformation _ font.actualTransformation _ [10, 0]; font.deviceType _ $Screen; font.nsCodeTable _ UFFileManager.KeyOf["Ascii.codeScheme"]; font.formattingKey _ font.graphicsKey _ UFFileManager.KeyOf["[Indigo]Strikefonts>Tioga10.strike"]; formattingClassInit.init[font]; graphicsClassInit.init[font]; InitFontBoundingBox[font]; font.bitmapCacheable _ Area[font.fontBoundingBox] candidateMaxSize THEN RETURN [FALSE]; IF NOT name.Equal[RefText.TrustTextAsRope[candidateFontName], FALSE] THEN RETURN [FALSE]; IF candidateRotation >= 0 AND ABS[candidateRotation - transformation.rotation] >= rotationFuzz THEN RETURN [FALSE]; RETURN [TRUE]; }; RememberFont: ENTRY PROC = {font.link _ fontHead; fontHead _ font}; SaveResult: UFFontDirReader.ResultProc = { formattingClassInit: REF initProcRec _ NARROW[Atom.GetProp[atom: metricsType, prop: $FontFormattingClass]]; graphicsClassInit: REF initProcRec _ NARROW[Atom.GetProp[atom: graphicsType, prop: $FontGraphicsClass]]; font _ pZone.NEW[FontRec]; font.name _ CopyRope[name]; -- So it is OK to trust a REF TEXT as a ROPE font.requestedTransformation _ font.actualTransformation _ transformation; IF candidateSize # 0.0 THEN font.actualTransformation.scale _ candidateSize; IF candidateRotation >= 0 THEN font.actualTransformation.rotation _ candidateRotation; font.deviceType _ candidateDeviceType; font.nsCodeTable _ codeScheme; font.formattingKey _ metricsName; font.graphicsKey _ graphicsName; formattingClassInit.init[font]; graphicsClassInit.init[font]; InitFontBoundingBox[font]; font.bitmapCacheable _ Area[font.fontBoundingBox]œœœ˜sLšœœ˜L˜—Lšž œœœ+˜Cšž œ ˜*Lšœœœ>˜kLšœœœ=˜hLšœ œ ˜LšœŸ,˜HLšœJ˜JLšœœ1˜LLšœœ8˜VLšœ&˜&Lšœ˜Lšœ!˜!Lšœ ˜ Lšœ˜Lšœ˜L˜L˜˜>Jšœ˜—Jšœœœ œœœœ˜LJ˜ Jšœ˜—Jšœ˜Jšœ˜—Kš œœœœ œœ˜:šžœœœ œœœ œœ˜LJšœœœœ˜8š œœœœœ˜:Jšœœœ˜