Re: canvas rich text widget?



On Thu, 1 Feb 2001, Mike Kestner wrote:

> Bibek Sahu wrote:
>  
> >         So for now, I guess the question is: is anyone already working on a
> > Rich Text Widget?
> 
> An attempt at a RichText CanvasItem was begun in the CVS module
> tktext-port.  It uses the same model object that was forked into GTK2.0
> for the new TextWidget.  Obviously, it would be sweet to have the canvas
> item and text widget share a model object.

	Oooh... I like. :-)

	However, as the documents state, it is somewhat resource-hungry. 
This I do not like.  The new internal structure I came up with was designed
to have a small footprint, but only if you didn't change the styles too
much... since this tktext-port only bloats in its footprint if you change
styles often, I imagine it's just as good as what I had in mind.  Besides --
this is essentially the same as what's going into Gtk+ 2.0; I can now pray
that the Gtk+ folks take care of the memory overhead issues. ;-)

> I would encourage you to take a look at tktext-port and see if it could
> be a foundation for this work.  It doesn't render worth a damn yet, but
> it is editable, talks to the model object, and the CanvasItem
> boilerplate is done.  

	As I said, I like it.  What I'm going to /try/ to do is grab the
gtk+ 2.0 text widget and convert it over to drawing on the canvas.  I am not
yet sure how feasible an idea this is; the reason I thought of it is because
the tktext-port docs say that it should be easy to swap-out the underlying
backend, and because Havoc said that the gtk+ 2.0 version uses Pango to do
rendering, and Pango has a freetype renderer.  If it can do that, then I can
probably <cross fingers> get it to render freetype text to a GdkPixmap
(technically a GdkWindow, which underlies the Pixmap [or did when I last
checked]).  And as I recall, the important part of the Canvas buffer was
basically a GdkPixmap.

	Since it's probably already rendering to a GdkWindow, I may not even
have to change that part of the code.  What I /will/ have to deal with is
the pango stuff.  I know /of/ Pango, but that's really where it ends with
me.

	One of the things I'm considering is getting Pango to render to the
GnomeCanvas, but as I really don't know what I'm talking about here, I will
NOT accept this challenge yet.  Still, I could see such a thing as extremely
useful... then you really /could/ use the gtk+ 2 text widget, instead of
simply trying to maintain the core.

> Havoc Pennington is the maintainer of tktext-port, but he told the
> Achtung team to consider ourselves the maintainers of the canvas item. 
> Phil Schwan wrote the canvas item, but decided to stop working on it
> until the 2.0 platform when pango is available for rendering. I suspect
> Phil would welcome a new maintainer for it if you want to revive it. 
> Lack of a RT canvas item is the primary reason we defered Achtung to
> 2.0.  Let me know if I can help, and please keep us posted on your
> progress (list: achtung ximian com).

	I can certainly keep you posted.  For the moment, I just need to
absorb all this new information and try to parse it. :-)

> Mike

- Bibek





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]