2 * Copyright (C) 2006-2008 Benjamin Otte <otte@gnome.org>
3 * 2007 Pekka Lampila <pekka.lampila@iki.fi>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
21 #ifndef _SWFDEC_TEXT_LAYOUT_H_
22 #define _SWFDEC_TEXT_LAYOUT_H_
24 #include <swfdec_rectangle.h>
25 #include <swfdec_renderer.h>
26 #include <swfdec_text_buffer.h>
30 typedef struct _SwfdecTextLayout SwfdecTextLayout
;
31 typedef struct _SwfdecTextLayoutClass SwfdecTextLayoutClass
;
33 #define SWFDEC_TYPE_TEXT_LAYOUT (swfdec_text_layout_get_type())
34 #define SWFDEC_IS_TEXT_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_TEXT_LAYOUT))
35 #define SWFDEC_IS_TEXT_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_TEXT_LAYOUT))
36 #define SWFDEC_TEXT_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_TEXT_LAYOUT, SwfdecTextLayout))
37 #define SWFDEC_TEXT_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_TEXT_LAYOUT, SwfdecTextLayoutClass))
38 #define SWFDEC_TEXT_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_TEXT_LAYOUT, SwfdecTextLayoutClass))
40 struct _SwfdecTextLayout
44 SwfdecTextBuffer
* text
; /* the text we render */
46 gboolean word_wrap
; /* TRUE if we do word wrapping */
47 guint width
; /* width we use for alignment */
48 gboolean password
; /* TRUE if the text should be displayed as asterisks */
49 double scale
; /* scale factor in use */
52 GSequence
* blocks
; /* ordered list of blocks */
54 guint layout_width
; /* width of layout or 0 if not computed yet */
57 struct _SwfdecTextLayoutClass
59 GObjectClass object_class
;
62 GType
swfdec_text_layout_get_type (void);
64 SwfdecTextLayout
* swfdec_text_layout_new (SwfdecTextBuffer
* buffer
);
66 void swfdec_text_layout_set_wrap_width (SwfdecTextLayout
* layout
,
68 guint
swfdec_text_layout_get_wrap_width (SwfdecTextLayout
* layout
);
69 void swfdec_text_layout_set_word_wrap (SwfdecTextLayout
* layout
,
71 gboolean
swfdec_text_layout_get_word_wrap (SwfdecTextLayout
* layout
);
72 void swfdec_text_layout_set_password (SwfdecTextLayout
* layout
,
74 gboolean
swfdec_text_layout_get_password (SwfdecTextLayout
* layout
);
75 void swfdec_text_layout_set_scale (SwfdecTextLayout
* layout
,
77 double swfdec_text_layout_get_scale (SwfdecTextLayout
* layout
);
78 guint
swfdec_text_layout_get_width (SwfdecTextLayout
* layout
);
79 guint
swfdec_text_layout_get_height (SwfdecTextLayout
* layout
);
81 guint
swfdec_text_layout_get_n_rows (SwfdecTextLayout
* layout
);
82 guint
swfdec_text_layout_get_visible_rows (SwfdecTextLayout
* layout
,
85 guint
swfdec_text_layout_get_visible_rows_end (SwfdecTextLayout
* layout
,
87 void swfdec_text_layout_get_ascent_descent (SwfdecTextLayout
* layout
,
91 void swfdec_text_layout_render (SwfdecTextLayout
* layout
,
93 const SwfdecColorTransform
*ctrans
,
97 void swfdec_text_layout_query_position (SwfdecTextLayout
* layout
,