<div dir="ltr"><div><div><div><div>...were computed,...<br></div>The last two different inst. vars. are:<br></div>1) firstDestX seems to be used when a single Character of embedded Morph does not fit in composition width.<br>
</div>2) lastWidth used only in Combining pre-composed unicode<br></div>IMO, we should totally rewrite the combining stuff. We could then remove lastWidth...</div><div class="gmail_extra"><br><br><div class="gmail_quote">
2013/9/27  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Nicolas Cellier uploaded a new version of Multilingual to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Multilingual-nice.179.mcz" target="_blank">http://source.squeak.org/trunk/Multilingual-nice.179.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Multilingual-nice.179<br>
Author: nice<br>
Time: 27 September 2013, 10:50:01.56 pm<br>
UUID: db50e584-fe6f-4a0c-b200-72b2e6074e5c<br>
Ancestors: Multilingual-nice.178<br>
<br>
Remove usage of baselineY inst. var. (I did not removed the inst var yet).<br>
The inst var. where always computed where used, so it can become temp.<br>
This makes one difference less with CharacterScanner hierarchy.<br>
<br>
=============== Diff against Multilingual-nice.178 ===============<br>
<br>
Item was changed:<br>
  ----- Method: MultiCanvasCharacterScanner&gt;&gt;setFont (in category &#39;private&#39;) -----<br>
  setFont<br>
+       | baselineY |<br>
        foregroundColor ifNil: [foregroundColor := Color black].<br>
        super setFont.<br>
        baselineY := lineY + line baseline.<br>
        destY := baselineY - font ascent.!<br>
<br>
Item was changed:<br>
  ----- Method: MultiCharacterBlockScanner&gt;&gt;cr (in category &#39;stop conditions&#39;) -----<br>
  cr<br>
        &quot;Answer a CharacterBlock that specifies the current location of the mouse<br>
        relative to a carriage return stop condition that has just been<br>
        encountered. The ParagraphEditor convention is to denote selections by<br>
        CharacterBlocks, sometimes including the carriage return (cursor is at<br>
        the end) and sometimes not (cursor is in the middle of the text).&quot;<br>
<br>
        ((characterIndex ~= nil<br>
                and: [characterIndex &gt; text size])<br>
                        or: [(line last = text size)<br>
                                and: [(destY + line lineHeight) &lt; characterPoint y]])<br>
                ifTrue: [&quot;When off end of string, give data for next character&quot;<br>
                                destY := destY +  line lineHeight.<br>
-                               baselineY := line lineHeight.<br>
                                lastCharacter := nil.<br>
                                characterPoint := (nextLeftMargin ifNil: [leftMargin]) @ destY.<br>
                                (lastIndex &lt; text size and: [(text at: lastIndex) = CR and: [(text at: lastIndex+1) = Character lf]])<br>
                                        ifTrue: [lastIndex := lastIndex + 2]<br>
                                        ifFalse: [lastIndex := lastIndex + 1].<br>
                                self lastCharacterExtentSetX: 0.<br>
                                ^ true].<br>
                lastCharacter := CR.<br>
                characterPoint := destX @ destY.<br>
                self lastCharacterExtentSetX: rightMargin - destX.<br>
                ^true!<br>
<br>
Item was changed:<br>
  ----- Method: MultiCharacterScanner&gt;&gt;measureString:inFont:from:to: (in category &#39;scanning&#39;) -----<br>
  measureString: aString inFont: aFont from: startIndex to: stopIndex<br>
        &quot;WARNING: In order to use this method the receiver has to be set up using #initializeStringMeasurer&quot;<br>
        destX := destY := lastIndex := 0.<br>
-       baselineY := aFont ascent.<br>
        font := aFont.<br>
        pendingKernX := 0.<br>
        kern := 0 - font baseKern.<br>
        spaceWidth := font widthOf: Space.<br>
<br>
        self scanCharactersFrom: startIndex to: stopIndex in: aString rightX: 999999 stopConditions: stopConditions kern: kern.<br>
        ^destX!<br>
<br>
Item was changed:<br>
  ----- Method: MultiDisplayScanner&gt;&gt;displayLine:offset:leftInRun: (in category &#39;scanning&#39;) -----<br>
  displayLine: textLine offset: offset leftInRun: leftInRun<br>
        &quot;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.&quot;<br>

+       | stopCondition nowLeftInRun startIndex string lastPos baselineY |<br>
-       | stopCondition nowLeftInRun startIndex string lastPos |<br>
        line := textLine.<br>
        morphicOffset := offset.<br>
        lineY := line top + offset y.<br>
        lineHeight := line lineHeight.<br>
        rightMargin := line rightMargin + offset x.<br>
        lastIndex := line first.<br>
        leftInRun &lt;= 0 ifTrue: [self setStopConditions].<br>
        leftMargin := (line leftMarginForAlignment: alignment) + offset x.<br>
        destX := runX := leftMargin.<br>
        fillBlt == nil ifFalse:<br>
                [&quot;Not right&quot;<br>
                fillBlt destX: line left destY: lineY<br>
                        width: line width left height: lineHeight; copyBits].<br>
        lastIndex := line first.<br>
        leftInRun &lt;= 0<br>
                ifTrue: [nowLeftInRun := text runLengthFor: lastIndex]<br>
                ifFalse: [nowLeftInRun := leftInRun].<br>
        baselineY := lineY + line baseline.<br>
        destY := baselineY - font ascent.<br>
        runStopIndex := lastIndex + (nowLeftInRun - 1) min: line last.<br>
        spaceCount := 0.<br>
        string := text string.<br>
        [<br>
                startIndex := lastIndex.<br>
                lastPos := destX@destY.<br>
                stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex<br>
                                                in: string rightX: rightMargin stopConditions: stopConditions<br>
                                                kern: kern.<br>
                lastIndex &gt;= startIndex ifTrue:[<br>
                        bitBlt displayString: string<br>
                                from: startIndex<br>
        &quot;XXXX: The following is an interesting bug. All stopConditions exept #endOfRun<br>
                have lastIndex past the last character displayed. #endOfRun sets it *on* the character.<br>
                If we display up until lastIndex then we will also display invisible characters like<br>
                CR and tab. This problem should be fixed in the scanner (i.e., position lastIndex<br>
                consistently) but I don&#39;t want to deal with the fallout right now so we keep the<br>
                fix minimally invasive.&quot;<br>
                                to: (stopCondition == #endOfRun ifTrue:[lastIndex] ifFalse:[lastIndex-1])<br>
                                at: lastPos kern: kern baselineY: baselineY font: font].<br>
                (emphasisCode allMask: 4) ifTrue:[<br>
                        font displayUnderlineOn: bitBlt from: lastPos x@baselineY to: destX@baselineY.<br>
                ].<br>
                (emphasisCode allMask: 16) ifTrue:[<br>
                        font displayStrikeoutOn: bitBlt from: lastPos x@baselineY to: destX@baselineY.<br>
                ].<br>
                &quot;see setStopConditions for stopping conditions for displaying.&quot;<br>
                self perform: stopCondition.<br>
                &quot;or: [lastIndex &gt; runStopIndex].&quot;<br>
        ] whileFalse.<br>
        ^ runStopIndex - lastIndex   &quot;Number of characters remaining in the current run&quot;!<br>
<br>
Item was changed:<br>
  ----- Method: MultiDisplayScanner&gt;&gt;displayLines:in:clippedBy: (in category &#39;MVC-compatibility&#39;) -----<br>
  displayLines: linesInterval in: aParagraph clippedBy: visibleRectangle<br>
        &quot;The central display routine. The call on the primitive<br>
        (scanCharactersFrom:to:in:rightX:) will be interrupted according to an<br>
        array of stop conditions passed to the scanner at which time the code to<br>
        handle the stop condition is run and the call on the primitive continued<br>
        until a stop condition returns true (which means the line has<br>
        terminated).&quot;<br>
        | leftInRun |<br>
        &quot;leftInRun is the # of characters left to scan in the current run;<br>
                when 0, it is time to call &#39;self setStopConditions&#39;&quot;<br>
        morphicOffset := 0@0.<br>
        leftInRun := 0.<br>
        self initializeFromParagraph: aParagraph clippedBy: visibleRectangle.<br>
        ignoreColorChanges := false.<br>
        foregroundColor := paragraphColor := aParagraph foregroundColor.<br>
        backgroundColor := aParagraph backgroundColor.<br>
        aParagraph backgroundColor isTransparent<br>
                ifTrue: [fillBlt := nil]<br>
                ifFalse: [fillBlt := bitBlt copy.  &quot;Blt to fill spaces, tabs, margins&quot;<br>
                                fillBlt sourceForm: nil; sourceOrigin: 0@0.<br>
                                fillBlt fillColor: aParagraph backgroundColor].<br>
        rightMargin := aParagraph rightMarginForDisplay.<br>
        lineY := aParagraph topAtLineIndex: linesInterval first.<br>
        bitBlt destForm deferUpdatesIn: visibleRectangle while: [<br>
                linesInterval do:<br>
                        [:lineIndex |<br>
+                       | runLength stopCondition startIndex string lastPos baselineY |<br>
-                       | runLength stopCondition startIndex string lastPos |<br>
                        leftMargin := aParagraph leftMarginForDisplayForLine: lineIndex alignment: (alignment ifNil:[textStyle alignment]).<br>
                        destX := (runX := leftMargin).<br>
                        line := aParagraph lines at: lineIndex.<br>
                        lineHeight := line lineHeight.<br>
                        fillBlt == nil ifFalse:<br>
                                [fillBlt destX: visibleRectangle left destY: lineY<br>
                                        width: visibleRectangle width height: lineHeight; copyBits].<br>
                        lastIndex := line first.<br>
                        leftInRun &lt;= 0<br>
                                ifTrue: [self setStopConditions.  &quot;also sets the font&quot;<br>
                                                leftInRun := text runLengthFor: line first].<br>
                        baselineY := lineY + line baseline.<br>
                        destY := baselineY - font ascent.  &quot;Should have happened in setFont&quot;<br>
                        runLength := leftInRun.<br>
                        runStopIndex := lastIndex + (runLength - 1) min: line last.<br>
                        leftInRun := leftInRun - (runStopIndex - lastIndex + 1).<br>
                        spaceCount := 0.<br>
                        string := text string.<br>
                        self handleIndentation.<br>
                        [<br>
                                startIndex := lastIndex.<br>
                                lastPos := destX@destY.<br>
                                stopCondition := self scanCharactersFrom: lastIndex to: runStopIndex<br>
                                                        in: string rightX: rightMargin stopConditions: stopConditions<br>
                                                        kern: kern.<br>
                                lastIndex &gt;= startIndex ifTrue:[<br>
                                        font displayString: string on: bitBlt<br>
                                                from: startIndex to: lastIndex at: lastPos kern: kern baselineY: baselineY].<br>
                                &quot;see setStopConditions for stopping conditions for displaying.&quot;<br>
                                self perform: stopCondition<br>
                        ] whileFalse.<br>
                        fillBlt == nil ifFalse:<br>
                                [fillBlt destX: destX destY: lineY width: visibleRectangle right-destX height: lineHeight; copyBits].<br>
                        lineY := lineY + lineHeight]]!<br>
<br>
Item was changed:<br>
  ----- Method: MultiDisplayScanner&gt;&gt;placeEmbeddedObject: (in category &#39;scanning&#39;) -----<br>
  placeEmbeddedObject: anchoredMorph<br>
        anchoredMorph relativeTextAnchorPosition ifNotNil:[<br>
                anchoredMorph position:<br>
                        anchoredMorph relativeTextAnchorPosition +<br>
                        (anchoredMorph owner textBounds origin x @ 0)<br>
                        - (0@morphicOffset y) + (0@lineY).<br>
                ^true<br>
        ].<br>
        (super placeEmbeddedObject: anchoredMorph) ifFalse: [^ false].<br>
        (anchoredMorph isMorph or: [anchoredMorph isPrimitiveCostume]) ifTrue: [<br>
                anchoredMorph position: ((destX - anchoredMorph width)@lineY) - morphicOffset<br>
+       ] ifFalse: [| baselineY |<br>
-       ] ifFalse: [<br>
                destY := lineY.<br>
                baselineY := lineY + anchoredMorph height..<br>
                runX := destX.<br>
                anchoredMorph<br>
                        displayOn: bitBlt destForm<br>
                        at: destX - anchoredMorph width @ destY<br>
                        clippingBox: bitBlt clipRect<br>
                        rule: Form blend<br>
                        fillColor: Color white<br>
        ].<br>
        ^ true!<br>
<br>
Item was changed:<br>
  ----- Method: MultiDisplayScanner&gt;&gt;setFont (in category &#39;private&#39;) -----<br>
  setFont<br>
        foregroundColor := paragraphColor.<br>
        super setFont.  &quot;Sets font and emphasis bits, and maybe foregroundColor&quot;<br>
        font installOn: bitBlt foregroundColor: foregroundColor backgroundColor: Color transparent.<br>
+       text ifNotNil:[| baselineY |<br>
-       text ifNotNil:[<br>
                baselineY := lineY + line baseline.<br>
                destY := baselineY - font ascent].<br>
  !<br>
<br>
<br>
</blockquote></div><br></div>