canvas rich text widget?

Howdy all,

	I was planning on writing a fancy text-rendering widget for the
Gnome Canvas (as part of a fancy viewer/editor thing, but we need not get
into that right now).  I noticed that this has been on the Gnome wishlist
for some time now (since summer 1999, as I recall), but as near as I can
tell nothing's actually been done on it.

	I noticed some messages in list archives implying that someone was
planning to create something similar to this using freetype (and I actually
grabbed the python module which was referenced), but that was from 6 months
ago and I haven't found anything more recent.

	So, my question is: has anything actually been done on this?  If so,
whom should I contact to offer my assistance?  If not, are there any things
you recommend I take into account before I begin (I'm using Gnome 1.2, so
e.g. differences between the GnomeCanvasItem in 1.2, 1.4, and 2.0 would be

	A few notes on what I have in mind:

	I intend for this widget to be small, fast, and efficient.  It will
render text.  It will /only/ render text; any fancy abilities you want can
be done in separate things -- this widget ought to be appropriate for even
the smallest text editor.  It will have the ability to include generic
'objects' inline in the text but will not render them itself; and it will
have the ability to flow around generic 'obstructions' (which will initially
be rectangles, but could theoretically be any shape), but again it will not
render these itself.  Since it is an editor and not simply a viewer, you
will be able to change things on the fly; a side-effect of this is that it
will support progressive loading.

	I know this is possible, because I created a widget with these
properties (and which was small, /very/ fast, and pretty efficient) in QT
about 3-4 years ago.  I stopped working on it because it was getting to the
point where I was essentially creating the Gnome Canvas, but the Gnome
Canvas didn't exist at that time so I didn't have the option of simply using
it.  However, this time I intend to make it even cleaner and more efficient
than I did in the past... and I intend to use the canvas to take care of
many of the low-level details for me (and to do so much better than I would
have way back when ;-).  I've given a lot of thought to what I did right and
what I did wrong back then, but since I was in school I didn't have much
chance to implement my ideas.  Now that I've graduated, I have a little free
time (though I'm sure that will change once I find a real job... consulting
doesn't pay well if you don't have paying clients ;-).

	I think I'm simply going to use libfreetype2 to do the text
rendering.  QT took care of text scaling, shearing, yadda yadda yadda for me
back then; but X fonts don't support that natively.  Freetype2 supports
TrueType, Type1, OpenType, and a few other font types (and has a generic
driver interface), so one shall not want for fonts.

	I'm also planning for the core text-information structures to be
generic enough to be used at the console, without needing an X server
running.  This should be quite doable since freetype doesn't depend on X
(and in fact XFree 4.x depends on freetype ;-).  Done correctly, this will
also make it easier to switch to GnomeFont or whatever you folks are
planning for later versions of Gnome.

	This widget I'm planning to write in C, so that it will be usable by
the Gnome community at large.  The applications I intend to write based on
it will be in C++, because in my personal opinion that is much better suited
to GUI programming (since it has support for inheritance, multiple
inheritance, virtual functions, etc., etc., etc.).

	Further down the line:

	Once this is in a usable state (which shouldn't take /too/ long,
after I've finished planning -- and since I've spent the last three years
planning, there's little left), I'm planning to use it as part of a "text
processing system" (I can't think of a better way to describe it). 
Essentially, this is the core of a word processor, but with support for
plugins (which shall be shared libraries; can't use CORBA components here
because they're too slow, though you could create a CORBA/bonobo plugin if
you /really/ wanted).  When I did this in QT years ago, I had everything
down to cut/copy/paste as plugins.  One of my friends did a font-color
plugin, another guy did a spell check plugin; in total, there were 14
plugins available, at least half done by my friend who is not -- and does
not want to be -- much of a programmer.  Loading this thing with no plugins
got you something like MS Notepad (but with a smaller memory/resource
footprint), loading it with all the plugins we had got you something like MS
Wordpad; theoretically, had more plugins been created, it could have become
as fancy as MS Word.  The advantage of this design was that I only had to
contentrate on the core, and other people were able to add whatever features
they wanted.  But eventually I wanted to make it /too/ abstract (essentially
creating another GUI API, so I could use both Gtk+ and QT), and it shot me
in the foot.  I won't make that mistake again.  This time, I'm sticking to
Gnome-- and libglade. :-)

	Also, I intend to later use this as part of a desktop publisher. 
Really people, the only thing the Canvas is missing to be a basic desktop
publisher is a usable text component, and a GUI.

	Now this "text processing system" /may/ sound a bit far-fetched to
some, or sound like I'm biting off more than I can chew (which I suppose
depends on how well you understand what I've said, and how well you know me
;-), but it's actually very simple.  The reason it's simple is because I'm
only planning to make the core, and a nice, flexible module API (in C++,
though I'll probably put in a wrapper for C plugins).  The features will be
up to the users.  Doesn't have a feature you want?  Write a plugin for it,
or get one of your friends to do so; no need to write an entire app.  Need a
simple text editor?  Just load it without plugins (the QT thing I did years
ago took up about 2MB of RAM with just the basic plugins loaded).  Need
something like MS Word?  Install an extra DIMM and activate all plugins. ;-)

	Of course, for this to be a usable application, people other than
myself need to be working on this.  I'm hoping -- praying -- that once
something usable exists, people will start working with it.  Time will tell.


	So for now, I guess the question is: is anyone already working on a
Rich Text Widget?

- Bibek

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