Archive for December, 2007

Simple Text Shape


In flake there already is a text shape using the kotext library for displaying all sort of text boxes. But as Karbon is a vector drawing application there are some special needs which are rightly not implemented in the default text shape. One of these special cases is text on path support, i.e. having a text line flowing along a given path. So I recently started to implement a new simple flake text shape which renders the character outlines using QPainterPath. Having the single chars as path objects makes it pretty easy to move and rotate them around so that they can follow arbitrary curves as their baseline. And i must say with the path classes from Qt4 that is amazingly simple.
Additionally having the path based text makes it automatically possible to define the stroke (outline) and the fill with the default stroke and fill tools. So you can have dashed outlines and gradient fill in your text for example.
Below is a screenshot showing the path based text shape in action. The basic features already work quite nice. But it is still somewhat slow as there is some infrastructure work still required within flake. That is needed so that the text is automatically updated if the attached path it flows on is changed.

Text on path in karbon