Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.156.mcz
==================== Summary ====================
Name: ST80-nice.156
Author: nice
Time: 6 October 2013, 6:43:25.006 pm
UUID: 3dd39ced-b569-46e3-b147-3b38b1b67b30
Ancestors: ST80-nice.155
Remove unnecessary runX inst var from DisplayScanner (written but never read).
=============== Diff against ST80-nice.155 ===============
Item was changed:
----- Method: DisplayScanner>>displayLines:in:clippedBy: (in category '*ST80-Support') -----
displayLines: linesInterval in: aParagraph clippedBy: visibleRectangle
"The central display routine. The call on the primitive
(scanCharactersFrom:to:in:rightX:) will be interrupted according to an
array of stop conditions passed to the scanner at which time the code to
handle the stop condition is run and the call on the primitive continued
until a stop condition returns true (which means the line has
terminated)."
| leftInRun |
"leftInRun is the # of characters left to scan in the current run;
when 0, it is time to call 'self setStopConditions'"
morphicOffset := 0@0.
leftInRun := 0.
self initializeFromParagraph: aParagraph clippedBy: visibleRectangle.
ignoreColorChanges := false.
foregroundColor := paragraphColor := aParagraph foregroundColor.
backgroundColor := aParagraph backgroundColor.
aParagraph backgroundColor isTransparent
ifTrue: [fillBlt := nil]
ifFalse: [fillBlt := bitBlt copy. "Blt to fill spaces, tabs, margins"
fillBlt sourceForm: nil; sourceOrigin: 0@0.
fillBlt fillColor: aParagraph backgroundColor].
rightMargin := aParagraph rightMarginForDisplay.
lineY := aParagraph topAtLineIndex: linesInterval first.
bitBlt destForm deferUpdatesIn: visibleRectangle while: [
linesInterval do:
[:lineIndex |
| string startIndex lastPos runLength stopCondition baselineY |
line := aParagraph lines at: lineIndex.
lastIndex := line first.
leftInRun <= 0
ifTrue: [self setStopConditions. "also sets the font, alignment and emphasisCode"
leftInRun := text runLengthFor: line first].
leftMargin := aParagraph leftMarginForDisplayForLine: lineIndex alignment: alignment.
+ destX := leftMargin.
- destX := runX := leftMargin.
lineHeight := line lineHeight.
fillBlt == nil ifFalse:
[fillBlt destX: visibleRectangle left destY: lineY
width: visibleRectangle width height: lineHeight; copyBits].
baselineY := lineY + line baseline.
destY := baselineY - font ascent. "Should have happened in setFont"
runLength := leftInRun.
runStopIndex := lastIndex + (runLength - 1) min: line last.
leftInRun := leftInRun - (runStopIndex - lastIndex + 1).
spaceCount := 0.
string := text string.
self handleIndentation.
[
startIndex := lastIndex.
lastPos := destX@destY.
stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
in: string rightX: rightMargin stopConditions: stopConditions
kern: kern.
lastIndex >= startIndex ifTrue:[
font displayString: string on: bitBlt
from: startIndex to: lastIndex at: lastPos kern: kern].
"see setStopConditions for stopping conditions for displaying."
self perform: stopCondition
] whileFalse.
fillBlt == nil ifFalse:
[fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].
lineY := lineY + lineHeight]]!
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.253.mcz
==================== Summary ====================
Name: Graphics-nice.253
Author: nice
Time: 31 August 2013, 6:18:17.172 pm
UUID: a6c5f5d3-77b5-417f-97bc-a7234830f298
Ancestors: Graphics-nice.252
Remove space stopCondition again now that it is unused and that a proper Monticello configuration Map enables gentle update.
Fix a subtle glitch related to this removal: the space width will now be indented by kern in CharacterBlockScanner and DisplayScanner, so the CompositionScanner must also do so (same for paddedSpace).
Arrange to have the CharacterBlockScanner behaving with embedded object like with any other character: click left of middle select before, right of middle select after the embedded object. Change the logic of placeEmbeddedObject: for this purpose:
- if the object fits, placeEmbeddedObject: is responsible for incrementing destX
- and embeddedObject is responsible for incrementing the character index (lastIndex)
- otherwise embeddedObject shall send crossedX if the object doesn't fit
Remove unnecessary runX inst var from DisplayScanner (written but never read).
=============== Diff against Graphics-nice.252 ===============
Item was changed:
----- Method: CharacterBlockScanner>>paddedSpace (in category 'stop conditions') -----
paddedSpace
"When the line is justified, the spaces will not be the same as the font's
space character. A padding of extra space must be considered in trying
to find which character the cursor is pointing at. Answer whether the
scanning has crossed the cursor."
| pad |
spaceCount := spaceCount + 1.
pad := line justifiedPadFor: spaceCount font: font.
lastCharacterWidth := spaceWidth + pad.
(destX + lastCharacterWidth) >= characterPoint x
ifTrue:
[^self crossedX].
lastIndex := lastIndex + 1.
+ destX := destX + lastCharacterWidth + kern.
- destX := destX + lastCharacterWidth.
^ false
!
Item was changed:
----- Method: CharacterBlockScanner>>placeEmbeddedObject: (in category 'private') -----
placeEmbeddedObject: anchoredMorph
"Workaround: The following should really use #textAnchorType"
+ | w |
anchoredMorph relativeTextAnchorPosition ifNotNil:[^true].
+ w := anchoredMorph width.
+ specialWidth := w.
+ (destX + w > characterPoint x) ifTrue: [^false].
+ destX := destX + w + kern.
- (super placeEmbeddedObject: anchoredMorph) ifFalse: [^ false].
- specialWidth := anchoredMorph width.
^ true!
Item was removed:
- ----- Method: CharacterBlockScanner>>space (in category 'stop conditions') -----
- space
- "Account for spaceWidth"
-
- spaceCount := spaceCount + 1.
- lastCharacterWidth := spaceWidth.
- (destX + lastCharacterWidth) >= characterPoint x
- ifTrue:
- [^self crossedX].
- lastIndex := lastIndex + 1.
- destX := destX + lastCharacterWidth.
- ^ false!
Item was changed:
----- Method: CharacterScanner>>embeddedObject (in category 'stop conditions') -----
embeddedObject
+ pendingKernX := 0.
- | savedIndex |
- savedIndex := lastIndex.
text attributesAt: lastIndex do:[:attr|
attr anchoredMorph ifNotNil:[
+ "Try to placeEmbeddedObject: - if it answers false, then there's no place left"
+ (self placeEmbeddedObject: attr anchoredMorph) ifFalse:[^self crossedX]]].
+ "Note: if ever several objects are embedded on same character, only indent lastIndex once"
+ lastIndex := lastIndex + 1.
- "Following may look strange but logic gets reversed.
- If the morph fits on this line we're not done (return false for true)
- and if the morph won't fit we're done (return true for false)"
- (self placeEmbeddedObject: attr anchoredMorph) ifFalse:[^true]]].
- lastIndex := savedIndex + 1. "for multiple(!!) embedded morphs"
^false!
Item was changed:
----- Method: CharacterScanner>>placeEmbeddedObject: (in category 'private') -----
placeEmbeddedObject: anchoredMorph
+ "Place the anchoredMorph or return false if it cannot be placed"
- "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 > 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"
^ true!
Item was changed:
----- Method: CompositionScanner>>placeEmbeddedObject: (in category 'private') -----
placeEmbeddedObject: anchoredMorph
+ | w descent |
- | descent |
"Workaround: The following should really use #textAnchorType"
anchoredMorph relativeTextAnchorPosition ifNotNil:[^true].
+ w := anchoredMorph width.
+ (destX + w > rightMargin and: [(leftMargin + w) <= rightMargin or: [lastIndex > line first]])
+ ifTrue: ["Won't fit, but would on next line"
+ ^ false].
+ destX := destX + w + kern.
- (super placeEmbeddedObject: anchoredMorph) ifFalse: ["It doesn't fit"
- "But if it's the first character then leave it here"
- lastIndex < line first ifFalse:[
- line stop: lastIndex-1.
- ^ false]].
descent := lineHeight - baseline.
lineHeight := lineHeight max: anchoredMorph height.
baseline := lineHeight - descent.
- line stop: lastIndex.
^ true!
Item was changed:
+ ----- Method: CompositionScanner>>setStopConditions (in category 'private') -----
- ----- Method: CompositionScanner>>setStopConditions (in category 'stop conditions') -----
setStopConditions
"Set the font and the stop conditions for the current run."
self setFont.
stopConditions := wantsColumnBreaks == true
ifTrue: [ColumnBreakStopConditions]
ifFalse: [CompositionStopConditions]!
Item was changed:
----- Method: CompositionScanner>>space (in category 'stop conditions') -----
space
"Record left x and character index of the space character just encountered.
Used for wrap-around. Answer whether the character has crossed the
right edge of the composition rectangle of the paragraph."
pendingKernX := 0.
spaceX := destX.
- destX := spaceX + spaceWidth.
spaceIndex := lastIndex.
lineHeightAtSpace := lineHeight.
baselineAtSpace := baseline.
- lastIndex := lastIndex + 1.
spaceCount := spaceCount + 1.
lastBreakIsNotASpace := false.
+ destX + spaceWidth > rightMargin ifTrue:[^self crossedX].
+ destX := spaceX + spaceWidth + kern.
+ lastIndex := lastIndex + 1.
- destX > rightMargin ifTrue: [^self crossedX].
^false
!
Item was changed:
CharacterScanner subclass: #DisplayScanner
+ instanceVariableNames: 'bitBlt lineY foregroundColor backgroundColor fillBlt lineHeight paragraphColor morphicOffset ignoreColorChanges'
- instanceVariableNames: 'bitBlt lineY runX foregroundColor backgroundColor fillBlt lineHeight paragraphColor morphicOffset ignoreColorChanges'
classVariableNames: ''
poolDictionaries: ''
category: 'Graphics-Text'!
!DisplayScanner commentStamp: '<historical>' prior: 0!
My instances are used to scan text and display it on the screen or in a hidden form.!
Item was changed:
----- Method: DisplayScanner>>displayLine:offset:leftInRun: (in category 'scanning') -----
displayLine: textLine offset: offset leftInRun: leftInRun
"The call on the primitive (scanCharactersFrom:to:in:rightX:) will be interrupted according to an array of stop conditions passed to the scanner at which time the code to handle the stop condition is run and the call on the primitive continued until a stop condition returns true (which means the line has terminated). leftInRun is the # of characters left to scan in the current run; when 0, it is time to call setStopConditions."
| stopCondition nowLeftInRun startIndex string lastPos |
line := textLine.
morphicOffset := offset.
lineY := line top + offset y.
lineHeight := line lineHeight.
rightMargin := line rightMargin + offset x.
lastIndex := line first.
leftInRun <= 0 ifTrue: [self setStopConditions].
leftMargin := (line leftMarginForAlignment: alignment) + offset x.
+ destX := leftMargin.
- destX := runX := leftMargin.
fillBlt == nil ifFalse:
["Not right"
fillBlt destX: line left destY: lineY
width: line width left height: lineHeight; copyBits].
lastIndex := line first.
leftInRun <= 0
ifTrue: [nowLeftInRun := text runLengthFor: lastIndex]
ifFalse: [nowLeftInRun := leftInRun].
destY := lineY + line baseline - font ascent.
runStopIndex := lastIndex + (nowLeftInRun - 1) min: line last.
spaceCount := 0.
string := text string.
[
"remember where this portion of the line starts"
startIndex := lastIndex.
lastPos := destX@destY.
"find the end of this portion of the line"
stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex
in: string rightX: rightMargin stopConditions: stopConditions
kern: kern.
"display that portion of the line"
lastIndex >= startIndex ifTrue:[
font displayString: string on: bitBlt
from: startIndex
"XXXX: The following is an interesting bug. All stopConditions exept #endOfRun
have lastIndex past the last character displayed. #endOfRun sets it *on* the character.
If we display up until lastIndex then we will also display invisible characters like
CR and tab. This problem should be fixed in the scanner (i.e., position lastIndex
consistently) but I don't want to deal with the fallout right now so we keep the
fix minimally invasive."
to: (stopCondition == #endOfRun ifTrue:[lastIndex] ifFalse:[lastIndex-1])
at: lastPos kern: kern].
"handle the stop condition"
"see setStopConditions for stopping conditions for displaying."
self perform: stopCondition
] whileFalse.
^ runStopIndex - lastIndex "Number of characters remaining in the current run"!
Item was changed:
----- Method: DisplayScanner>>endOfRun (in category 'stop conditions') -----
endOfRun
"The end of a run in the display case either means that there is actually
a change in the style (run code) to be associated with the string or the
end of this line has been reached."
| runLength |
lastIndex = line last ifTrue: [^true].
- runX := destX.
runLength := text runLengthFor: (lastIndex := lastIndex + 1).
runStopIndex := lastIndex + (runLength - 1) min: line last.
self setStopConditions.
^ false!
Item was changed:
----- Method: DisplayScanner>>paddedSpace (in category 'stop conditions') -----
paddedSpace
"Each space is a stop condition when the alignment is right justified.
Padding must be added to the base width of the space according to
which space in the line this space is and according to the amount of
space that remained at the end of the line when it was composed."
spaceCount := spaceCount + 1.
+ destX := destX + spaceWidth + kern + (line justifiedPadFor: spaceCount font: font).
- destX := destX + spaceWidth + (line justifiedPadFor: spaceCount font: font).
lastIndex := lastIndex + 1.
pendingKernX := 0.
^ false!
Item was changed:
----- Method: DisplayScanner>>placeEmbeddedObject: (in category 'private') -----
placeEmbeddedObject: anchoredMorph
anchoredMorph relativeTextAnchorPosition ifNotNil:[
anchoredMorph position:
anchoredMorph relativeTextAnchorPosition +
(anchoredMorph owner textBounds origin x @ 0)
- (0@morphicOffset y) + (0@lineY).
^true
].
+ anchoredMorph relativeTextAnchorPosition ifNotNil:[^true].
- (super placeEmbeddedObject: anchoredMorph) ifFalse: [^ false].
(anchoredMorph isMorph or: [anchoredMorph isPrimitiveCostume]) ifTrue: [
+ anchoredMorph position: (destX@lineY) - morphicOffset
- anchoredMorph position: ((destX - anchoredMorph width)@lineY) - morphicOffset
] ifFalse: [
destY := lineY.
- runX := destX.
anchoredMorph
displayOn: bitBlt destForm
+ at: destX @ destY
- at: destX - anchoredMorph width @ destY
clippingBox: bitBlt clipRect
].
+ destX := destX + anchoredMorph width + kern.
^ true!
Item was removed:
- ----- Method: DisplayScanner>>space (in category 'stop conditions') -----
- space
- "Don't display the space, just skip the spaceWidth."
-
- spaceCount := spaceCount + 1.
- destX := destX + spaceWidth.
- lastIndex := lastIndex + 1.
- pendingKernX := 0.
- ^ false!
Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-nice.122.mcz
==================== Summary ====================
Name: MorphicExtras-nice.122
Author: nice
Time: 5 October 2013, 10:43:42.278 pm
UUID: 04816846-26b7-4acb-a0f1-c8bf63ae9479
Ancestors: MorphicExtras-nice.121
No need to handle space stopCondition at display time
=============== Diff against MorphicExtras-nice.121 ===============
Item was removed:
- ----- Method: CanvasCharacterScanner>>space (in category 'stop conditions') -----
- space
- "Each space is a stop condition"
-
- destX := destX + spaceWidth.
- lastIndex := lastIndex + 1.
- pendingKernX := 0.
- ^ false!
Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.251.mcz
==================== Summary ====================
Name: Graphics-nice.251
Author: nice
Time: 5 October 2013, 10:42:02.017 pm
UUID: 72340e03-5929-4a5b-9514-f8feb4ccc172
Ancestors: Graphics-nice.250
Don't stop on space by default, this has no interest outside CompositionScanner except slowing down the scan loop.
Thus create a CompositionStopConditions for the case when we want stopping on space.
Revise the setting of stopConditions again (no need for setStopConditionsOrNil: intermediate)
=============== Diff against Graphics-nice.250 ===============
Item was removed:
- ----- Method: CharacterBlockScanner>>space (in category 'stop conditions') -----
- space
- "Account for spaceWidth"
-
- spaceCount := spaceCount + 1.
- lastCharacterWidth := spaceWidth.
- (destX + lastCharacterWidth) >= characterPoint x
- ifTrue:
- [^self crossedX].
- lastIndex := lastIndex + 1.
- destX := destX + lastCharacterWidth.
- ^ false!
Item was changed:
Object subclass: #CharacterScanner
instanceVariableNames: 'destX lastIndex destY stopConditions text textStyle alignment leftMargin rightMargin font line runStopIndex spaceCount spaceWidth emphasisCode kern indentationLevel wantsColumnBreaks pendingKernX'
+ classVariableNames: 'ColumnBreakStopConditions CompositionStopConditions DefaultStopConditions MeasuringStopConditions PaddedSpaceCondition'
- classVariableNames: 'ColumnBreakStopConditions DefaultStopConditions MeasuringStopConditions PaddedSpaceCondition'
poolDictionaries: 'TextConstants'
category: 'Graphics-Text'!
!CharacterScanner commentStamp: '<historical>' prior: 0!
My instances hold the state associated with scanning text. My subclasses scan characters for specified purposes, such as computing a CharacterBlock or placing characters into Forms.!
Item was changed:
----- Method: CharacterScanner class>>initialize (in category 'class initialization') -----
initialize
"
CharacterScanner initialize
"
| a |
a := TextStopConditions new.
a at: 1 + 1 put: #embeddedObject.
- a at: Space asciiValue + 1 put: #space.
a at: Tab asciiValue + 1 put: #tab.
a at: CR asciiValue + 1 put: #cr.
a at: Character lf asciiValue + 1 put: #cr.
DefaultStopConditions := a copy.
+ CompositionStopConditions := a copy.
+ CompositionStopConditions at: Space asciiValue + 1 put: #space.
+ ColumnBreakStopConditions := CompositionStopConditions copy.
- ColumnBreakStopConditions := a copy.
ColumnBreakStopConditions at: Character characterForColumnBreak asciiValue + 1 put: #columnBreak.
PaddedSpaceCondition := a copy.
PaddedSpaceCondition at: Space asciiValue + 1 put: #paddedSpace.
MeasuringStopConditions := TextStopConditions new!
Item was changed:
----- Method: CharacterScanner>>setFont (in category 'private') -----
setFont
| priorFont |
"Set the font and other emphasis."
priorFont := font.
text == nil ifFalse:[
emphasisCode := 0.
kern := 0.
indentationLevel := 0.
alignment := textStyle alignment.
font := nil.
(text attributesAt: lastIndex forStyle: textStyle)
do: [:att | att emphasizeScanner: self]].
font == nil ifTrue:
[self setFont: textStyle defaultFontIndex].
font := font emphasized: emphasisCode.
priorFont
ifNotNil: [
font = priorFont
ifTrue:[
"font is the same, perhaps the color has changed?
We still want kerning between chars of the same
font, but of different color. So add any pending kern to destX"
destX := destX + (pendingKernX ifNil:[0])].
destX := destX + priorFont descentKern].
pendingKernX := 0. "clear any pending kern so there is no danger of it being added twice"
destX := destX - font descentKern.
"NOTE: next statement should be removed when clipping works"
leftMargin ifNotNil: [destX := destX max: leftMargin].
kern := kern - font baseKern.
"Install various parameters from the font."
+ spaceWidth := font widthOf: Space.!
- spaceWidth := font widthOf: Space.
- stopConditions := DefaultStopConditions.!
Item was changed:
+ ----- Method: CharacterScanner>>setFont: (in category 'text attributes') -----
- ----- Method: CharacterScanner>>setFont: (in category 'private') -----
setFont: fontNumber
"Set the font by number from the textStyle."
self setActualFont: (textStyle fontAt: fontNumber)!
Item was changed:
----- Method: CharacterScanner>>setStopConditions (in category 'private') -----
setStopConditions
"Set the font and the stop conditions for the current run."
self setFont.
+ stopConditions := alignment = Justified
+ ifTrue: [PaddedSpaceCondition]
+ ifFalse: [DefaultStopConditions]!
- self setStopConditionsOrNil: (alignment = Justified ifTrue: [PaddedSpaceCondition])!
Item was removed:
- ----- Method: CharacterScanner>>setStopConditionsOrNil: (in category 'private') -----
- setStopConditionsOrNil: aStopConditionOrNil
-
- aStopConditionOrNil ifNotNil: [^stopConditions := aStopConditionOrNil].
- ^stopConditions := DefaultStopConditions!
Item was changed:
----- Method: CompositionScanner>>setStopConditions (in category 'stop conditions') -----
setStopConditions
"Set the font and the stop conditions for the current run."
self setFont.
+ stopConditions := wantsColumnBreaks == true
+ ifTrue: [ColumnBreakStopConditions]
+ ifFalse: [CompositionStopConditions]!
- self setStopConditionsOrNil: (wantsColumnBreaks == true ifTrue: [ColumnBreakStopConditions])!
Item was removed:
- ----- Method: DisplayScanner>>space (in category 'stop conditions') -----
- space
- "Don't display the space, just skip the spaceWidth."
-
- spaceCount := spaceCount + 1.
- destX := destX + spaceWidth.
- lastIndex := lastIndex + 1.
- pendingKernX := 0.
- ^ false!
Item was added:
+ ----- Method: SegmentScanner>>setStopConditions (in category 'private') -----
+ setStopConditions
+ "Set the font and the stop conditions for the current run."
+
+ self setFont.
+ stopConditions := DefaultStopConditions!
Item was removed:
- ----- Method: SegmentScanner>>setStopConditionsOrNil: (in category 'private') -----
- setStopConditionsOrNil: aStopConditionOrNil
-
- aStopConditionOrNil ifNotNil: [^stopConditions := aStopConditionOrNil].
- stopConditions := DefaultStopConditions copy.
- stopConditions at: Space asciiValue + 1 put: nil.
- ^stopConditions!
I hope everyone understands now why it is better to maintain a single
CharacterScanner hierarchy :)
And why this hierarchy should be as clean as possible
(try to limit the occurrence of code smells like too many states, too long
methods, too many ifTrue:ifFalse: etc...)
Trying to correct these glitches in two hierarchies with small state
machine differences is a nightmare.
2013/10/5 <commits(a)source.squeak.org>
> Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-nice.695.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-nice.695
> Author: nice
> Time: 5 October 2013, 12:05:58.658 am
> UUID: c0320b47-c05e-4f35-ae13-9faee7640629
> Ancestors: Morphic-nice.694
>
> A TextAnchor should not try to directly #placeEmbeddedObject: when
> emphasizing the scanner.
> Indeed, a scanner requests the Text to apply emphasis/attributes at an
> initialization stage (setFont).
> It is the scanner scan loop which is responsible for composing the text.
> Since this initialization happens outside the scan loop, the scanner is
> not yet ready to place anything.
>
> The placement will happen later when the scanner is willing to, by the
> following mechanism:
> - every TextAnchor is associated with a (Character value: 1).
> - there is a stopCondition associated to this value which will be
> processed in the scan loop and invoke #embeddedObject.
> - #embeddedObject will send #placeEmbeddedObject:
>
> Restoring this method from 12 years ago fixes a glitch when the embedded
> morph crosses the right margin.
> The glitch is due to a setFont which is sent from inside the scan loop in
> some conditions and incorrectly increments twice the morph display position.
>
> =============== Diff against Morphic-nice.694 ===============
>
> Item was changed:
> ----- Method: TextAnchor>>emphasizeScanner: (in category 'visiting')
> -----
> + emphasizeScanner: scanner
> + "Do nothing for emphasizing the scanner - if the anchor is valid a
> #embeddedObject will be encountered by the scanner and do the real thing"!
> - emphasizeScanner: aScanner
> - self anchoredMorph ifNil: [ ^ self ].
> - aScanner placeEmbeddedObject: self anchoredMorph.!
>
>
>
Changes to Trunk (http://source.squeak.org/trunk.html) in the last 24 hours:
http://lists.squeakfoundation.org/pipermail/packages/2013-October/006486.ht…
Name: ST80-nice.154
Ancestors: ST80-nice.153
Move TextLineInterval from Graphics to ST80-Support
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2013-October/006487.ht…
Name: Graphics-nice.249
Ancestors: Graphics-nice.248
Move TextLineInterval from Graphics to ST80-Support
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2013-October/006488.ht…
Name: Morphic-nice.695
Ancestors: Morphic-nice.694
A TextAnchor should not try to directly #placeEmbeddedObject: when emphasizing the scanner.
Indeed, a scanner requests the Text to apply emphasis/attributes at an initialization stage (setFont).
It is the scanner scan loop which is responsible for composing the text.
Since this initialization happens outside the scan loop, the scanner is not yet ready to place anything.
The placement will happen later when the scanner is willing to, by the following mechanism:
- every TextAnchor is associated with a (Character value: 1).
- there is a stopCondition associated to this value which will be processed in the scan loop and invoke #embeddedObject.
- #embeddedObject will send #placeEmbeddedObject:
Restoring this method from 12 years ago fixes a glitch when the embedded morph crosses the right margin.
The glitch is due to a setFont which is sent from inside the scan loop in some conditions and incorrectly increments twice the morph display position.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2013-October/006489.ht…
Name: Graphics-nice.250
Ancestors: Graphics-nice.249
Categorize placeEmbeddedObject: as private
Merge Graphics-Text support and Graphics-Text: really, these are all support classes
Remove TextLine>>justifiedPadFor: which is superseded by justifiedPadFor:font: for a few years now (since integration of FreeType support in trunk image).
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2013-October/006490.ht…
Name: MorphicExtras-nice.121
Ancestors: MorphicExtras-tpr.120
Remove PostscriptCharacterScanner>>placeEmbeddedObject: because it is a private method of CharacterScanner which won't be sent to a PostscriptCharacterScanner.
Classify CanvasCharacterScanner>>textColor: according to own hierarchy.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2013-October/006491.ht…
Name: ST80-nice.155
Ancestors: ST80-nice.154
Remove TextLine>>justifiedPadFor: which is superseded by justifiedPadFor:font: for a few years now (since integration of FreeType support in trunk image).
=============================================
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.155.mcz
==================== Summary ====================
Name: ST80-nice.155
Author: nice
Time: 5 October 2013, 12:56:25.948 am
UUID: 6ad504af-187b-4e17-9cda-5ef6881ab634
Ancestors: ST80-nice.154
Remove TextLine>>justifiedPadFor: which is superseded by justifiedPadFor:font: for a few years now (since integration of FreeType support in trunk image).
=============== Diff against ST80-nice.154 ===============
Item was removed:
- ----- Method: TextLineInterval>>justifiedPadFor: (in category 'scanning') -----
- justifiedPadFor: spaceIndex
- "Compute the width of pad for a given space in a line of justified text."
-
- | pad |
- internalSpaces = 0 ifTrue: [^0].
- pad := paddingWidth // internalSpaces.
- spaceIndex <= (paddingWidth \\ internalSpaces)
- ifTrue: [^pad + 1]
- ifFalse: [^pad]!
Nicolas Cellier uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-nice.121.mcz
==================== Summary ====================
Name: MorphicExtras-nice.121
Author: nice
Time: 5 October 2013, 12:54:43.589 am
UUID: f616e9dc-b0a4-4f54-9fab-e1d050cfb5fc
Ancestors: MorphicExtras-tpr.120
Remove PostscriptCharacterScanner>>placeEmbeddedObject: because it is a private method of CharacterScanner which won't be sent to a PostscriptCharacterScanner.
Classify CanvasCharacterScanner>>textColor: according to own hierarchy.
=============== Diff against MorphicExtras-tpr.120 ===============
Item was changed:
+ ----- Method: CanvasCharacterScanner>>textColor: (in category 'text attributes') -----
- ----- Method: CanvasCharacterScanner>>textColor: (in category 'private') -----
textColor: color
foregroundColor := color!
Item was removed:
- ----- Method: PostscriptCharacterScanner>>placeEmbeddedObject: (in category 'textstyle support') -----
- placeEmbeddedObject: anchoredMorph
- !