<> <> <> <> <> <<>> DIRECTORY Atom, Convert, FileNames, FS, GGBasicTypes, GGBoundBox, GGError, GGFromImager, GGInterfaceTypes, GGLines, GGModelTypes, GGObjects, GGParseOut, GGParseIn, GGSlice, GGShapes, GGTransform, GGUtility, GGVector, Imager, ImagerFont, ImagerInterpress, ImagerMemory, ImagerTransformation, Interpress, IO, IPMaster, NodeStyle, RealFns, RefText, Rope, ViewerClasses; GGSliceImplB: CEDAR PROGRAM IMPORTS Atom, Convert, FileNames, FS, GGBoundBox, GGError, GGFromImager, GGLines, GGObjects, GGParseIn, GGParseOut, GGSlice, GGShapes, GGTransform, GGUtility, GGVector, Imager, ImagerFont, ImagerInterpress, ImagerMemory, ImagerTransformation, Interpress, IO, RealFns, RefText, Rope EXPORTS GGSlice = BEGIN << [Artwork node; type 'ArtworkInterpress on' to command tool] >> <<Text Points as shown>> < left, 1=> top, 2=> right, 3=> bottom, 4 => baseline, 5 => horizontal centerline, 6 => vertical centerline>> BoundBox: TYPE = GGModelTypes.BoundBox; CameraData: TYPE = GGInterfaceTypes.CameraData; Color: TYPE = Imager.Color; DisplayStyle: TYPE = GGSlice.DisplayStyle; ExtendMode: TYPE = GGModelTypes.ExtendMode; GargoyleData: TYPE = GGInterfaceTypes.GargoyleData; GargoyleDataObj: TYPE = GGInterfaceTypes.GargoyleDataObj; Point: TYPE = GGBasicTypes.Point; PointGenerator: TYPE = GGModelTypes.PointGenerator; PointGeneratorObj: TYPE = GGModelTypes.PointGeneratorObj; PointPairGenerator: TYPE = GGModelTypes.PointPairGenerator; PointPairGeneratorObj: TYPE = GGModelTypes.PointPairGeneratorObj; Scene: TYPE = GGModelTypes.Scene; SelectedObjectData: TYPE = GGModelTypes.SelectedObjectData; SelectionClass: TYPE = GGInterfaceTypes.SelectionClass; SelectMode: TYPE = GGModelTypes.SelectMode; Slice: TYPE = GGModelTypes.Slice; SliceClass: TYPE = GGModelTypes.SliceClass; SliceClassObj: TYPE = GGModelTypes.SliceClassObj; SliceDescriptor: TYPE = GGModelTypes.SliceDescriptor; SliceDescriptorObj: TYPE = GGModelTypes.SliceDescriptorObj; SliceObj: TYPE = GGModelTypes.SliceObj; SliceParts: TYPE = GGModelTypes.SliceParts; Vector: TYPE = GGBasicTypes.Vector; Viewer: TYPE = ViewerClasses.Viewer; TextEdgeArray: TYPE = PACKED ARRAY [0..textMaxEdges) OF BOOL; -- left, top, right, bottom, baseline, centerline. TextPointArray: TYPE = PACKED ARRAY [0..textMaxPoints) OF BOOL; -- see picture. Used in text parts data. TextPoints: TYPE = REF TextPointsData; TextPointsData: TYPE = ARRAY [0..textMaxPoints) OF Point; -- see picture textMaxPoints: INTEGER = 12; textMaxEdges: INTEGER = 7; TextData: TYPE = REF TextDataObj; TextDataObj: TYPE = RECORD [ box: BoundBox _ NIL, -- not a bounding box but part of the text representation feedbackBox: BoundBox _ NIL, -- both a bounding box and part of the text representation transform: ImagerTransformation.Transformation, inverse: ImagerTransformation.Transformation, -- inverse of transform inverseScale: Vector, -- cached value of ImagerTransformation.Factor[inverse].s points: TextPoints, -- cache for "joints" color: Imager.Color _ NIL, rope: Rope.ROPE _ NIL, fontPrefix: Rope.ROPE, -- e.g. "xerox/xc1-2-2/" or "xerox/pressfonts/" fontFamily: Rope.ROPE, -- e.g. "Helvetica" or "Tioga" or "Gacha" fontFace: Rope.ROPE, -- e.g. "-bi" fontName: Rope.ROPE, -- exact stiring to give to ImagerFont.Find scale: REAL _ 0.0, -- preferred size in points for screen fonts preferredSize: REAL _ 0.0, -- preferred size in points for screen fonts trueFont: ImagerFont.Font _ NIL, screenFont: ImagerFont.Font _ NIL, amplifySpace: REAL, -- because the Imager allows space correction (see Imager.mesa) dropShadowOn: BOOL _ FALSE, dropShadowOffset: Vector, shadowColor: Imager.Color _ NIL ]; TextParts: TYPE = REF TextPartsObj; TextPartsObj: TYPE = RECORD [ points: TextPointArray, -- which corners of text box are selected. edges: TextEdgeArray, -- which edges of text box are selected. includeText: BOOL -- FALSE => corners and edges only; no text ]; TextHitData: TYPE = REF TextHitDataObj; TextHitDataObj: TYPE = RECORD [ <> point: [-1..textMaxPoints), -- which point of box is hit. edge: [-1..textMaxEdges), -- which edge of box is hit. hitPoint: Point ]; FontNameError: PUBLIC SIGNAL = CODE; <<>> <> BuildTextSliceClass: PUBLIC PROC [] RETURNS [class: SliceClass] = { OPEN GGSlice; class _ NEW[SliceClassObj _ [ type: $Text, <> getBoundBox: TextBoundBox, getTightBox: TextTightBox, copy: TextCopy, <> drawParts: TextDrawParts, drawTransform: TextDrawTransform, drawSelectionFeedback: TextDrawSelectionFeedback, drawAttractorFeedback: NoOpDrawAttractorFeedback, <> transform: TextTransform, <> describe: TextDescribe, fileout: TextFileout, filein: TextFilein, <> emptyParts: TextEmptyParts, newParts: TextNewParts, unionParts: TextUnionParts, differenceParts: TextDiffParts, movingParts: TextMovingParts, fixedParts: TextFixedParts, augmentParts: TextAugmentParts, <> pointsInDescriptor: TextPointsInDescriptor, pointPairsInDescriptor: TextPointPairsInDescriptor, nextPoint: TextNextPoint, nextPointPair: TextNextPointPair, closestPoint: TextClosestPoint, closestPointAndTangent: NIL, closestSegment: TextClosestSegment, lineIntersection: NoOpLineIntersection, circleIntersection: NoOpCircleIntersection, hitDataAsSimpleCurve: NoOpHitDataAsSimpleCurve, <