[Pkg] The Trunk: Graphics-cmm.124.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Mar 23 19:17:04 UTC 2010


Chris Muller uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-cmm.124.mcz

==================== Summary ====================

Name: Graphics-cmm.124
Author: cmm
Time: 23 March 2010, 2:15:51.378 pm
UUID: 65dc98dc-9e39-46e1-95fc-b1df71b6ad86
Ancestors: Graphics-ar.123

Several fixes related to embedding Morphs into a piece of Text.

=============== Diff against Graphics-ar.123 ===============

Item was changed:
  ----- Method: CompositionScanner>>crossedX (in category 'stop conditions') -----
  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."
  
  	pendingKernX := 0.
  	spaceCount >= 1 ifTrue:
  		["The common case. First back off to the space at which we wrap."
  		line stop: spaceIndex.
  		lineHeight := lineHeightAtSpace.
  		baseline := baselineAtSpace.
  		spaceCount := spaceCount - 1.
  		spaceIndex := spaceIndex - 1.
  
  		"Check to see if any spaces preceding the one at which we wrap.
  			Double space after punctuation, most likely."
  		[(spaceCount > 1 and: [(text at: spaceIndex) = Space])]
  			whileTrue:
  				[spaceCount := spaceCount - 1.
  				"Account for backing over a run which might
  					change width of space."
  				font := text fontAt: spaceIndex withStyle: textStyle.
  				spaceIndex := spaceIndex - 1.
  				spaceX := spaceX - (font widthOf: Space)].
  		line paddingWidth: rightMargin - spaceX.
  		line internalSpaces: spaceCount]
  	ifFalse:
  		["Neither internal nor trailing spaces -- almost never happens."
  		lastIndex := lastIndex - 1.
+ 		[destX <= rightMargin or: [ lastIndex = 0 ]]
- 		[destX <= rightMargin]
  			whileFalse:
  				[destX := destX - (font widthOf: (text at: lastIndex)).
  				lastIndex := lastIndex - 1].
  		spaceX := destX.
  		line paddingWidth: rightMargin - destX.
  		line stop: (lastIndex max: line first)].
  	^true!

Item was changed:
  ----- Method: CharacterScanner>>placeEmbeddedObject: (in category 'scanning') -----
  placeEmbeddedObject: anchoredMorph
  	"Place the anchoredMorph or return false if it cannot be placed.
  	In any event, advance destX by its width."
  	| w |
  	"Workaround: The following should really use #textAnchorType"
  	anchoredMorph relativeTextAnchorPosition ifNotNil:[^true].
+ 	destX _ destX + (w _ anchoredMorph width).
- 	destX := destX + (w := anchoredMorph width).
  	(destX > rightMargin and: [(leftMargin + w) <= rightMargin])
  		ifTrue: ["Won't fit, but would on next line"
  				^ false].
+ 	lastIndex _ lastIndex + 1.
+ 	"self setFont."  "Force recalculation of emphasis for next run"
- 	lastIndex := lastIndex + 1.
- 	self setFont.  "Force recalculation of emphasis for next run"
  	^ true!

Item was changed:
  ----- Method: CompositionScanner>>composeFrom:inRectangle:firstLine:leftSide:rightSide: (in category 'scanning') -----
  composeFrom: startIndex inRectangle: lineRectangle
  	firstLine: firstLine leftSide: leftSide rightSide: rightSide
  	"Answer an instance of TextLineInterval that represents the next line in the paragraph."
  	| runLength stopCondition |
  	"Set up margins"
  	leftMargin := lineRectangle left.
  	leftSide ifTrue: [leftMargin := leftMargin +
  						(firstLine ifTrue: [textStyle firstIndent]
  								ifFalse: [textStyle restIndent])].
  	destX := spaceX := leftMargin.
  	rightMargin := lineRectangle right.
  	rightSide ifTrue: [rightMargin := rightMargin - textStyle rightIndent].
  	lastIndex := startIndex.	"scanning sets last index"
  	destY := lineRectangle top.
  	lineHeight := baseline := 0.  "Will be increased by setFont"
+ 	line := (TextLine start: lastIndex stop: 0 internalSpaces: 0 paddingWidth: 0)
+ 				rectangle: lineRectangle.
  	self setStopConditions.	"also sets font"
  	runLength := text runLengthFor: startIndex.
  	runStopIndex := (lastIndex := startIndex) + (runLength - 1).
- 	line := (TextLine start: lastIndex stop: 0 internalSpaces: 0 paddingWidth: 0)
- 				rectangle: lineRectangle.
  	spaceCount := 0.
  	self handleIndentation.
  	leftMargin := destX.
  	line leftMargin: leftMargin.
  
  	[false]
  		whileFalse: 
  			[stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
  				in: text string rightX: rightMargin stopConditions: stopConditions
  				kern: kern.
  			"See setStopConditions for stopping conditions for composing."
  			(self perform: stopCondition)
  				ifTrue: [^ line lineHeight: lineHeight + textStyle leading
  							baseline: baseline + textStyle leading]]!



More information about the Packages mailing list