[Pkg] The Trunk: Graphics-nice.246.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Oct 2 21:35:36 UTC 2013

Nicolas Cellier uploaded a new version of Graphics to project The Trunk:

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

Name: Graphics-nice.246
Author: nice
Time: 2 October 2013, 11:33:50.036 pm
UUID: 077a14d5-c038-44ed-b18f-567531f97a2e
Ancestors: Graphics-nice.245

Fix a small glitch in rightFlush aligment: when you add so many spaces that a single word fits on the line, then it happens that one space sticks before the right margin preventing correct alignment of this word.

=============== Diff against Graphics-nice.245 ===============

Item was changed:
  ----- Method: CompositionScanner>>crossedX (in category 'stop conditions') -----
  	"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,
  	or any other breakable character if the language permits so."
  	pendingKernX := 0.
  	lastBreakIsNotASpace ifTrue:
  		["In some languages break is possible before a non space."
  		nextIndexAfterLineBreak := spaceIndex.
  		line stop: spaceIndex - 1.
  		lineHeight := lineHeightAtSpace.
  		baseline := baselineAtSpace.
  		line paddingWidth: rightMargin - spaceX.
  		line internalSpaces: spaceCount.
  	spaceCount >= 1 ifTrue:
  		["The common case. First back off to the space at which we wrap."
  		line stop: spaceIndex.
  		nextIndexAfterLineBreak := spaceIndex + 1.
  		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])]
- 		[(spaceCount > 1 and: [(text at: spaceIndex) = Space])]
  				[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]
  		["Neither internal nor trailing spaces -- almost never happens."
  		lastIndex := lastIndex - 1.
  		[destX <= rightMargin or: [ lastIndex = 0 ]]
  				[destX := destX - (font widthOf: (text at: lastIndex)).
  				lastIndex := lastIndex - 1].
  		nextIndexAfterLineBreak := lastIndex + 1.
  		spaceX := destX.
  		line paddingWidth: rightMargin - destX.
  		line stop: (lastIndex max: line first)].

More information about the Packages mailing list