Squeak Class Documentation category index | class index  
 
CompositionScanner
  category: Graphics-Text
  superclass: CharacterScanner
  subclasses: SegmentScanner

CompositionScanners are used to measure text and determine where line breaks and space padding should occur.

instance methods
  accessing
  rightX

  intialize-release
  forParagraph:

  scanning
  composeFrom:inRectangle:firstLine:leftSide:rightSide:
composeLine:fromCharacterIndex:inParagraph:
setActualFont:

  stop conditions
  columnBreak
cr
crossedX
endOfRun
placeEmbeddedObject:
setFont
setStopConditions
space
tab

class methods
  no messages
 

instance methods
  accessing top  
 

rightX

Meaningful only when a line has just been composed -- refers to the
line most recently composed. This is a subtrefuge to allow for easy
resizing of a composition rectangle to the width of the maximum line.
Useful only when there is only one line in the form or when each line
is terminated by a carriage return. Handy for sizing menus and lists.


  intialize-release top  
 

forParagraph:

Initialize the receiver for scanning the given paragraph.


  scanning top  
 

composeFrom:inRectangle:firstLine:leftSide:rightSide:

Answer an instance of TextLineInterval that represents the next line in the paragraph.


 

composeLine:fromCharacterIndex:inParagraph:

Answer an instance of TextLineInterval that represents the next line in the paragraph.


 

setActualFont:

Keep track of max height and ascent for auto lineheight


  stop conditions top  
 

columnBreak

Answer true. Set up values for the text line interval currently being
composed.


 

cr

Answer true. Set up values for the text line interval currently being
composed.


 

crossedX

There is a word that has fallen across the right edge of the composition
rectangle. This signals the need for wrapping which is done to the last
space that was encountered, as recorded by the space stop condition.


 

endOfRun

Answer true if scanning has reached the end of the paragraph.
Otherwise step conditions (mostly install potential new font) and answer
false.


 

placeEmbeddedObject:

Place the anchoredMorph or return false if it cannot be placed.
In any event, advance destX by its width.


 

setFont

Set the font and other emphasis.


 

setStopConditions

Set the font and the stop conditions for the current run.


 

space

Record left x and character index of the space character just encounted.
Used for wrap-around. Answer whether the character has crossed the
right edge of the composition rectangle of the paragraph.


 

tab

Advance destination x according to tab settings in the paragraph's
textStyle. Answer whether the character has crossed the right edge of
the composition rectangle of the paragraph.


class methods
  no messages top