The only thing required for styling is to specify the attributes for the runs 
associated with the text.
A simple example:

| text attributes oldRuns clr|

text := (String loremIpsum: 1234) asText.

attributes := Array new: text size.

clr := TextColor color: Color random.

1 to: text size do: [ :index |
               attributes at: index put: {
                              clr.
                              TextFontChange font2
               }.

               (text at: index) isSeparator ifTrue: [ clr := TextColor color: 
Color random ]
].

text runs: (RunArray newFrom: attributes).

text


Best regards,
Henrik

From: Pharo-dev [mailto:pharo-dev-boun...@lists.pharo.org] On Behalf Of Nicolai 
Hess
Sent: Wednesday, April 6, 2016 8:23 PM
To: Pharo Development List <pharo-dev@lists.pharo.org>
Subject: Re: [Pharo-dev] TxText model



2016-04-06 18:11 GMT+02:00 p...@highoctane.be<mailto:p...@highoctane.be> 
<p...@highoctane.be<mailto:p...@highoctane.be>>:
Ok. Call me stupid but in Pharo I don't see how to do that easily.

Phil

At least for Rubric, it can not be that difficult. I saw a GT-Inspector with a 
XML-styer


On Wed, Apr 6, 2016 at 5:41 PM, Stephan Eggermont 
<step...@stack.nl<mailto:step...@stack.nl>> wrote:
On 06-04-16 11:13, p...@highoctane.be<mailto:p...@highoctane.be> wrote:
Another pain is the styling of text where the only styler we have is the 
SHSt80Styler (class name out of my mind, need to check) and that's a huge pain 
to support other stylings.

Styling with different stylers worked in TextMorph. In Squeak it is easy
to add styling for a different language in the class browser. Levente did
that for PostgreSQLv3.

Stephan



Reply via email to