[squeak-dev] Rendering a text along an arc

karl ramberg karlramberg at gmail.com
Mon Dec 31 11:29:56 UTC 2018


With this change it works.
Text segments will be added along the curve.
Unless the text overflow the line, then it will only show the first text
segment.
Just make the line longer to make it show again,


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

On Sun, Dec 30, 2018 at 11:06 PM karl ramberg <karlramberg at gmail.com> wrote:

> TextMorph>>createParagraph is the method that broke the TextOnCurve
> functionality.
>
> It need a guard against applying wrapFlag.
>
> There is also some bug with the bounds so the text will not redraw
> properly.
>
> Something like this under will prevent the DNU but it will not fix the
> issue with the text bounds.
>
> 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:[ 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
>
> Cheers,
> Karl
>
>
> On Sun, Dec 30, 2018 at 3:56 PM karl ramberg <karlramberg at gmail.com>
> wrote:
>
>> Broke between #16520 and update: #18028
>>
>> Best,
>> Karl
>>
>>
>> On Sun, Dec 30, 2018 at 3:20 PM karl ramberg <karlramberg at gmail.com>
>> wrote:
>>
>>> I just tested this in a 2.5 image and it worked :-)
>>> I'm not sure when it broke...
>>>
>>> Best,
>>> Karl
>>>
>>>
>>> On Sun, Dec 30, 2018 at 9:36 AM karl ramberg <karlramberg at gmail.com>
>>> wrote:
>>>
>>>>  Hi,
>>>> You can pull out a Line from the Graphics category in the ObjectsTool.
>>>> Then enable 'drop in' in the Lines menu.
>>>> Then pull out Text from the Basic category.
>>>> In Texts menu you can then select 'follow owner's curve'
>>>>
>>>> Unfortunately it it broken. I think because NewParagraph uses another
>>>> notion of container than what is expected.
>>>>
>>>> Best,
>>>> Karl
>>>>
>>>> On Sun, Dec 30, 2018 at 2:06 AM Eliot Miranda <eliot.miranda at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>     anyone have any code to display text in a nice font along an arc
>>>>> or a spiral?
>>>>>
>>>>> _,,,^..^,,,_
>>>>> best, Eliot
>>>>>
>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181231/3a907723/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: textOnCurve.png
Type: image/png
Size: 26588 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181231/3a907723/attachment.png>


More information about the Squeak-dev mailing list