[squeak-dev] displaying attributed characters on workspaces

Ralph Boland rpboland at gmail.com
Sat Jun 20 13:55:41 UTC 2009


I have some code that draws trees using  '|' and '-' characters to link nodes
in the tree.  For example:

                 8
            8---|
            |     7
      8---|
      |     |     6
      |     6---|
      |           5
8---|
      |           4
      |     4---|
      |     |     3
      4---|
            |     2
            2---|
                  1

I have a number of problems when I display the tree in a workspace (or
debugger for that matter).

1)  I need a fixed font so that symbols are properly aligned.
     This problem can be seen in the above figure but the effect is
worse in Squeak.
2)  I also need to add some additional information to my trees.
     The addition information is text ('|' and '-' characters linking
nodes in the tree)
     and needs to be in color (Red) in order avoid making the figure
too confusing.
     Thus I need to display attributed characters.  Workspaces can
handle this but
     I need for the 'printOn:'  method to handle them as well.
3)  I would like to add my own special characters to use instead of
'|' and '-' so
     that there are no gaps between these special characters when used in my
     tree drawings.  I know how the code works to draw the return and assignment
     arrows but I do not know if I need to use special fonts so that
there are no forced
     gaps between characters and lines of text and if so which ones.

Is it possible for me to do these things and have my tree printed
accordingly when
my tree is displayed in a workspace (or debugger) resulting from a
'printOn: aStream'  message?
I know that the stream I get when the printOn:  is invoked is a
LimitedWriteStream.
but not much more.

If it is not possible to do these things then I will settle for
displaying it in a Text Pane.
I still need to know which font to use though.

The code is part of my implementation of the Spine Tree Decomposition
data structure
which I will release to www.squeaksource.com when it is completed.

Any help most appreciated.

Ralph Boland



More information about the Squeak-dev mailing list