'From Squeak3.3alpha of 11 January 2002 [latest update: #4664] on 6 August 2002 at 8:27:40 pm'! "Change Set: FontInCngs-tk Date: 22 July 2002 Author: Ted Kaehler When you use Alt-k to change the text font in a method or class comment, a TextFontReference is put in the runs. Previously this could not be written out on the disk in a changes file. Now it can be. (As requsted by Maarten Maartensz). Still needed: Make 'set font...' and 'set alignment...' be able to Undo. This will also cause them to mark the StringHolder pane as dirty, which they do not do now. Make this change in ParagraphEditor."! !TextAttribute commentStamp: 'tk 7/22/2002 18:33' prior: 0! Tells a piece of text to be a certain way. Select text, press Command-6, choose a attribute. If selected text is of the form Hi There the part in angle brackets is saved for action, and the Hi There appears in the paragraph. If selection has no angle brackets, use the whole thing as both the text and the action. TextDoIt -- eval as a Smalltalk expression (the part in angle brackets) TextLink -- Show a method, class comment, class hierarchy, or class defintion. , , , or are what you type. TextURL -- Show the web page. These attributes of text need to be stored on the disk in a regular file-out. It is done in this form: Hi There in the text, and a Run containing dSmalltalk beep;; Click here to see the extent: in the text, and a Run containing method LPoint extent:; See RunArray class scanFrom: where decoding is done. ! ]style[(903 24 25)f1,f1LRunArray class scanFrom:;,f1! !RunArray class methodsFor: 'instance creation' stamp: 'tk 7/22/2002 18:34'! scanFrom: strm "Read the style section of a fileOut or sources file. nextChunk has already been done. We need to return a RunArray of TextAttributes of various kinds. These are written by the implementors of writeScanOn:" | rr vv aa this | (strm peekFor: $( ) ifFalse: [^ nil]. rr _ OrderedCollection new. [strm skipSeparators. strm peekFor: $)] whileFalse: [rr add: (Number readFrom: strm)]. vv _ OrderedCollection new. "Value array" aa _ OrderedCollection new. "Attributes list" [(this _ strm next) == nil] whileFalse: [ this == $, ifTrue: [vv add: aa asArray. aa _ OrderedCollection new]. this == $a ifTrue: [aa add: (TextAlignment new alignment: (Number readFrom: strm))]. this == $f ifTrue: [aa add: (TextFontChange new fontNumber: (Number readFrom: strm))]. this == $F ifTrue: [aa add: (TextFontReference new toFont: (StrikeFont familyName: (strm upTo: $#) size: (Number readFrom: strm)))]. this == $b ifTrue: [aa add: (TextEmphasis bold)]. this == $i ifTrue: [aa add: (TextEmphasis italic)]. this == $u ifTrue: [aa add: (TextEmphasis underlined)]. this == $= ifTrue: [aa add: (TextEmphasis struckOut)]. this == $n ifTrue: [aa add: (TextEmphasis normal)]. this == $- ifTrue: [aa add: (TextKern kern: -1)]. this == $+ ifTrue: [aa add: (TextKern kern: 1)]. this == $c ifTrue: [aa add: (TextColor scanFrom: strm)]. "color" this == $L ifTrue: [aa add: (TextLink scanFrom: strm)]. "L not look like 1" this == $R ifTrue: [aa add: (TextURL scanFrom: strm)]. "R capitalized so it can follow a number" this == $q ifTrue: [aa add: (TextSqkPageLink scanFrom: strm)]. this == $p ifTrue: [aa add: (TextSqkProjectLink scanFrom: strm)]. this == $P ifTrue: [aa add: (TextPrintIt scanFrom: strm)]. this == $d ifTrue: [aa add: (TextDoIt scanFrom: strm)]. "space, cr do nothing" ]. aa size > 0 ifTrue: [vv add: aa asArray]. ^ self runs: rr asArray values: vv asArray " RunArray scanFrom: (ReadStream on: '(14 50 312)f1,f1b,f1LInteger +;i') "! ! !TextFontReference methodsFor: 'as yet unclassified' stamp: 'tk 7/22/2002 18:39'! writeScanOn: strm strm nextPut: $F. strm nextPutAll: font familyName; nextPut: $#. font height printOn: strm.! !