Google Summer of Code Project: Improve the text-tool in GIMP

By Daniel Eddeland (Skalle)

In Gimp 2.4 and earlier versions, the text tool uses an external
editor window, which is inconvenient in several ways.  The aim of my
project was to support on-canvas text editing, so that the user would
be able to act directly on the image, instead of using a separate
window.  The code has been placed in a special SVN branch, called
"soc-2008-text", which anybody who has SVN access can download and

What have I done?

*The first thing I did was to port the text-core in gimp to use
 PangoCairo functions instead of Freetype2.  This port will be helpful
 for some work in the future which will make the text-tool faster.
*After porting I started working on "on-canvas text editing". That
 means you'll be able to type, delete, copy and paste text on-canvas
 instead of using the text-dialog. I have added settings to tools to
 give them the ability to grab the keyboard input (which is obviously
 needed if you want to type). With these settings the tool can block
 the input from the rest of the interface, so that typing a "P" will
 add a "P" to the current text object instead of switching to GIMP's
 pencil tool. Input is possible typing normally on a regular keyboard,
 but also using alternate input methods like SCIM.
*I have added a text-cursor, mouse-actions and graphical feedback for
 text-selections, so the text-tool would feel as ergonomic as possible
 like other text applications.
*I have added a context-sensitive menu which appears when you
 right-click on the text-area. It has options such as copy/cut/paste
 and changing input methods.
*I have also helped fixing some minor bugs not directly related to
 on-canvas editing.

What still needs to be done:

The code is already usable.  For large images or large text layers,
there may sometimes be annoying delays between typing and the
appearance of the text in the image.  It would be nice to have some
sort of fast preview.  Doing this properly would require changes in
the way Gimp displays an image, though.  (Technically, it requires
implementing non-xor drawing for tools.)

There are still some bugs related to what I have done during GSoC:
some of these haven't been done because they're low priority and there
hasn't been time yet, some of them haven't been done because there are
decisions about program design that hasn't been made yet. As for other
features in the text tool; I have not done anything not written in
this report (unless I've forgotten something). I do think that having
several text-styles per text-object would be a nice feature
though. That is: you would be able to make part of your text blue,
while another part of it could be another font, size or color (or all
of them).  I want to be able to work on this in the future if my spare
time allows it, and during the summer I have done changes to the
text-tool and learnt more about datatypes that will help making this
a reality.

Note: In the trunk version of Gimp, when you right-click in an image,
you get a version of the same menu you see in the menubar on top of
the image.  We decided that it is necessary for the text tool to have
a "context menu" instead -- a special menu holding text-related
commands.  As the code works now, the context menu pops up if you
right-click over the text layer.  Right-clicking elsewhere gives you
the image menu.  The infrastructure I created to support this could in
principle be used to give context menus to other tools as well.

When will you get to see how it works?

If all goes as planned, on-canvas editing will not be available in
GIMP 2.6, but in GIMP 2.7. The 2.6 is drawing nearer and there are
still some things that should be done and discussed about the text
editing, and on top of that some bug testing. I hope this report gives
you enough information, along with the pictures linked below, to be
able to wait until the actual release. If you have knowledge of svn
you can try the not-yet-totally-stable Gsoc-2008-text branch to try it

Picture links:

(The color is different in two of the pictures because I
used another program for image capture)

To finish off I would like to thank my mentor bill Skaggs who has
helped me alot, been available all the time, and put a lot of time into
this. I would also like to thank the rest of the GIMP developers who have
helped me with various things, and I'd like to thank Google for sponsoring.
Gimp-developer mailing list

Reply via email to