Code

Use subdirectories with icon sizes.
[inkscape.git] / src / sp-text.h
1 #ifndef __SP_TEXT_H__
2 #define __SP_TEXT_H__
4 /*
5  * SVG <text> and <tspan> implementation
6  *
7  * Author:
8  *   Lauris Kaplinski <lauris@kaplinski.com>
9  *
10  * Copyright (C) 1999-2002 Lauris Kaplinski
11  * Copyright (C) 2000-2001 Ximian, Inc.
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include <glib/gtypes.h>
17 #include <sigc++/sigc++.h>
18 #include "sp-item.h"
19 #include "sp-string.h"
20 #include "text-tag-attributes.h"
21 #include "libnr/nr-point.h"
22 #include "libnrtype/Layout-TNG.h"
25 #define SP_TYPE_TEXT (sp_text_get_type())
26 #define SP_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SP_TYPE_TEXT, SPText))
27 #define SP_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SP_TYPE_TEXT, SPTextClass))
28 #define SP_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_TEXT))
29 #define SP_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SP_TYPE_TEXT))
31 /* Text specific flags */
32 #define SP_TEXT_CONTENT_MODIFIED_FLAG SP_OBJECT_USER_MODIFIED_FLAG_A
33 #define SP_TEXT_LAYOUT_MODIFIED_FLAG SP_OBJECT_USER_MODIFIED_FLAG_A
36 /* SPText */
38 struct SPText : public SPItem {
39     /** Converts the text object to its component curves */
40     SPCurve *getNormalizedBpath() const
41         {return layout.convertToCurves();}
43     /** Completely recalculates the layout. */
44     void rebuildLayout();
46 //semiprivate:  (need to be accessed by the C-style functions still)
47     TextTagAttributes attributes;
48     Inkscape::Text::Layout layout;
49         
50     /** when the object is transformed it's nicer to change the font size
51     and coordinates when we can, rather than just applying a matrix
52     transform. is_root is used to indicate to the function that it should
53     extend zero-length position vectors to length 1 in order to record the
54     new position. This is necessary to convert from objects whose position is
55     completely specified by transformations. */
56     static void _adjustCoordsRecursive(SPItem *item, Geom::Matrix const &m, double ex, bool is_root = true);
57     static void _adjustFontsizeRecursive(SPItem *item, double ex, bool is_root = true);
58         
59     /** discards the NRArena objects representing this text. */
60     void _clearFlow(NRArenaGroup *in_arena);
62 private:
63     /** Recursively walks the xml tree adding tags and their contents. The
64     non-trivial code does two things: firstly, it manages the positioning
65     attributes and their inheritance rules, and secondly it keeps track of line
66     breaks and makes sure both that they are assigned the correct SPObject and
67     that we don't get a spurious extra one at the end of the flow. */
68     unsigned _buildLayoutInput(SPObject *root, Inkscape::Text::Layout::OptionalTextTagAttrs const &parent_optional_attrs, unsigned parent_attrs_offset, bool in_textpath);
69 };
71 struct SPTextClass {
72     SPItemClass parent_class;
73 };
75 GType sp_text_get_type();
77 #endif
79 /*
80   Local Variables:
81   mode:c++
82   c-file-style:"stroustrup"
83   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
84   indent-tabs-mode:nil
85   fill-column:99
86   End:
87 */
88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :