[squeak-dev] #isBreakableAt:in:

Bob Arning arning315 at comcast.net
Thu Sep 26 14:14:20 UTC 2013


Well, something is a little wrong

StringHolder new contents:  'word1 word2 word3 word4 word5 word6 word7 
word8 word9 word10 word11 word12 word13 word14 word15 word16 word17 
word18 word19 word20 word21 word22 word23 word24 word25 word26 word27 
word28 word29 word30 ' asWideString,(WideString with: 401 asCharacter 
with: $a with: 402 asCharacter with: $b); openLabel: 'foo'

If you resize this window, you see lines breaking in the middle of 
words. Because breakAtSpace is always false, you simply

     (breakableIndex isNil or: [breakableIndex < line first]) ifTrue: [
         "Any breakable point in this line.  Just wrap last character."
         breakableIndex := lastIndex - 1.
         lineHeightAtBreak := lineHeight.
         baselineAtBreak := baseline.
     ].

     "It wasn't a space, but anyway this is where we break the line."
     line stop: breakableIndex.
     lineHeight := lineHeightAtBreak.
     baseline := baselineAtBreak.
     ^ true.

an break wherever the line crossed the right margin.

Cheers,
Bob

On 9/25/13 10:01 PM, tim Rowledge wrote:
> On 24-09-2013, at 2:21 PM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
>
>> 2013/9/21 tim Rowledge <tim at rowledge.org>
>>
>> a) There are {language}environment classes and encoding classes. There is #isBreakableAt:in: implemented in both but seemingly unused in the encoding classes because it is just plain broken there. Should it be removed from the encoders? In the language environment classes it is implemented to return true for space and cr by default, but space, cr & lf in Latin1 and Latin2. Is that as expected?
>>
>>   
>>  From what I understand:
>> - no need to answer true for space, cr, lf since these are already handled in the CharacterScanner stopConditions, so default answer should be ^false (unless one of these is removed from stopConditions, I thought I saw that, but cannot remember...)
>> - whether it should be in EncodedCharSet or LanguageEnvironment, I don't know…
> I'm a bit puzzled by what's going on here, now that I'm looking into it. The Multi* classes actually *do* have stopConditions *without* space, and don't have methods to handle #space. And yet I can't find anything going wrong… this is odd.
>
> With Nicolas' changes to the implementations of #isBreakableAt:in: it seems like we shouldn't be getting any use of registerBreakableIndex (and in fact I'm running code where it isn't even in the scan methods to be called!) and so MultiCompositionScanner>crossedX ought to be getting a bit annoyed by now. The only bit of its code getting run is the last 4 lines and 'breakableIndex'/'lineHeightAtBreak'/'baselineAtBreak' are all nil. This surely ought to be breaking the TextLine 'line' but so far… nothing. Even changing the width of windows to force recomposing doesn't seem to upset things. Why isn't it breaking!
>
> tim
> --
> tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
> Compatible: Gracefully accepts erroneous data from any source.
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130926/20b15df3/attachment.htm


More information about the Squeak-dev mailing list