[squeak-dev] Rendering a text along an arc

tim Rowledge tim at rowledge.org
Mon Dec 31 18:56:31 UTC 2018


Neat stuff, but I do so hate to see #isKindOf:.


> On 2018-12-31, at 3:29 AM, karl ramberg <karlramberg at gmail.com> wrote:
> 
> TextMorph>>createParagraph
> 
>     self setProperty: #CreatingParagraph toValue: true.
> 
>     [
>         self setDefaultContentsIfNil.
> 
>         "...Code here to recreate the paragraph..."
>         paragraph := (self paragraphClass new textOwner: self owner).
>         paragraph wantsColumnBreaks: successor notNil.
>         paragraph
>             compose: text
>             style: textStyle copy
>             from: self startingIndex
>             in: self container.
>         (paragraph isKindOf: TextOnCurve)
>         ifTrue:[
>                 paragraph focused: (self currentHand keyboardFocus == self).
>                 self fit.
>                 self removeProperty: #CreatingParagraph.
>                       ^ paragraph].
>         wrapFlag ifFalse:
>             ["Was given huge container at first... now adjust"
>             paragraph adjustRightX].
>         paragraph focused: (self currentHand keyboardFocus == self).
>     
>         self fit.
>     ] ensure: [self removeProperty: #CreatingParagraph].
> 
>     ^ paragraph

That 'isKindOf: TextOnCurve' seems like it ought to be redundant. Both branches send #fit, focused; & removeProperty (in fact the ensure will make sure it happens twice for TextOnCurve instances) so it's hard to see what the intent is here.

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Did you hear about Christopher Robin Hood? He stole from the rich to give to the Pooh




More information about the Squeak-dev mailing list