Roassal2 multiline label

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Roassal2 multiline label

Arturo Zambrano
Dear all,
 
  in recent versions of Roassal2, multi line labels got wroken.
 bellow is a patch that fixes the problem



trachelShapeForMultiLine: anElement
    | lines s lbl n txt aColor fontSize |
    aColor := self colorFor: anElement.
    fontSize := self heightFor: anElement.
    txt := self textFor: anElement.
    txt := txt copyReplaceAll: String tab with: '    '.
    lines := txt lines.
    s := TRCompositeShape new.
    lines reverse
        do: [ :l |
            lbl := TRLabelShape new text: l.
            lbl color: aColor.
            lbl fontSize: fontSize.
            s shape1: lbl.
            s offset1: (lbl width / 2) @ 0.
            s offset2: 0 @ 20.
            n := TRCompositeShape new.
            n shape2: s.
            s := n ].
    ^ s
Reply | Threaded
Open this post in threaded view
|

Re: Roassal2 multiline label

Arturo Zambrano
Of course I meant broken :).
 The code is for RTLabel.




On Sun, Jun 15, 2014 at 3:35 PM, Arturo Zambrano <[hidden email]> wrote:
Dear all,
 
  in recent versions of Roassal2, multi line labels got wroken.
 bellow is a patch that fixes the problem



trachelShapeForMultiLine: anElement
    | lines s lbl n txt aColor fontSize |
    aColor := self colorFor: anElement.
    fontSize := self heightFor: anElement.
    txt := self textFor: anElement.
    txt := txt copyReplaceAll: String tab with: '    '.
    lines := txt lines.
    s := TRCompositeShape new.
    lines reverse
        do: [ :l |
            lbl := TRLabelShape new text: l.
            lbl color: aColor.
            lbl fontSize: fontSize.
            s shape1: lbl.
            s offset1: (lbl width / 2) @ 0.
            s offset2: 0 @ 20.
            n := TRCompositeShape new.
            n shape2: s.
            s := n ].
    ^ s