DIRECTORY Char USING [XCHAR], Imager USING [Box, Color, Context, VEC], ImagerFont USING [Font, Extents], NodeStyle USING [Style, TabStop, FontUnderlining], Scaled USING [Value], Tioga USING [Node, Location, Looks]; TEditFormat: CEDAR DEFINITIONS ~ BEGIN LineInfo: TYPE = REF LineInfoRec; LineInfoRec: TYPE = RECORD [ charInfo: CharInfo, formatInfo: FormatInfo, positionInfo: PositionInfo, artworkClass: ArtworkClass, artworkData: REF, startPos, nextPos: Tioga.Location, xOffset: Scaled.Value, xmin, ymin, xmax, ymax: INTEGER, nChars: NAT, nBlankCharsAtEnd: NAT, break: LineBreak, hasBackground: BOOL, amplifySpace: REAL, startAmplifyIndex: CharNumber, index: INT, -- for use by clients data: REF, -- for use by clients link: LineInfo ]; CharNumber: TYPE = NAT; CharInfo: TYPE = REF CharInfoRec; CharInfoRec: TYPE = RECORD [ seq: SEQUENCE maxLength: CharNumber OF CharInfoEntry ]; CharInfoEntry: TYPE = PACKED RECORD [ char: Char.XCHAR, formatNumber: FormatNumber, alteredWidth: BOOL, amplified: BOOL, width: Scaled.Value ]; FormatNumber: TYPE = [0..2**30); FormatInfo: TYPE = REF FormatInfoRec; FormatInfoRec: TYPE = RECORD [ length: FormatNumber ¬ 0, seq: SEQUENCE maxLength: FormatNumber OF FormatInfoEntry ]; FormatInfoEntry: TYPE = RECORD [ looks: Tioga.Looks, font: ImagerFont.Font ¬ NIL, color: Imager.Color ¬ NIL, tab: NodeStyle.TabStop ¬ NIL, vShift: REAL ¬ 0.0, strikeout: NodeStyle.FontUnderlining ¬ None, underlining: NodeStyle.FontUnderlining ¬ None, extension: REF ExtraFormatInfoRep, unique: BOOL ]; ExtraFormatInfoRep: TYPE; -- see TEditFormatImpl PositionInfo: TYPE = REF PositionInfoRec; PositionInfoRec: TYPE = RECORD [seq: SEQUENCE maxLength: CharNumber OF INTEGER]; LineBreak: TYPE ~ { eon, cr, wrap } ¬ eon; FormatLine: FormatProc; FormatProc: TYPE ~ PROC [lineInfo: LineInfo, node: Tioga.Node, startOffset: INT, nodeStyle: NodeStyle.Style, lineWidth: Scaled.Value, doLigsAndKern: BOOL ¬ FALSE]; Paint: PaintProc; PaintProc: TYPE ~ PROC [lineInfo: LineInfo, context: Imager.Context]; Resolve: ResolveProc; ResolveProc: TYPE ~ PROC [lineInfo: LineInfo, x: INTEGER] RETURNS [loc: Tioga.Location, xmin, width: INTEGER, rightOfLine: BOOL]; CharPosition: CharPositionProc; CharPositionProc: TYPE ~ PROC [lineInfo: LineInfo, offset: INT] RETURNS [x, width: INTEGER]; BoundingBox: BoundingBoxProc; BoundingBoxProc: TYPE ~ PROC [lineInfo: LineInfo, start: INT ¬ 0, length: INT ¬ LAST[INT]] RETURNS [Imager.Box]; Allocate: PROC RETURNS [lineInfo: LineInfo]; Release: PROC [lineInfo: LineInfo]; RegisterArtwork: PROC [ArtworkClass]; UnRegisterArtwork: PROC [ATOM]; GetArtworkClass: PROC [ATOM] RETURNS [ArtworkClass]; ArtworkClass: TYPE ~ REF ArtworkClassRep; ArtworkClassRep: TYPE ~ RECORD [ name: ATOM, format: FormatProc, paint: PaintProc, resolve: ResolveProc, charPosition: CharPositionProc, boundingBox: BoundingBoxProc ]; CharacterArtwork: TYPE ~ REF CharacterArtworkRep; CharacterArtworkRep: TYPE ~ RECORD [ paint: PROC [CharacterArtwork, Imager.Context], extents: ImagerFont.Extents ¬ [0, 0, 0, 0], escapement: Imager.VEC ¬ [0, 0], amplified: BOOL ¬ FALSE, data: REF ¬ NIL ]; CharacterFormatProc: TYPE ~ PROC [class: CharacterArtworkClass, loc: Tioga.Location, style: NodeStyle.Style] RETURNS [CharacterArtwork]; CharacterArtworkClass: TYPE ~ REF CharacterArtworkClassRep; CharacterArtworkClassRep: TYPE ~ RECORD [ name: ATOM, format: CharacterFormatProc, data: REF ]; RegisterCharacterArtwork: PROC [class: CharacterArtworkClass]; UnregisterCharacterArtwork: PROC [name: ATOM]; GetCharacterArtworkClass: PROC [ATOM] RETURNS [CharacterArtworkClass]; ArtworkEnabled: PROC RETURNS [BOOL]; SetArtworkEnabled: PROC [enabled: BOOL] RETURNS [was: BOOL]; maxHyph: NAT ~ 16; HyphenationPosition: TYPE ~ [0..256) ¬ 0; HyphenationPositions: TYPE ~ PACKED ARRAY [0..maxHyph) OF HyphenationPosition; HyphProc: TYPE ~ PROC [node: Tioga.Node, start, len: INT, hyphData: REF] RETURNS [HyphenationPositions]; RegisterHyphenation: PROC [hyphenationClass: ATOM, hyphProc: HyphProc, hyphData: REF] RETURNS [oldProc: HyphProc, oldData: REF]; END. î TEditFormat.mesa Copyright Ó 1985, 1986, 1991, 1992 by Xerox Corporation. All rights reserved. Michael Plass, May 23, 1985 9:04:16 am PDT Doug Wyatt, February 27, 1992 5:06 pm PST Line formatting A (perhaps slightly generous) bounding box for the line. Paints the line with its origin at the current position. Finds the character pointed to. Finds the position of the indicated character. Returns FIRST[INTEGER] or LAST[INTEGER] if the character occurs before or after the line, respectively. Computes a higher-precision bounding box of characters [start..start+length) of the line, relative to the line's origin. This is how to get working space. Keeps a cache of storage. A promise that the client is done with this LineInfo, and all those chained from it. Use whenever possible to save on allocations. Artwork Character artwork Provides a means for inserting artwork that behaves like a single character. The character artwork mechanism is invoked when a character property is detected that has the $Artwork key with a value matching one of the registered character artwork classes. Note: The style may change before paint is called, so the client should extract all needed style info during format call. Global Artwork Controls Controls a global Boolean that says whether or not artwork is formatted and displayed. Does not automatically refresh the screen. Hyphenation If the returned value is h, should have 0 < h[0] < h[1] < . . . < h[k-1] < len and either k = maxHyph or h[k] = 0, where k is the number of places at which it is possible to hyphenate the word. If h[j] = i is in the range (0..len), it means it's ok to hyphenate after the ith character of the word. The word is at Rope.Substr[node.rope, start, len]; the hyphenation routine may examine the context of the word in the rest of the rope. If node.hasCharSets, use TextEdit.FetchChar or equivalent to fetch extended character codes. Registers a HyphProc to be called; hyphenationClass identifies the language involved, as determined from style parameters. Any previously registered proc is returned (for layering, etc.) and forgotten by the registration mechanism. Note that registering a new hyphProc may invalidate line breaks on the screen; it's up to the client to refresh these viewers. ÊÀ–(cedarcode) style•NewlineDelimiter ™codešœ™Kšœ ÏeœC™NKšœ*™*K™)K™—šÏk ˜ Kšœžœžœ˜Kšœžœžœ˜(Kšœ žœ˜!Kšœ žœ#˜2Kšœžœ ˜Kšœžœ˜$K˜—KšÏn œžœž œž˜&head™Kšœ žœžœ ˜!šœ žœžœ˜K˜K˜K˜Kšœ˜Kšœ žœ˜Kšœ"˜"K˜šœžœ˜ K™8—Kšœžœ˜ Kšœžœ˜Kšœ˜Kšœžœ˜Kšœžœ˜Kšœ˜KšœžœÏc˜!Kšœžœ ˜ Kšœ˜Kšœ˜K˜—Kšœ žœžœ˜Kšœ žœžœ ˜!šœ žœžœ˜Kšœžœžœ˜4Kšœ˜K˜—šœžœžœžœ˜%Kšœ žœ˜K˜Kšœžœ˜Kšœ žœ˜K˜Kšœ˜K˜—Kšœžœ˜ Kšœ žœžœ˜%šœžœžœ˜Kšœ˜Kšœžœžœ˜8Kšœ˜K˜—šœžœžœ˜ Kšœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœžœ˜Kšœ,˜,Kšœ.˜.Kšœ žœ˜"Kšœž˜ Kšœ˜K˜—šœžœ ˜0K˜—Kšœžœžœ˜)š œžœžœžœžœžœ˜PK˜—šœ žœ˜*K˜—KšŸ œ ˜š œ žœžœ5žœGžœžœ˜¤K˜—KšŸœ ˜šœ žœžœ/˜EKšœ8™8K™—KšŸœ˜š œ žœžœžœžœ$žœžœ˜Kšœ™K™—KšŸ œ˜š œžœžœžœžœ žœ˜\Kš œ8žœžœžœžœA™—K™—KšŸ œ˜šœžœžœžœžœžœžœžœ˜pKšœx™xK™—šŸœžœžœ˜,K™;K™—šŸœžœ˜#K™‚K™——™šŸœžœ˜%K˜—šŸœžœžœ˜K˜—šŸœžœžœžœ˜4K˜—Kšœžœžœ˜)šœžœžœ˜ Kšœžœ˜ K˜Kšœ˜Kšœ˜Kšœ˜Kšœ˜Kšœ˜K˜——™Kšœÿ™ÿK™Kšœžœžœ˜1šœžœžœ˜$Kšœžœ$˜/Kšœ+˜+Kšœžœ ˜ Kšœ žœžœ˜Kšœžœž˜Kšœ˜K˜—šœžœžœNžœ˜‰K˜—Kšœžœžœ˜;šœžœžœ˜)Kšœžœ˜ šœ˜K™y—Kšœž˜ Kšœ˜K˜—šŸœžœ ˜>K˜—šŸœžœžœ˜.K˜—šŸœžœžœžœ˜FK™——™KšŸœžœžœžœ˜$š Ÿœžœ žœžœžœ˜