[squeak-dev] Rendering a text along an arc
cunningham.cb at gmail.com
Mon Dec 31 19:20:58 UTC 2018
On Mon, Dec 31, 2018, 10:56 tim Rowledge <tim at rowledge.org wrote:
> 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 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.
> What the intent looks like is to avoid the #adjustRightX if the wrapFlag
is not set - which is causing the error(s), at least when I tried it.
Another alternative might be to implement TextOnCurve>>adjustRightX to be a
no-op (with a suitable comment) so that it didn't do anything in this case.
Then the isKindOf: could go away.
And, Karl, thank you for tracking this down!
> what is
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev